MainWindow.xaml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. <Window
  2. x:Class="PDF_Master.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_Master.DataConvert"
  6. xmlns:cus="clr-namespace:PDF_Master.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_Master"
  11. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  12. xmlns:prism="http://prismlibrary.com/"
  13. xmlns:viewmodels="clr-namespace:PDF_Master.ViewModels"
  14. Width="1280"
  15. Height="800"
  16. MinWidth="540"
  17. MinHeight="460"
  18. PreviewMouseLeftButtonDown="Window_PreviewMouseLeftButtonDown"
  19. d:DataContext="{d:DesignInstance Type=viewmodels:MainWindowViewModel}"
  20. prism:ViewModelLocator.AutoWireViewModel="True"
  21. Activated="Window_Activated"
  22. BorderBrush="{StaticResource color.sys.layout.bg.tabbar}"
  23. BorderThickness="2"
  24. Closed="Window_Closed"
  25. Closing="Window_Closing"
  26. SizeChanged="Window_SizeChanged"
  27. Style="{StaticResource WindowStyle}"
  28. UseLayoutRounding="True"
  29. WindowStartupLocation="CenterScreen"
  30. mc:Ignorable="d">
  31. <Window.Resources>
  32. <ResourceDictionary>
  33. <Style x:Key="DragablzItemStyle" TargetType="{x:Type dragablz:DragablzItem}">
  34. <Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True" />
  35. <Setter Property="Foreground" Value="{StaticResource color.sys.text.neutral.lv2}" />
  36. <Setter Property="Template">
  37. <Setter.Value>
  38. <ControlTemplate TargetType="dragablz:DragablzItem">
  39. <Grid x:Name="templateRoot">
  40. <Grid.ColumnDefinitions>
  41. <ColumnDefinition Width="*" />
  42. <ColumnDefinition Width="auto" />
  43. </Grid.ColumnDefinitions>
  44. <Border
  45. x:Name="Title"
  46. Width="184"
  47. Height="34"
  48. Margin="4,6,0,2"
  49. BorderBrush="{StaticResource color.sys.border.neutral.lv3}"
  50. BorderThickness="0"
  51. CornerRadius="4,4,0,0"
  52. WindowChrome.IsHitTestVisibleInChrome="True">
  53. <Grid
  54. Name="GridRoot"
  55. Focusable="True"
  56. WindowChrome.IsHitTestVisibleInChrome="True">
  57. <Grid.ColumnDefinitions>
  58. <ColumnDefinition Width="auto" />
  59. <ColumnDefinition Width="*" MinWidth="10" />
  60. <ColumnDefinition Width="auto" />
  61. </Grid.ColumnDefinitions>
  62. <StackPanel Orientation="Horizontal">
  63. <Path
  64. Name="Ico_Home"
  65. Width="20"
  66. Height="20"
  67. Margin="8,7,0,7"
  68. 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"
  69. Fill="{TemplateBinding Foreground}"
  70. Visibility="Collapsed" />
  71. <TextBlock
  72. x:Name="TextTitle"
  73. MaxWidth="145"
  74. Margin="8,7"
  75. VerticalAlignment="Center"
  76. FontFamily="Segoe UI,Microsoft YaHei"
  77. Foreground="{TemplateBinding Foreground}"
  78. Text="{Binding DataContext.FileName}"
  79. TextTrimming="WordEllipsis" />
  80. </StackPanel>
  81. <Thumb
  82. x:Name="PART_Thumb"
  83. Grid.ColumnSpan="2"
  84. HorizontalAlignment="Stretch"
  85. VerticalContentAlignment="Stretch"
  86. Background="Transparent"
  87. FontFamily="Segoe UI,Microsoft YaHei"
  88. ToolTip="{Binding DataContext.FileName}">
  89. <Thumb.Template>
  90. <ControlTemplate>
  91. <Grid Background="Transparent" />
  92. </ControlTemplate>
  93. </Thumb.Template>
  94. </Thumb>
  95. <TextBlock
  96. x:Name="ChangeIcon"
  97. Grid.Column="1"
  98. Width="5"
  99. Margin="3,4,2,0"
  100. HorizontalAlignment="Left"
  101. VerticalAlignment="Top"
  102. Foreground="{TemplateBinding Foreground}"
  103. IsHitTestVisible="False"
  104. Text="*"
  105. Visibility="{Binding DataContext.FileChanged}" />
  106. <Button
  107. Grid.Column="2"
  108. Width="16"
  109. Height="16"
  110. Margin="0,4,8,4"
  111. Background="Transparent"
  112. BorderThickness="0"
  113. Command="{Binding DataContext.CloseTab}"
  114. CommandParameter="{Binding}">
  115. <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}" />
  116. </Button>
  117. <TextBox
  118. x:Name="TxtRename"
  119. MaxWidth="145"
  120. Margin="8,0,10,0"
  121. VerticalContentAlignment="Center"
  122. FontFamily="Segoe UI,Microsoft YaHei"
  123. Foreground="{TemplateBinding Foreground}"
  124. PreviewKeyDown="TxtRename_PreviewKeyDown"
  125. Text="{Binding DataContext.FileName, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"
  126. Visibility="{Binding DataContext.IsReNameTextShow}"
  127. WindowChrome.IsHitTestVisibleInChrome="True" />
  128. </Grid>
  129. </Border>
  130. <Grid.ContextMenu>
  131. <ContextMenu>
  132. <MenuItem
  133. Command="{Binding DataContext.RenameCommand}"
  134. Header="{Binding DataContext.T_Rename}"
  135. IsEnabled="{Binding DataContext.IsReNameEnable}" />
  136. <MenuItem
  137. Command="{Binding DataContext.ShowInFolderCommand}"
  138. Header="{Binding DataContext.T_Floder}"
  139. IsEnabled="{Binding DataContext.IsShowInFolderEnable}" />
  140. <MenuItem
  141. Command="{Binding DataContext.CloseTab}"
  142. CommandParameter="{Binding}"
  143. Header="{Binding DataContext.T_Close}" />
  144. <MenuItem
  145. Command="{Binding DataContext.mainWindowViewModel.CloseAllTabCommand}"
  146. Header="{Binding DataContext.T_CloseAll}"
  147. IsEnabled="{Binding DataContext.mainWindowViewModel.IsCloseAllEnable}" />
  148. <MenuItem Header="Open In New Window" Visibility="Collapsed" />
  149. </ContextMenu>
  150. </Grid.ContextMenu>
  151. </Grid>
  152. <ControlTemplate.Triggers>
  153. <Trigger Property="IsSelected" Value="True">
  154. <Setter TargetName="Title" Property="Background" Value="{StaticResource color.sys.layout.mg}" />
  155. <Setter Property="Foreground" Value="{StaticResource color.sys.text.neutral.lv1}" />
  156. <Setter TargetName="Title" Property="BorderThickness" Value="0,0,0,1" />
  157. </Trigger>
  158. <Trigger Property="IsSelected" Value="False">
  159. <Setter TargetName="Title" Property="Background" Value="TransParent" />
  160. </Trigger>
  161. <Trigger Property="IsMouseOver" Value="True">
  162. <Setter TargetName="Title" Property="Background" Value="{StaticResource color.item-state.hov.bg}" />
  163. </Trigger>
  164. <Trigger SourceName="TextTitle" Property="Text" Value="Home">
  165. <Setter TargetName="Ico_Home" Property="Visibility" Value="Visible" />
  166. </Trigger>
  167. <MultiDataTrigger>
  168. <MultiDataTrigger.Conditions>
  169. <Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="false" />
  170. <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true" />
  171. </MultiDataTrigger.Conditions>
  172. <Setter TargetName="Title" Property="Background" Value="#0D000000" />
  173. <Setter Property="Foreground" Value="{StaticResource color.sys.text.neutral.lv1}" />
  174. <!--<Setter TargetName="btnPath" Property="Path.Fill" Value="Black"/>-->
  175. </MultiDataTrigger>
  176. </ControlTemplate.Triggers>
  177. </ControlTemplate>
  178. </Setter.Value>
  179. </Setter>
  180. </Style>
  181. <convert:UnVisivleConvert x:Key="UnvisibleConvert" />
  182. </ResourceDictionary>
  183. </Window.Resources>
  184. <Grid Background="{StaticResource color.sys.layout.bg.tabbar}">
  185. <Grid.RowDefinitions>
  186. <RowDefinition Height="40" />
  187. <RowDefinition Height="*" />
  188. </Grid.RowDefinitions>
  189. <dragablz:TabablzControl
  190. Name="TabablzControl"
  191. Grid.RowSpan="3"
  192. BorderThickness="0"
  193. FocusVisualStyle="{x:Null}"
  194. ItemContainerStyle="{StaticResource DragablzItemStyle}"
  195. SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
  196. WindowChrome.IsHitTestVisibleInChrome="True">
  197. <dragablz:TabablzControl.InterTabController>
  198. <dragablz:InterTabController InterTabClient="{Binding InterTabClient}" />
  199. </dragablz:TabablzControl.InterTabController>
  200. <dragablz:TabablzControl.HeaderSuffixContent>
  201. <Button
  202. x:Name="BtnAdd"
  203. Width="20"
  204. Height="20"
  205. Margin="8,13,200,7"
  206. Padding="0"
  207. HorizontalAlignment="Left"
  208. Background="Transparent"
  209. BorderThickness="0"
  210. Command="{Binding AddTab}"
  211. WindowChrome.IsHitTestVisibleInChrome="True">
  212. <Path
  213. Width="20"
  214. Height="20"
  215. Data="M9 11V16H11V11H16V9H11V4H9V9H4L4 11H9Z"
  216. Fill="{StaticResource color.icon.base.neutral.norm.lv1}" />
  217. </Button>
  218. </dragablz:TabablzControl.HeaderSuffixContent>
  219. <dragablz:TabablzControl.HeaderPrefixContent>
  220. <Grid
  221. Name="GridRoot"
  222. Width="16"
  223. Height="38"
  224. Margin="0,0,0,0"
  225. Background="Transparent" />
  226. </dragablz:TabablzControl.HeaderPrefixContent>
  227. </dragablz:TabablzControl>
  228. <!-- 标题栏右侧栏,关闭按钮,会员,试用等 -->
  229. <StackPanel
  230. Name="StkPnlRight"
  231. HorizontalAlignment="Right"
  232. Orientation="Horizontal"
  233. WindowChrome.IsHitTestVisibleInChrome="True">
  234. <Grid x:Name="Grid_Openhight" Visibility="{Binding OphVis,Mode=OneWay}">
  235. <WrapPanel VerticalAlignment="Center">
  236. <Border VerticalAlignment="Center" Width="35" Height="28" Background=" #FFCF52" Margin="0,0,-4,0" CornerRadius="4" HorizontalAlignment="Left" />
  237. <Border VerticalAlignment="Center" >
  238. <Path Data="M0 4C0 1.79086 1.79086 0 4 0H132C134.209 0 136 1.79086 136 4V10.323C136 10.7319 136.249 11.0996 136.629 11.2514L141.179 13.0715C142.017 13.4068 142.017 14.5932 141.179 14.9285L136.629 16.7486C136.249 16.9004 136 17.2681 136 17.677V24C136 26.2091 134.209 28 132 28H4C1.79086 28 0 26.2091 0 24V4Z" Fill="#FFCF52" />
  239. </Border>
  240. </WrapPanel>
  241. <TextBlock
  242. FontFamily="PingFang SC"
  243. HorizontalAlignment="Center"
  244. VerticalAlignment="Center"
  245. FontSize="14"
  246. LineHeight="19.6"
  247. Text="{Binding Msgtologin}" />
  248. </Grid>
  249. <Button
  250. x:Name="Btn_Register"
  251. Width="40"
  252. Height="40"
  253. Background="Transparent"
  254. Command="{Binding OpenRegisterCommand}"
  255. Style="{StaticResource subToolBar}"
  256. Visibility="{Binding RegisterVis, Mode=TwoWay}">
  257. <Grid>
  258. <Border
  259. x:Name="myBorder1"
  260. Width="24"
  261. Height="24"
  262. Background="White"
  263. CornerRadius="12" />
  264. <Border
  265. Width="24"
  266. Height="24"
  267. Background="{StaticResource color.icon.base.neutral.norm.lv1}"
  268. BorderBrush="{StaticResource color.icon.base.neutral.norm.lv1}">
  269. <Path Data="M12 13C14.2091 13 16 11.2091 16 9C16 6.79086 14.2091 5 12 5C9.79086 5 8 6.79086 8 9C8 11.2091 9.79086 13 12 13ZM12 31C17.5228 31 22 27.4183 22 23C22 18.5817 17.5228 15 12 15C6.47715 15 2 18.5817 2 23C2 27.4183 6.47715 31 12 31Z" Fill="White" />
  270. <Border.OpacityMask>
  271. <VisualBrush Visual="{Binding ElementName=myBorder1}" />
  272. </Border.OpacityMask>
  273. </Border>
  274. <Border
  275. Width="24"
  276. Height="24"
  277. BorderBrush="{StaticResource color.icon.base.neutral.norm.lv1}"
  278. BorderThickness="2"
  279. CornerRadius="100" />
  280. </Grid>
  281. </Button>
  282. <Button
  283. x:Name="Btn_Login"
  284. Width="40"
  285. Height="40"
  286. Background="Transparent"
  287. Command="{Binding OpenLoginCommand}"
  288. Style="{StaticResource subToolBar}"
  289. Visibility="{Binding LoginVis, Mode=TwoWay}">
  290. <Grid>
  291. <Border
  292. x:Name="myBorder2"
  293. Width="24"
  294. Height="24"
  295. Background="White"
  296. CornerRadius="12" />
  297. <Border
  298. Width="24"
  299. Height="24"
  300. Background="{StaticResource color.icon.base.neutral.norm.lv1}"
  301. BorderBrush="{StaticResource color.icon.base.neutral.norm.lv1}">
  302. <Path Data="M12 13C14.2091 13 16 11.2091 16 9C16 6.79086 14.2091 5 12 5C9.79086 5 8 6.79086 8 9C8 11.2091 9.79086 13 12 13ZM12 31C17.5228 31 22 27.4183 22 23C22 18.5817 17.5228 15 12 15C6.47715 15 2 18.5817 2 23C2 27.4183 6.47715 31 12 31Z" Fill="White" />
  303. <Border.OpacityMask>
  304. <VisualBrush Visual="{Binding ElementName=myBorder2}" />
  305. </Border.OpacityMask>
  306. </Border>
  307. <Border
  308. Width="24"
  309. Height="24"
  310. BorderBrush="{StaticResource color.icon.base.neutral.norm.lv1}"
  311. BorderThickness="2"
  312. CornerRadius="100" />
  313. </Grid>
  314. </Button>
  315. <Button
  316. x:Name="Btn_User"
  317. Width="40"
  318. Height="40"
  319. Background="Transparent"
  320. Command="{Binding OpenUserCommand}"
  321. Style="{StaticResource subToolBar}"
  322. Visibility="{Binding UserVis, Mode=TwoWay}">
  323. <Grid>
  324. <Border
  325. x:Name="myBorder3"
  326. Width="24"
  327. Height="24"
  328. Background="White"
  329. CornerRadius="12" />
  330. <Border
  331. Width="24"
  332. Height="24"
  333. Background="#1770F4"
  334. BorderBrush="{StaticResource color.icon.base.neutral.norm.lv1}">
  335. <Path Data="M12 13C14.2091 13 16 11.2091 16 9C16 6.79086 14.2091 5 12 5C9.79086 5 8 6.79086 8 9C8 11.2091 9.79086 13 12 13ZM12 31C17.5228 31 22 27.4183 22 23C22 18.5817 17.5228 15 12 15C6.47715 15 2 18.5817 2 23C2 27.4183 6.47715 31 12 31Z" Fill="White" />
  336. <Border.OpacityMask>
  337. <VisualBrush Visual="{Binding ElementName=myBorder3}" />
  338. </Border.OpacityMask>
  339. </Border>
  340. <Border
  341. Width="24"
  342. Height="24"
  343. BorderBrush="#1770F4"
  344. BorderThickness="2"
  345. CornerRadius="100" />
  346. </Grid>
  347. </Button>
  348. <Separator BorderBrush="#94989C" BorderThickness="1">
  349. <Separator.LayoutTransform>
  350. <RotateTransform Angle="90" />
  351. </Separator.LayoutTransform>
  352. </Separator>
  353. <Button
  354. Name="BtnMiniSize"
  355. Width="40"
  356. Height="40"
  357. Background="Transparent"
  358. BorderThickness="0"
  359. Click="BtnMiniSize_Click"
  360. Style="{StaticResource TitleBarBtn}">
  361. <Polygon Fill="{StaticResource color.btn.sec.text.def}" Points="14 7 14 8 2 8 2 7">
  362. <Polygon.RenderTransform>
  363. <TransformGroup>
  364. <TranslateTransform Y="-3" />
  365. </TransformGroup>
  366. </Polygon.RenderTransform>
  367. </Polygon>
  368. </Button>
  369. <Button
  370. Name="BtnReStore"
  371. Width="40"
  372. Height="40"
  373. Background="Transparent"
  374. BorderThickness="0"
  375. Click="BtnReStore_Click"
  376. Style="{StaticResource TitleBarBtn}">
  377. <Grid>
  378. <Path
  379. x:Name="ico_max"
  380. Data="M14,2 L14,14 L2,14 L2,2 L14,2 Z M13,3 L3,3 L3,13 L13,13 L13,3 Z"
  381. Fill="{StaticResource color.btn.sec.text.def}"
  382. Visibility="Collapsed" />
  383. <Grid x:Name="ico_mini" Visibility="{Binding ElementName=ico_max, Path=Visibility, Converter={StaticResource UnvisibleConvert}}">
  384. <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}" />
  385. <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" />
  386. </Grid>
  387. </Grid>
  388. </Button>
  389. <Button
  390. Name="BtnClose"
  391. Width="40"
  392. Height="40"
  393. Background="Transparent"
  394. BorderThickness="0"
  395. Click="BtnClose_Click"
  396. Style="{StaticResource CloseBtn}">
  397. <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" />
  398. </Button>
  399. </StackPanel>
  400. <!-- OCR Progress Control -->
  401. <Grid Grid.RowSpan="2" Visibility="{Binding IsProcessVisible}">
  402. <Grid.Background>
  403. <SolidColorBrush Opacity="0.05" Color="Black" />
  404. </Grid.Background>
  405. <Border
  406. Width="226"
  407. Height="58"
  408. Background="{StaticResource color.sys.layout.dark.bg}"
  409. BorderThickness="0"
  410. CornerRadius="{StaticResource border-radius.8}"
  411. Effect="{StaticResource shadow.neutral.m}">
  412. <Grid Margin="16,13" Background="Transparent">
  413. <StackPanel Orientation="Horizontal">
  414. <TextBlock Foreground="{StaticResource color.sys.text.anti.norm}" Text="{Binding ProgressTitle}" />
  415. <TextBlock Foreground="{StaticResource color.sys.text.anti.norm}" Text="{Binding Value, StringFormat={}({0})}" />
  416. </StackPanel>
  417. <Button
  418. Width="12"
  419. Height="12"
  420. HorizontalAlignment="Right"
  421. VerticalAlignment="Top"
  422. BorderThickness="0"
  423. Background="{StaticResource color.sys.layout.dark.bg}"
  424. Command="{Binding CloseOCRCommand}"
  425. Padding="0,0,1,1">
  426. <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"></Path>
  427. </Button>
  428. <ProgressBar
  429. Height="4"
  430. Margin="0,0,0,4"
  431. VerticalAlignment="Bottom"
  432. BorderThickness="0"
  433. Foreground="{StaticResource color.slider.track-filled.norm}"
  434. Maximum="{Binding MaxValue}"
  435. Value="{Binding Value}" />
  436. </Grid>
  437. </Border>
  438. </Grid>
  439. </Grid>
  440. </Window>