MainWindow.xaml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. <Window
  2. x:Class="PDF_Office.Views.MainWindow"
  3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:convert="clr-namespace:PDF_Office.DataConvert"
  6. xmlns:cus="clr-namespace:PDF_Office.CustomControl"
  7. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  8. xmlns:dragablz="http://dragablz.net/winfx/xaml/dragablz"
  9. xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
  10. xmlns:local="clr-namespace:PDF_Office"
  11. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  12. xmlns:prism="http://prismlibrary.com/"
  13. xmlns:viewmodels="clr-namespace:PDF_Office.ViewModels"
  14. Width="1280"
  15. Height="800"
  16. MinWidth="540"
  17. MinHeight="460"
  18. d:DataContext="{d:DesignInstance Type=viewmodels:MainWindowViewModel}"
  19. prism:ViewModelLocator.AutoWireViewModel="True"
  20. Activated="Window_Activated"
  21. Closed="Window_Closed"
  22. SizeChanged="Window_SizeChanged"
  23. Style="{StaticResource WindowStyle}"
  24. UseLayoutRounding="True"
  25. WindowStartupLocation="CenterScreen"
  26. mc:Ignorable="d">
  27. <Window.Resources>
  28. <ResourceDictionary>
  29. <Style x:Key="DragablzItemStyle" TargetType="{x:Type dragablz:DragablzItem}">
  30. <Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True" />
  31. <Setter Property="Foreground" Value="{StaticResource color.sys.text.neutral.lv2}" />
  32. <Setter Property="Template">
  33. <Setter.Value>
  34. <ControlTemplate TargetType="dragablz:DragablzItem">
  35. <Grid x:Name="templateRoot">
  36. <Grid.ColumnDefinitions>
  37. <ColumnDefinition Width="*" />
  38. <ColumnDefinition Width="auto" />
  39. </Grid.ColumnDefinitions>
  40. <Border
  41. x:Name="Title"
  42. Width="184"
  43. Height="34"
  44. Margin="4,6,0,2"
  45. BorderBrush="{StaticResource color.sys.border.neutral.lv3}"
  46. BorderThickness="0"
  47. CornerRadius="4,4,0,0"
  48. WindowChrome.IsHitTestVisibleInChrome="True">
  49. <Grid
  50. Name="GridRoot"
  51. Focusable="True"
  52. WindowChrome.IsHitTestVisibleInChrome="True">
  53. <Grid.ColumnDefinitions>
  54. <ColumnDefinition Width="auto" />
  55. <ColumnDefinition Width="*" MinWidth="10" />
  56. <ColumnDefinition Width="auto" />
  57. </Grid.ColumnDefinitions>
  58. <StackPanel Orientation="Horizontal">
  59. <Path
  60. Name="Ico_Home"
  61. Width="20"
  62. Height="20"
  63. Margin="8,7,0,7"
  64. Data="M3.8655 5.79659C3.32363 6.16983 3 6.78571 3 7.44369V15.0001C3 16.1046 3.89543 17.0001 5 17.0001H9V12.1786H11V17.0001H15C16.1046 17.0001 17 16.1046 17 15.0001V7.44369C17 6.78571 16.6764 6.16983 16.1345 5.79659L11.1345 2.35266C10.4514 1.88212 9.54865 1.88212 8.8655 2.35266L3.8655 5.79659Z"
  65. Fill="{TemplateBinding Foreground}"
  66. Visibility="Collapsed" />
  67. <TextBlock
  68. x:Name="TextTitle"
  69. MaxWidth="145"
  70. Margin="8,7"
  71. VerticalAlignment="Center"
  72. FontFamily="Segoe UI,Microsoft YaHei"
  73. Foreground="{TemplateBinding Foreground}"
  74. Text="{Binding DataContext.FileName}"
  75. TextTrimming="WordEllipsis" />
  76. </StackPanel>
  77. <Thumb
  78. x:Name="PART_Thumb"
  79. Grid.ColumnSpan="2"
  80. HorizontalAlignment="Stretch"
  81. VerticalContentAlignment="Stretch"
  82. Background="Transparent"
  83. FontFamily="Segoe UI,Microsoft YaHei"
  84. ToolTip="{Binding DataContext.FileName}">
  85. <Thumb.Template>
  86. <ControlTemplate>
  87. <Grid Background="Transparent" />
  88. </ControlTemplate>
  89. </Thumb.Template>
  90. </Thumb>
  91. <TextBlock
  92. x:Name="ChangeIcon"
  93. Grid.Column="1"
  94. Width="5"
  95. Margin="3,4,2,0"
  96. HorizontalAlignment="Left"
  97. VerticalAlignment="Top"
  98. Foreground="{TemplateBinding Foreground}"
  99. IsHitTestVisible="False"
  100. Text="*"
  101. Visibility="{Binding DataContext.FileChanged}" />
  102. <Button
  103. Grid.Column="2"
  104. Width="16"
  105. Height="16"
  106. Margin="0,4,8,4"
  107. Background="Transparent"
  108. BorderThickness="0"
  109. Command="{Binding DataContext.CloseTab}"
  110. CommandParameter="{Binding}">
  111. <Path Data="M6.50006 7.06072L9.96973 10.5304L11.0304 9.46973L7.56072 6.00006L11.0304 2.53039L9.96973 1.46973L6.50006 4.9394L3.03039 1.46973L1.96973 2.53039L5.4394 6.00006L1.96973 9.46973L3.03039 10.5304L6.50006 7.06072Z" Fill="{StaticResource color.icon.base.neutral.norm.lv2}" />
  112. </Button>
  113. <TextBox
  114. x:Name="TxtRename"
  115. MaxWidth="145"
  116. Margin="8,0,10,0"
  117. VerticalContentAlignment="Center"
  118. FontFamily="Segoe UI,Microsoft YaHei"
  119. Foreground="{TemplateBinding Foreground}"
  120. PreviewKeyDown="TxtRename_PreviewKeyDown"
  121. Text="{Binding DataContext.FileName, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"
  122. Visibility="{Binding DataContext.IsReNameTextShow}"
  123. WindowChrome.IsHitTestVisibleInChrome="True" />
  124. </Grid>
  125. </Border>
  126. <Grid.ContextMenu>
  127. <ContextMenu>
  128. <MenuItem
  129. Command="{Binding DataContext.RenameCommand}"
  130. Header="Rename"
  131. IsEnabled="{Binding DataContext.IsReNameEnable}" />
  132. <MenuItem
  133. Command="{Binding DataContext.ShowInFolderCommand}"
  134. Header="Show In Folder"
  135. IsEnabled="{Binding DataContext.IsShowInFolderEnable}" />
  136. <MenuItem
  137. Command="{Binding DataContext.CloseTab}"
  138. CommandParameter="{Binding}"
  139. Header="Close Tab" />
  140. <MenuItem Header="Close All Tab" />
  141. <MenuItem Header="Open In New Window" Visibility="Collapsed" />
  142. </ContextMenu>
  143. </Grid.ContextMenu>
  144. </Grid>
  145. <ControlTemplate.Triggers>
  146. <Trigger Property="IsSelected" Value="True">
  147. <Setter TargetName="Title" Property="Background" Value="{StaticResource color.sys.layout.mg}" />
  148. <Setter Property="Foreground" Value="{StaticResource color.sys.text.neutral.lv1}" />
  149. <Setter TargetName="Title" Property="BorderThickness" Value="0,0,0,1" />
  150. </Trigger>
  151. <Trigger Property="IsSelected" Value="False">
  152. <Setter TargetName="Title" Property="Background" Value="TransParent" />
  153. </Trigger>
  154. <Trigger Property="IsMouseOver" Value="True">
  155. <Setter TargetName="Title" Property="Background" Value="{StaticResource color.item-state.hov.bg}" />
  156. </Trigger>
  157. <Trigger SourceName="TextTitle" Property="Text" Value="Home">
  158. <Setter TargetName="Ico_Home" Property="Visibility" Value="Visible" />
  159. </Trigger>
  160. <MultiDataTrigger>
  161. <MultiDataTrigger.Conditions>
  162. <Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="false" />
  163. <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true" />
  164. </MultiDataTrigger.Conditions>
  165. <Setter TargetName="Title" Property="Background" Value="#0D000000" />
  166. <Setter Property="Foreground" Value="{StaticResource color.sys.text.neutral.lv1}" />
  167. <!--<Setter TargetName="btnPath" Property="Path.Fill" Value="Black"/>-->
  168. </MultiDataTrigger>
  169. </ControlTemplate.Triggers>
  170. </ControlTemplate>
  171. </Setter.Value>
  172. </Setter>
  173. </Style>
  174. <convert:UnVisivleConvert x:Key="UnvisibleConvert" />
  175. </ResourceDictionary>
  176. </Window.Resources>
  177. <Border>
  178. <Grid Background="{StaticResource color.sys.layout.bg.tabbar}">
  179. <Grid.RowDefinitions>
  180. <RowDefinition Height="40" />
  181. <RowDefinition Height="*" />
  182. </Grid.RowDefinitions>
  183. <dragablz:TabablzControl
  184. Name="TabablzControl"
  185. Grid.RowSpan="3"
  186. BorderThickness="0"
  187. FocusVisualStyle="{x:Null}"
  188. ItemContainerStyle="{StaticResource DragablzItemStyle}"
  189. SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
  190. WindowChrome.IsHitTestVisibleInChrome="True">
  191. <dragablz:TabablzControl.InterTabController>
  192. <dragablz:InterTabController InterTabClient="{Binding InterTabClient}" />
  193. </dragablz:TabablzControl.InterTabController>
  194. <dragablz:TabablzControl.HeaderSuffixContent>
  195. <Button
  196. x:Name="BtnAdd"
  197. Width="20"
  198. Height="20"
  199. Margin="8,13,200,7"
  200. Padding="0"
  201. HorizontalAlignment="Left"
  202. Background="Transparent"
  203. BorderThickness="0"
  204. Command="{Binding AddTab}"
  205. WindowChrome.IsHitTestVisibleInChrome="True">
  206. <Path
  207. Width="20"
  208. Height="20"
  209. Data="M9 11V16H11V11H16V9H11V4H9V9H4L4 11H9Z"
  210. Fill="{StaticResource color.icon.base.neutral.norm.lv1}" />
  211. </Button>
  212. </dragablz:TabablzControl.HeaderSuffixContent>
  213. <dragablz:TabablzControl.HeaderPrefixContent>
  214. <Grid
  215. Width="16"
  216. Height="38"
  217. Margin="0,0,0,0"
  218. Background="Transparent" />
  219. </dragablz:TabablzControl.HeaderPrefixContent>
  220. </dragablz:TabablzControl>
  221. <!-- 标题栏右侧栏,关闭按钮,会员,试用等 -->
  222. <StackPanel
  223. Name="StkPnlRight"
  224. HorizontalAlignment="Right"
  225. Orientation="Horizontal"
  226. WindowChrome.IsHitTestVisibleInChrome="True">
  227. <Button
  228. Name="BtnMiniSize"
  229. Width="40"
  230. Height="40"
  231. Background="Transparent"
  232. BorderThickness="0"
  233. Click="BtnMiniSize_Click"
  234. Style="{StaticResource TitleBarBtn}">
  235. <Polygon Fill="{StaticResource color.btn.sec.text.def}" Points="14 7 14 8 2 8 2 7">
  236. <Polygon.RenderTransform>
  237. <TransformGroup>
  238. <TranslateTransform Y="-3" />
  239. </TransformGroup>
  240. </Polygon.RenderTransform>
  241. </Polygon>
  242. </Button>
  243. <Button
  244. Name="BtnReStore"
  245. Width="40"
  246. Height="40"
  247. Background="Transparent"
  248. BorderThickness="0"
  249. Click="BtnReStore_Click"
  250. Style="{StaticResource TitleBarBtn}">
  251. <Grid>
  252. <Path
  253. x:Name="ico_max"
  254. Data="M14,2 L14,14 L2,14 L2,2 L14,2 Z M13,3 L3,3 L3,13 L13,13 L13,3 Z"
  255. Fill="{StaticResource color.btn.sec.text.def}"
  256. Visibility="Collapsed" />
  257. <Grid x:Name="ico_mini" Visibility="{Binding ElementName=ico_max, Path=Visibility, Converter={StaticResource UnvisibleConvert}}">
  258. <Path Data="M11,5 L11,14 L2,14 L2,5 L11,5 Z M10,6 L3,6 L3,13 L10,13 L10,6 Z" Fill="{StaticResource color.btn.sec.text.def}" />
  259. <Polygon Fill="{StaticResource color.btn.sec.text.def}" Points="14 2 14 11 11 11 11 10 13 10 13 3 6 3 6 5 5 5 5 2" />
  260. </Grid>
  261. </Grid>
  262. </Button>
  263. <Button
  264. Name="BtnClose"
  265. Width="40"
  266. Height="40"
  267. Background="Transparent"
  268. BorderThickness="0"
  269. Click="BtnClose_Click"
  270. Style="{StaticResource CloseBtn}">
  271. <Polygon Fill="{StaticResource color.btn.sec.text.def}" Points="11.2919922 12 12 11.2919922 6.70800781 6 12 0.708007813 11.2919922 0 6 5.29199219 0.708007812 9.76996262e-15 -2.27456942e-13 0.708007813 5.29199219 6 0 11.2919922 0.708007812 12 6 6.70800781" />
  272. </Button>
  273. </StackPanel>
  274. <!-- OCR Progress Control -->
  275. <Grid Grid.RowSpan="2" Visibility="{Binding IsProcessVisible}">
  276. <Grid.Background>
  277. <SolidColorBrush Opacity="0.05" Color="Black" />
  278. </Grid.Background>
  279. <Border
  280. Width="226"
  281. Height="58"
  282. Background="{StaticResource color.sys.layout.dark.bg}"
  283. BorderThickness="0"
  284. CornerRadius="{StaticResource border-radius.8}"
  285. Effect="{StaticResource shadow.neutral.m}">
  286. <Grid Margin="16,13" Background="Transparent">
  287. <StackPanel Orientation="Horizontal">
  288. <TextBlock Foreground="{StaticResource color.sys.text.anti.norm}" Text="Text" />
  289. <TextBlock Foreground="{StaticResource color.sys.text.anti.norm}" Text="{Binding Value, StringFormat={}({0})}" />
  290. </StackPanel>
  291. <Button
  292. Width="12"
  293. Height="12"
  294. HorizontalAlignment="Right"
  295. VerticalAlignment="Top"
  296. Command="{Binding CloseOCRCommand}" />
  297. <ProgressBar
  298. Height="4"
  299. Margin="0,0,0,4"
  300. VerticalAlignment="Bottom"
  301. BorderThickness="0"
  302. Foreground="{StaticResource color.slider.track-filled.norm}"
  303. Maximum="{Binding MaxValue}"
  304. Value="{Binding Value}" />
  305. </Grid>
  306. </Border>
  307. </Grid>
  308. </Grid>
  309. </Border>
  310. </Window>