SelectedTranslationDialog.xaml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <UserControl x:Class="PDF_Master.Views.Dialog.ChatGPTAIDialogs.SelectedTranslationDialog"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:convert="clr-namespace:PDF_Master.DataConvert"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:cus="clr-namespace:PDF_Master.CustomControl"
  6. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  7. xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
  8. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  9. xmlns:prism="http://prismlibrary.com/"
  10. Width="548"
  11. Height="342"
  12. d:DesignHeight="342"
  13. d:DesignWidth="548"
  14. prism:Dialog.WindowStyle="{StaticResource DialogWindowStyle}"
  15. Background="White"
  16. prism:ViewModelLocator.AutoWireViewModel="True"
  17. mc:Ignorable="d">
  18. <UserControl.Resources>
  19. <ResourceDictionary>
  20. <convert:SizeBrushConvert x:Key="SizeBrushConvert" />
  21. <convert:SizeToBoolConvert x:Key="SizeToBoolConvert"/>
  22. </ResourceDictionary>
  23. </UserControl.Resources>
  24. <Grid>
  25. <Grid.RowDefinitions>
  26. <RowDefinition Height="50"></RowDefinition>
  27. <RowDefinition Height="*"></RowDefinition>
  28. </Grid.RowDefinitions>
  29. <Border Grid.RowSpan="2"
  30. Panel.ZIndex="1" Background="Transparent" Visibility="{Binding ProgressVisible}">
  31. <Border
  32. Width="226"
  33. Height="58"
  34. Background="{StaticResource color.sys.layout.dark.bg}"
  35. BorderThickness="0"
  36. CornerRadius="{StaticResource border-radius.8}"
  37. Effect="{StaticResource shadow.neutral.m}"
  38. >
  39. <Grid Margin="16,13" Background="Transparent">
  40. <StackPanel Orientation="Horizontal">
  41. <TextBlock Foreground="{StaticResource color.sys.text.anti.norm}" Text="Translating..." />
  42. <TextBlock
  43. Foreground="{StaticResource color.sys.text.anti.norm}"
  44. Text="{Binding Value, StringFormat={}({0})}"
  45. Visibility="Collapsed" />
  46. </StackPanel>
  47. <Button
  48. Width="12"
  49. Height="12"
  50. Padding="0,0,1,1"
  51. HorizontalAlignment="Right"
  52. VerticalAlignment="Top"
  53. Background="{StaticResource color.sys.layout.dark.bg}"
  54. BorderThickness="0"
  55. Visibility="Collapsed">
  56. <Path Data="M6.00006 7.06072L9.46973 10.5304L10.5304 9.46973L7.06072 6.00006L10.5304 2.53039L9.46973 1.46973L6.00006 4.9394L2.53039 1.46973L1.46973 2.53039L4.9394 6.00006L1.46973 9.46973L2.53039 10.5304L6.00006 7.06072Z" Fill="#CED0D4" />
  57. </Button>
  58. <ProgressBar
  59. Height="4"
  60. Margin="0,0,0,4"
  61. VerticalAlignment="Bottom"
  62. BorderThickness="0"
  63. Foreground="{StaticResource color.slider.track-filled.norm}"
  64. Maximum="{Binding MaxValue}"
  65. Value="{Binding Value}" />
  66. </Grid>
  67. </Border>
  68. </Border>
  69. <Grid Grid.Row="0">
  70. <StackPanel Orientation="Horizontal">
  71. <TextBlock Margin="16,0,0,0" Text="{Binding T_Title}" FontFamily="Segoe UI"
  72. FontSize="16"
  73. FontWeight="Bold"
  74. Foreground="{StaticResource color.sys.text.neutral.lv1}" Height="28"></TextBlock>
  75. <Grid Width="16" Height="16" Margin="4,0,0,4" WindowChrome.IsHitTestVisibleInChrome="True">
  76. <Grid.ToolTip>
  77. <ToolTip Background="Transparent" BorderBrush="Transparent">
  78. <Border Background="{StaticResource color.sys.layout.dark.bg}" Width="255" Height="66" CornerRadius="4">
  79. <TextBlock Foreground="{StaticResource color.sys.text.anti.norm}" VerticalAlignment="Center" HorizontalAlignment="Center" Width="240" FontSize="12" Text="{Binding T_LimitTip}" />
  80. </Border>
  81. </ToolTip>
  82. </Grid.ToolTip>
  83. <Ellipse Width="14" Height="14" Fill="white" Stroke="#CED0D4">
  84. </Ellipse>
  85. <Path Data="M7.4701 8.91H8.5001L8.7601 5.49L8.8101 4H7.1601L7.2101 5.49L7.4701 8.91ZM7.9901 11.58C8.4901 11.58 8.8701 11.21 8.8701 10.69C8.8701 10.17 8.4901 9.81 7.9901 9.81C7.4801 9.81 7.1001 10.17 7.1001 10.69C7.1001 11.21 7.4701 11.58 7.9901 11.58Z" Fill="#94989C"/>
  86. </Grid>
  87. </StackPanel>
  88. <Button
  89. Width="46"
  90. Height="32"
  91. Margin="8"
  92. HorizontalAlignment="Right"
  93. VerticalAlignment="Top"
  94. Background="Transparent"
  95. IsCancel="True"
  96. Style="{StaticResource CloseBtn}"
  97. WindowChrome.IsHitTestVisibleInChrome="True">
  98. <Path
  99. Width="46"
  100. Height="32"
  101. Data="M23 17.708L18.8545 21.8535C18.7568 21.9512 18.6396 22 18.5029 22C18.3597 22 18.2393 21.9528 18.1416 21.8584C18.0472 21.7607 18 21.6403 18 21.4971C18 21.3604 18.0488 21.2432 18.1465 21.1455L22.292 17L18.1465 12.8545C18.0488 12.7568 18 12.638 18 12.498C18 12.4297 18.013 12.3646 18.0391 12.3027C18.0651 12.2409 18.1009 12.1888 18.1465 12.1465C18.1921 12.1009 18.2458 12.0651 18.3076 12.0391C18.3695 12.013 18.4346 12 18.5029 12C18.6396 12 18.7568 12.0488 18.8545 12.1465L23 16.292L27.1455 12.1465C27.2432 12.0488 27.362 12 27.502 12C27.5703 12 27.6338 12.013 27.6924 12.0391C27.7542 12.0651 27.8079 12.1009 27.8535 12.1465C27.8991 12.1921 27.9349 12.2458 27.9609 12.3076C27.987 12.3662 28 12.4297 28 12.498C28 12.638 27.9512 12.7568 27.8535 12.8545L23.708 17L27.8535 21.1455C27.9512 21.2432 28 21.3604 28 21.4971C28 21.5654 27.987 21.6305 27.9609 21.6924C27.9349 21.7542 27.8991 21.8079 27.8535 21.8535C27.8112 21.8991 27.7591 21.9349 27.6973 21.9609C27.6354 21.987 27.5703 22 27.502 22C27.362 22 27.2432 21.9512 27.1455 21.8535L23 17.708Z"
  102. Fill="Black" />
  103. </Button>
  104. </Grid>
  105. <Grid Grid.Row="1" >
  106. <StackPanel>
  107. <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="16,16,0,0">
  108. <TextBlock Text="{Binding T_TranslationLanguage}" Height="22"></TextBlock>
  109. <ComboBox Width="165" Height="32" Margin="12,0,0,0" ItemsSource="{Binding FromlanguageFamily}" SelectedIndex="{Binding FromlanguageIndex}"></ComboBox>
  110. <Path Width="24" Height="24" Margin="8,0,8,0" Data="M15.7071 2.79289C15.3166 2.40237 14.6834 2.40237 14.2929 2.79289C13.9024 3.18342 13.9024 3.81658 14.2929 4.20711L18.5858 8.5H3C2.44772 8.5 2 8.94772 2 9.5C2 10.0523 2.44772 10.5 3 10.5H21C21.1374 10.5 21.2683 10.4723 21.3874 10.4222C21.4946 10.3772 21.5955 10.3127 21.6848 10.2288C21.6999 10.2145 21.7147 10.1998 21.7289 10.1846C21.8115 10.0968 21.8753 9.99761 21.9201 9.89233C21.9715 9.77187 22 9.63926 22 9.5C22 9.36074 21.9715 9.22813 21.9201 9.10767C21.8753 9.00239 21.8115 8.90324 21.7289 8.81538C21.721 8.80691 21.7129 8.79858 21.7046 8.7904L15.7071 2.79289ZM18.9852 15.5L14.6923 19.7929C14.3018 20.1834 14.3018 20.8166 14.6923 21.2071C15.0828 21.5976 15.716 21.5976 16.1065 21.2071L22.1065 15.2071C22.497 14.8166 22.497 14.1834 22.1065 13.7929C21.9973 13.6837 21.8691 13.605 21.7325 13.5568C21.6283 13.52 21.5161 13.5 21.3993 13.5H21.399H3.39928C2.84699 13.5 2.39928 13.9477 2.39928 14.5C2.39928 15.0523 2.84699 15.5 3.39928 15.5H18.9852Z" Fill="#CED0D4"></Path>
  111. <ComboBox Width="165" Height="32" ItemsSource="{Binding TolanguageFamily}" SelectedIndex="{Binding TolanguageIndex}"></ComboBox>
  112. </StackPanel>
  113. <StackPanel Orientation="Horizontal" Margin="0,16,0,0">
  114. <StackPanel>
  115. <Grid Width="250" Height="180" Margin="16,0,0,0">
  116. <cus:TextBoxEx x:Name="textBoxEnterCharacters" Width="250" Height="180" Text="{Binding SelectedText}" FontFamily="Segoe UI" ShowClose="False" PlaceholderText="{Binding T_TextBoxWatermark}" VerticalContentAlignment="Top" HorizontalContentAlignment="Left" TextWrapping="Wrap" Padding="8" >
  117. <i:Interaction.Triggers>
  118. <i:EventTrigger EventName="TextChanged">
  119. <i:InvokeCommandAction Command="{Binding textBoxEnterCharactersTextChangedCommad}" CommandParameter="{Binding ElementName=textBoxEnterCharacters}" />
  120. </i:EventTrigger>
  121. </i:Interaction.Triggers>
  122. </cus:TextBoxEx>
  123. <TextBlock x:Name="SizeTextBlock" Text="{Binding ElementName=textBoxEnterCharacters,Path=Text.Length,StringFormat={}{0}/150}" Panel.ZIndex="1" Height="22" FontSize="14" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,12,8" Foreground="{Binding ElementName=textBoxEnterCharacters,Path=Text.Length, Converter={StaticResource SizeBrushConvert}}"/>
  124. </Grid>
  125. <Button HorizontalAlignment="Right" Width="97" Height="24" Content="{Binding T_TranslationBtn}" VerticalAlignment="Bottom" Style="{StaticResource Btn.cta}" Margin="0,8,0,0" Command="{Binding TranslateCommand}" IsEnabled="{Binding ElementName=textBoxEnterCharacters,Path=Text.Length, Converter={StaticResource SizeToBoolConvert}}"></Button>
  126. </StackPanel>
  127. <StackPanel>
  128. <Grid>
  129. <Border Width="250" Height="180" Margin="16,0,0,0" Panel.ZIndex="1" BorderBrush="{StaticResource color.field.border.error}" Visibility="{Binding ErrorVisible}" BorderThickness="1" CornerRadius="4" >
  130. <StackPanel Orientation="Horizontal" VerticalAlignment="Top" Margin="16">
  131. <Grid Width="16" Height="16" Margin="4,0,8,0" VerticalAlignment="Top">
  132. <Ellipse Width="14" Height="14" Fill="#F3465B"></Ellipse>
  133. <Path Data="M7.25 4V9H8.75V4H7.25ZM7.25 10.5V12H8.75L8.75 10.5H7.25Z" Fill="white"/>
  134. </Grid>
  135. <TextBlock Text="{Binding ErrorTipText}" FontSize="14" FontFamily="SF Pro Text" Foreground="#F3465B" VerticalAlignment="Center" TextWrapping="Wrap" Width="180"></TextBlock>
  136. </StackPanel>
  137. </Border>
  138. <cus:TextBoxEx x:Name="TranslateTextBoxEx" Width="250" Height="180" Margin="16,0,0,0" Text="{Binding TranslateText}" FontFamily="Segoe UI" ShowClose="False" VerticalContentAlignment="Top" HorizontalContentAlignment="Left" TextWrapping="Wrap" Padding="8" IsReadOnly="True">
  139. </cus:TextBoxEx>
  140. </Grid>
  141. <Button HorizontalAlignment="Right" Width="97" Height="24" Content="{Binding T_Copy}" VerticalAlignment="Bottom" Margin="0,8,0,0" Command="{Binding CopyCommand}" IsEnabled="{Binding ElementName=TranslateTextBoxEx,Path=Text.Length, Converter={StaticResource SizeToBoolConvert}}" Style="{StaticResource btn.sec}"></Button>
  142. </StackPanel>
  143. </StackPanel>
  144. </StackPanel>
  145. <cus:ToastControl
  146. HorizontalAlignment="Right"
  147. VerticalAlignment="Bottom"
  148. Width="72"
  149. Height="32"
  150. Margin="0,0,25,44"
  151. Padding="0,4,0,0"
  152. Background="{StaticResource color.sys.layout.dark.bg}"
  153. BeginTime="0:0:0:3"
  154. CornerRadius="4"
  155. FontSize="14"
  156. Panel.ZIndex="1"
  157. Foreground="White"
  158. StringContent="{Binding T_Copied}"
  159. Visibility="{Binding ShowTip, Mode=TwoWay}"
  160. Duration="0:0:0:3" />
  161. </Grid>
  162. </Grid>
  163. </UserControl>