MergeDialog.xaml 15 KB

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