MergeDialog.xaml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <UserControl x:Class="PDF_Office.Views.Dialog.ToolsDialogs.MergeDialog"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="clr-namespace:PDF_Office.Views.Dialog.PageEditDialogs"
  7. mc:Ignorable="d"
  8. xmlns:prism="http://prismlibrary.com/" xmlns:customcontrol="clr-namespace:PDF_Office.CustomControl" xmlns:dataconvert="clr-namespace:PDF_Office.DataConvert" xmlns:toolsdialogs="clr-namespace:PDF_Office.ViewModels.Dialog.ToolsDialogs" xmlns:i="http://schemas.microsoft.com/xaml/behaviors" d:DataContext="{d:DesignInstance Type=toolsdialogs:MergeDialogViewModel}"
  9. prism:Dialog.WindowStyle="{StaticResource DialogWindowStyle}"
  10. Width="818"
  11. Height="600"
  12. >
  13. <UserControl.Resources>
  14. <dataconvert:IndexConverter x:Key="IndexConverter"/>
  15. <dataconvert:BoolToVisible x:Key="BoolToVisible" />
  16. <dataconvert:UnVisivleConvert x:Key="UnVisivleConvert" />
  17. <dataconvert:ListCountToVisible x:Key="ListCountToVisible"/>
  18. <dataconvert:UnVisibleToBoolConvert x:Key="UnVisibleToBoolConvert"/>
  19. </UserControl.Resources>
  20. <Grid Background="{StaticResource color.sys.layout.anti}">
  21. <Grid.ColumnDefinitions>
  22. <ColumnDefinition Width="16"/>
  23. <ColumnDefinition Width="558"/>
  24. <ColumnDefinition Width="260"/>
  25. <ColumnDefinition Width="16"/>
  26. </Grid.ColumnDefinitions>
  27. <Grid.RowDefinitions>
  28. <RowDefinition Height="16"/>
  29. <RowDefinition Height="20"/>
  30. <RowDefinition Height="8"/>
  31. <RowDefinition Height="*"/>
  32. <RowDefinition Height="16"/>
  33. <RowDefinition Height="50"/>
  34. <RowDefinition Height="16"/>
  35. </Grid.RowDefinitions>
  36. <Border Grid.Column="1" Grid.Row="3">
  37. <Grid AllowDrop="True" Background="{StaticResource color.sys.layout.anti}"
  38. PreviewDrop="Grid_Drop"
  39. PreviewDragEnter="Grid_DragEnter"
  40. PreviewDragOver="Grid_DragOver"
  41. PreviewDragLeave="Grid_DragLeave"
  42. >
  43. <StackPanel
  44. x:Name="NoFileStackPanel" HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="{Binding MergeObjectlist.Count, Converter={StaticResource ListCountToVisible}}" >
  45. <customcontrol:ImageButton
  46. Height="128" Width="128" IconHeight="128" IconWidth="128"
  47. Icon="pack://application:,,,/PDF Office;component/Resources/Dialog/AddImage.png"
  48. IconPress="pack://application:,,,/PDF Office;component/Resources/Dialog/AddImageSuspend.png"
  49. IconMouseOver="pack://application:,,,/PDF Office;component/Resources/Dialog/AddImageSuspend.png" Command="{Binding AddFilesCommand}" CommandParameter="0"/>
  50. <TextBlock Text="Selected files" FontSize="14" FontFamily="Segoe UI" HorizontalAlignment="Center" VerticalAlignment="Center"/>
  51. <TextBlock Text="Drop files here or Click Add Files at bottom right button. You can drag files to reorder as you need." FontSize="14" FontFamily="Segoe UI" HorizontalAlignment="Center" TextAlignment="Center" VerticalAlignment="Center" TextWrapping="Wrap"/>
  52. </StackPanel>
  53. <ListView x:Name="MergeView" AllowDrop="True"
  54. Visibility="{Binding ElementName=NoFileStackPanel,Path=Visibility,Converter={StaticResource UnVisivleConvert}}"
  55. Drop="MergeView_Drop"
  56. DragEnter="MergeView_DragEnter"
  57. DragOver="MergeView_DragOver"
  58. DragLeave="MergeView_DragLeave"
  59. PreviewMouseMove="MergeView_PreviewMouseMove"
  60. ItemsSource="{Binding MergeObjectlist}"
  61. ScrollViewer.HorizontalScrollBarVisibility="Disabled"
  62. HorizontalContentAlignment="Stretch">
  63. <ListView.ItemTemplate>
  64. <DataTemplate >
  65. <Grid x:Name="ContentPanel" >
  66. <Grid.ColumnDefinitions>
  67. <ColumnDefinition Width="Auto"/>
  68. <ColumnDefinition Width="*"/>
  69. <ColumnDefinition Width="*"/>
  70. <ColumnDefinition Width="*"/>
  71. <ColumnDefinition Width="*"/>
  72. <ColumnDefinition Width="*"/>
  73. </Grid.ColumnDefinitions>
  74. <TextBlock Text="{Binding RelativeSource={RelativeSource FindAncestor,
  75. AncestorType={x:Type ListViewItem}},
  76. Converter={StaticResource IndexConverter}}"
  77. VerticalAlignment="Center" HorizontalAlignment="Center"/>
  78. <Image Grid.Column="1" Width="50" Height="50" HorizontalAlignment="Center" VerticalAlignment="Center" Source="{Binding DocThumbnail}" Stretch="Uniform" />
  79. <StackPanel Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center">
  80. <TextBlock Text="{Binding DocName}" TextTrimming="CharacterEllipsis"/>
  81. <TextBlock Text="{Binding DocPageCount}" />
  82. </StackPanel>
  83. <StackPanel Grid.Column="3" HorizontalAlignment="Center" VerticalAlignment="Center">
  84. <customcontrol:WritableComboBox SelectedIndex="0" MaxPageRange="{Binding SDKPageCount}" Text="{Binding SetPageRange,Mode=TwoWay}"/>
  85. </StackPanel>
  86. <TextBlock Grid.Column="4" Text="{Binding DocSize}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
  87. <StackPanel Grid.Column="5" VerticalAlignment="Center">
  88. <Button Content="删除" Click="Delete_Click"/>
  89. </StackPanel>
  90. <StackPanel Grid.ColumnSpan="5" Visibility="{Binding IsForward, Converter={StaticResource BoolToVisible}}" Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Bottom">
  91. <Line Margin="0,0,0,0" X1="0" X2="{Binding ElementName=ContentPanel,Path=ActualWidth}" HorizontalAlignment="Stretch" StrokeThickness="1.5" Stroke="#FF0078D7" VerticalAlignment="Bottom"/>
  92. </StackPanel>
  93. <StackPanel Grid.ColumnSpan="5" Visibility="{Binding IsBackwards, Converter={StaticResource BoolToVisible}}" Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Top">
  94. <Line X1="0" X2="{Binding ElementName=ContentPanel,Path=ActualWidth}" HorizontalAlignment="Stretch" StrokeThickness="1.5" Stroke="Red" VerticalAlignment="Bottom"/>
  95. </StackPanel>
  96. </Grid>
  97. </DataTemplate>
  98. </ListView.ItemTemplate>
  99. </ListView>
  100. </Grid>
  101. </Border>
  102. <Border Grid.Column="2" Grid.Row="3">
  103. <Grid>
  104. <Grid.RowDefinitions>
  105. <RowDefinition Height="20"/>
  106. <RowDefinition Height="*"/>
  107. </Grid.RowDefinitions>
  108. <TextBlock Text=" Page Size"/>
  109. <StackPanel Grid.Row="1">
  110. <RadioButton Content="Original page size" Tag="0">
  111. <i:Interaction.Triggers>
  112. <i:EventTrigger EventName="Checked">
  113. <i:InvokeCommandAction Command="{Binding SetPageSizeTypeCommand}" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=RadioButton}}" PassEventArgsToCommand="True" />
  114. </i:EventTrigger>
  115. </i:Interaction.Triggers>
  116. </RadioButton>
  117. <RadioButton Content="A4" Tag="1">
  118. <i:Interaction.Triggers>
  119. <i:EventTrigger EventName="Checked">
  120. <i:InvokeCommandAction Command="{Binding SetPageSizeTypeCommand}" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=RadioButton}}" PassEventArgsToCommand="True" />
  121. </i:EventTrigger>
  122. </i:Interaction.Triggers>
  123. </RadioButton>
  124. <RadioButton Content="A3" Tag="2">
  125. <i:Interaction.Triggers>
  126. <i:EventTrigger EventName="Checked">
  127. <i:InvokeCommandAction Command="{Binding SetPageSizeTypeCommand}" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=RadioButton}}" PassEventArgsToCommand="True" />
  128. </i:EventTrigger>
  129. </i:Interaction.Triggers>
  130. </RadioButton>
  131. <RadioButton Content="U.S.Letter" Tag="3">
  132. <i:Interaction.Triggers>
  133. <i:EventTrigger EventName="Checked">
  134. <i:InvokeCommandAction Command="{Binding SetPageSizeTypeCommand}" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=RadioButton}}" PassEventArgsToCommand="True" />
  135. </i:EventTrigger>
  136. </i:Interaction.Triggers>
  137. </RadioButton>
  138. <RadioButton Content="U.S.Legal" Tag="4">
  139. <i:Interaction.Triggers>
  140. <i:EventTrigger EventName="Checked">
  141. <i:InvokeCommandAction Command="{Binding SetPageSizeTypeCommand}" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=RadioButton}}" PassEventArgsToCommand="True" />
  142. </i:EventTrigger>
  143. </i:Interaction.Triggers>
  144. </RadioButton>
  145. <RadioButton x:Name="Customized" Content="Customized" Tag="5">
  146. <i:Interaction.Triggers>
  147. <i:EventTrigger EventName="Checked">
  148. <i:InvokeCommandAction Command="{Binding SetPageSizeTypeCommand}" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=RadioButton}}" PassEventArgsToCommand="True" />
  149. </i:EventTrigger>
  150. </i:Interaction.Triggers>
  151. </RadioButton>
  152. <Grid IsEnabled="{Binding ElementName=Customized, Path=IsChecked}">
  153. <Grid.ColumnDefinitions>
  154. <ColumnDefinition Width="*"/>
  155. <ColumnDefinition Width="20"/>
  156. <ColumnDefinition Width="*"/>
  157. </Grid.ColumnDefinitions>
  158. <customcontrol:TextBoxEx PreviewKeyDown="TextBoxEx_PreviewKeyDown" x:Name="TextWidth" PlaceholderText="595" Text="{Binding InputWidth,Mode=TwoWay}" PreviewTextInput="TextBox_PreviewTextInput" LostFocus="TextBoxEx_LostFocus"/>
  159. <TextBlock Text="X" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center"/>
  160. <customcontrol:TextBoxEx PreviewKeyDown="TextBoxEx_PreviewKeyDown" x:Name="TextHeight" PlaceholderText="841" Grid.Column="2" Text="{Binding InputHeight,Mode=TwoWay}" PreviewTextInput="TextBox_PreviewTextInput" LostFocus="TextBoxEx_LostFocus"/>
  161. </Grid>
  162. </StackPanel>
  163. </Grid>
  164. </Border>
  165. <ComboBox Grid.Column="1" SelectedIndex="0" Grid.Row="5" Width="113" Height="32" HorizontalAlignment="Left" VerticalAlignment="Bottom" >
  166. <ComboBoxItem Tag="0">
  167. <TextBlock Text="Add Files" />
  168. <i:Interaction.Triggers>
  169. <i:EventTrigger EventName="PreviewMouseUp">
  170. <i:InvokeCommandAction
  171. Command="{Binding AddFilesCommand}"
  172. CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ComboBoxItem}},Path=Tag}"
  173. PassEventArgsToCommand="True" />
  174. </i:EventTrigger>
  175. </i:Interaction.Triggers>
  176. </ComboBoxItem>
  177. <ComboBoxItem Tag="1">
  178. <TextBlock Text="添加文件夹"/>
  179. <i:Interaction.Triggers>
  180. <i:EventTrigger EventName="PreviewMouseUp">
  181. <i:InvokeCommandAction
  182. Command="{Binding AddFilesCommand}"
  183. CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ComboBoxItem}},Path=Tag}"
  184. PassEventArgsToCommand="True" />
  185. </i:EventTrigger>
  186. </i:Interaction.Triggers>
  187. </ComboBoxItem>
  188. <ComboBoxItem Tag="2">
  189. <TextBlock Text="添加已打开文件"/>
  190. <i:Interaction.Triggers>
  191. <i:EventTrigger EventName="PreviewMouseUp">
  192. <i:InvokeCommandAction
  193. Command="{Binding AddFilesCommand}"
  194. CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ComboBoxItem}},Path=Tag}"
  195. PassEventArgsToCommand="True" />
  196. </i:EventTrigger>
  197. </i:Interaction.Triggers>
  198. </ComboBoxItem>
  199. </ComboBox>
  200. <Button Grid.Column="1" Grid.Row="5" Content="Clear" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="80" Height="32" Style="{StaticResource btn.sec}" Command="{Binding ClearCommand}"/>
  201. <StackPanel Grid.Column="2" Grid.RowSpan="2" Grid.Row="4" HorizontalAlignment="Center" VerticalAlignment="Bottom">
  202. <Button x:Name="BtnMerge" Content="Merge" Width="80" Height="32" Style="{StaticResource Btn.cta}" Command="{Binding MergeCommand}" IsEnabled="{Binding ElementName=NoFileStackPanel,Path=Visibility,Converter={StaticResource UnVisibleToBoolConvert}}"/>
  203. <Button Content="Cancel" Width="80" Height="32" Style="{StaticResource btn.sec}" Command="{Binding CancelCommand}"/>
  204. </StackPanel>
  205. </Grid>
  206. </UserControl>