MainWindow.xaml 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  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. d:DataContext="{d:DesignInstance Type=viewmodels:MainWindowViewModel}"
  19. prism:ViewModelLocator.AutoWireViewModel="True"
  20. Activated="Window_Activated"
  21. BorderBrush="{StaticResource color.sys.layout.bg.tabbar}"
  22. BorderThickness="2"
  23. Closed="Window_Closed"
  24. Closing="Window_Closing"
  25. PreviewMouseLeftButtonDown="Window_PreviewMouseLeftButtonDown"
  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="False" />
  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" Background="Transparent">
  40. <Grid.ColumnDefinitions>
  41. <ColumnDefinition Width="*" />
  42. <ColumnDefinition Width="auto" />
  43. </Grid.ColumnDefinitions>
  44. <Border
  45. x:Name="Title"
  46. Width="200"
  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="164"
  74. Margin="8,7,0,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="12"
  109. Height="12"
  110. Margin="0,0,8,0"
  111. Background="Transparent"
  112. BorderThickness="0"
  113. Command="{Binding DataContext.CloseTab}"
  114. CommandParameter="{Binding}"
  115. Style="{StaticResource btn.selector}">
  116. <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}" />
  117. </Button>
  118. <TextBox
  119. x:Name="TxtRename"
  120. MaxWidth="145"
  121. Margin="8,0,10,0"
  122. VerticalContentAlignment="Center"
  123. FontFamily="Segoe UI,Microsoft YaHei"
  124. Foreground="{TemplateBinding Foreground}"
  125. PreviewKeyDown="TxtRename_PreviewKeyDown"
  126. Text="{Binding DataContext.FileName, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"
  127. Visibility="{Binding DataContext.IsReNameTextShow}"
  128. WindowChrome.IsHitTestVisibleInChrome="True" />
  129. </Grid>
  130. </Border>
  131. <Grid.ContextMenu>
  132. <ContextMenu>
  133. <MenuItem
  134. Command="{Binding DataContext.RenameCommand}"
  135. Header="{Binding DataContext.T_Rename}"
  136. IsEnabled="{Binding DataContext.IsReNameEnable}" />
  137. <MenuItem
  138. Command="{Binding DataContext.ShowInFolderCommand}"
  139. Header="{Binding DataContext.T_Floder}"
  140. IsEnabled="{Binding DataContext.IsShowInFolderEnable}" />
  141. <MenuItem
  142. Command="{Binding DataContext.CloseTab}"
  143. CommandParameter="{Binding}"
  144. Header="{Binding DataContext.T_Close}" />
  145. <MenuItem
  146. Command="{Binding DataContext.mainWindowViewModel.CloseAllTabCommand}"
  147. Header="{Binding DataContext.T_CloseAll}"
  148. IsEnabled="{Binding DataContext.mainWindowViewModel.IsCloseAllEnable}" />
  149. <MenuItem Header="Open In New Window" Visibility="Collapsed" />
  150. </ContextMenu>
  151. </Grid.ContextMenu>
  152. </Grid>
  153. <ControlTemplate.Triggers>
  154. <Trigger Property="IsSelected" Value="True">
  155. <Setter TargetName="Title" Property="Background" Value="{StaticResource color.sys.layout.mg}" />
  156. <Setter Property="Foreground" Value="{StaticResource color.sys.text.neutral.lv1}" />
  157. <Setter TargetName="Title" Property="BorderThickness" Value="0,0,0,1" />
  158. </Trigger>
  159. <Trigger Property="IsSelected" Value="False">
  160. <Setter TargetName="Title" Property="Background" Value="TransParent" />
  161. </Trigger>
  162. <Trigger Property="IsMouseOver" Value="True">
  163. <Setter TargetName="Title" Property="Background" Value="{StaticResource color.item-state.hov.bg}" />
  164. </Trigger>
  165. <Trigger SourceName="TextTitle" Property="Text" Value="Home">
  166. <Setter TargetName="Ico_Home" Property="Visibility" Value="Visible" />
  167. </Trigger>
  168. <MultiDataTrigger>
  169. <MultiDataTrigger.Conditions>
  170. <Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="false" />
  171. <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true" />
  172. </MultiDataTrigger.Conditions>
  173. <Setter TargetName="Title" Property="Background" Value="#0D000000" />
  174. <Setter Property="Foreground" Value="{StaticResource color.sys.text.neutral.lv1}" />
  175. <!--<Setter TargetName="btnPath" Property="Path.Fill" Value="Black"/>-->
  176. </MultiDataTrigger>
  177. </ControlTemplate.Triggers>
  178. </ControlTemplate>
  179. </Setter.Value>
  180. </Setter>
  181. </Style>
  182. <convert:UnVisivleConvert x:Key="UnvisibleConvert" />
  183. </ResourceDictionary>
  184. </Window.Resources>
  185. <Grid Background="{StaticResource color.sys.layout.bg.tabbar}">
  186. <Grid.RowDefinitions>
  187. <RowDefinition Height="40" />
  188. <RowDefinition Height="*" />
  189. </Grid.RowDefinitions>
  190. <dragablz:TabablzControl
  191. Name="TabablzControl"
  192. Grid.RowSpan="3"
  193. BorderThickness="0"
  194. FocusVisualStyle="{x:Null}"
  195. ItemContainerStyle="{StaticResource DragablzItemStyle}"
  196. SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
  197. ScrollViewer.HorizontalScrollBarVisibility="Auto"
  198. WindowChrome.IsHitTestVisibleInChrome="True">
  199. <dragablz:TabablzControl.InterTabController>
  200. <dragablz:InterTabController InterTabClient="{Binding InterTabClient}" />
  201. </dragablz:TabablzControl.InterTabController>
  202. <dragablz:TabablzControl.HeaderSuffixContent>
  203. <Button
  204. x:Name="BtnAdd"
  205. Width="20"
  206. Height="20"
  207. Margin="8,13,200,7"
  208. Padding="0"
  209. HorizontalAlignment="Left"
  210. BorderThickness="0"
  211. Command="{Binding AddTab}"
  212. Style="{StaticResource btn.selector}"
  213. WindowChrome.IsHitTestVisibleInChrome="True">
  214. <Path
  215. Width="20"
  216. Height="20"
  217. Data="M9 11V16H11V11H16V9H11V4H9V9H4L4 11H9Z"
  218. Fill="{StaticResource color.icon.base.neutral.norm.lv1}" />
  219. </Button>
  220. </dragablz:TabablzControl.HeaderSuffixContent>
  221. <dragablz:TabablzControl.HeaderPrefixContent>
  222. <Grid
  223. Name="GridRoot"
  224. Width="16"
  225. Height="38"
  226. Margin="0,0,0,0"
  227. Background="Transparent"
  228. WindowChrome.IsHitTestVisibleInChrome="False" />
  229. </dragablz:TabablzControl.HeaderPrefixContent>
  230. </dragablz:TabablzControl>
  231. <!-- 标题栏右侧栏,关闭按钮,会员,试用等 -->
  232. <StackPanel
  233. Name="StkPnlRight"
  234. HorizontalAlignment="Right"
  235. Orientation="Horizontal"
  236. WindowChrome.IsHitTestVisibleInChrome="True">
  237. <Grid x:Name="Grid_Openhight" IsVisibleChanged="Grid_Openhight_IsVisibleChanged" Visibility="{Binding OphVis, Mode=OneWay}">
  238. <WrapPanel VerticalAlignment="Center">
  239. <Border
  240. Width="35"
  241. Height="28"
  242. Margin="0,0,-4,0"
  243. HorizontalAlignment="Left"
  244. VerticalAlignment="Center"
  245. Background=" #FFCF52"
  246. CornerRadius="4" />
  247. <Border VerticalAlignment="Center">
  248. <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" />
  249. </Border>
  250. </WrapPanel>
  251. <TextBlock
  252. HorizontalAlignment="Center"
  253. VerticalAlignment="Center"
  254. FontFamily="PingFang SC"
  255. FontSize="14"
  256. LineHeight="19.6"
  257. Text="{Binding Msgtologin}" />
  258. </Grid>
  259. <Button
  260. x:Name="Btn_Register"
  261. Width="40"
  262. Height="40"
  263. Background="Transparent"
  264. Command="{Binding OpenRegisterCommand}"
  265. Style="{StaticResource subToolBar}"
  266. Visibility="{Binding RegisterVis, Mode=TwoWay}">
  267. <Grid>
  268. <Border
  269. x:Name="myBorder1"
  270. Width="24"
  271. Height="24"
  272. Background="White"
  273. CornerRadius="12" />
  274. <Border
  275. Width="24"
  276. Height="24"
  277. Background="{StaticResource color.icon.base.neutral.norm.lv1}"
  278. BorderBrush="{StaticResource color.icon.base.neutral.norm.lv1}">
  279. <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" />
  280. <Border.OpacityMask>
  281. <VisualBrush Visual="{Binding ElementName=myBorder1}" />
  282. </Border.OpacityMask>
  283. </Border>
  284. <Border
  285. Width="24"
  286. Height="24"
  287. BorderBrush="{StaticResource color.icon.base.neutral.norm.lv1}"
  288. BorderThickness="2"
  289. CornerRadius="100" />
  290. </Grid>
  291. </Button>
  292. <Button
  293. x:Name="Btn_Login"
  294. Width="40"
  295. Height="40"
  296. Background="Transparent"
  297. Command="{Binding OpenLoginCommand}"
  298. Style="{StaticResource subToolBar}"
  299. Visibility="{Binding LoginVis, Mode=TwoWay}">
  300. <Grid>
  301. <Border
  302. x:Name="myBorder2"
  303. Width="24"
  304. Height="24"
  305. Background="White"
  306. CornerRadius="12" />
  307. <Border
  308. Width="24"
  309. Height="24"
  310. Background="{StaticResource color.icon.base.neutral.norm.lv1}"
  311. BorderBrush="{StaticResource color.icon.base.neutral.norm.lv1}">
  312. <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" />
  313. <Border.OpacityMask>
  314. <VisualBrush Visual="{Binding ElementName=myBorder2}" />
  315. </Border.OpacityMask>
  316. </Border>
  317. <Border
  318. Width="24"
  319. Height="24"
  320. BorderBrush="{StaticResource color.icon.base.neutral.norm.lv1}"
  321. BorderThickness="2"
  322. CornerRadius="100" />
  323. </Grid>
  324. </Button>
  325. <Button
  326. x:Name="Btn_User"
  327. Width="40"
  328. Height="40"
  329. Background="Transparent"
  330. Command="{Binding OpenUserCommand}"
  331. Style="{StaticResource subToolBar}"
  332. Visibility="{Binding UserVis, Mode=TwoWay}">
  333. <Grid>
  334. <Border
  335. x:Name="myBorder3"
  336. Width="24"
  337. Height="24"
  338. Background="White"
  339. CornerRadius="12" />
  340. <Border
  341. Width="24"
  342. Height="24"
  343. Background="#1770F4"
  344. BorderBrush="{StaticResource color.icon.base.neutral.norm.lv1}">
  345. <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" />
  346. <Border.OpacityMask>
  347. <VisualBrush Visual="{Binding ElementName=myBorder3}" />
  348. </Border.OpacityMask>
  349. </Border>
  350. <Border
  351. Width="24"
  352. Height="24"
  353. BorderBrush="#1770F4"
  354. BorderThickness="2"
  355. CornerRadius="100" />
  356. </Grid>
  357. </Button>
  358. <Separator BorderBrush="#94989C" BorderThickness="1">
  359. <Separator.LayoutTransform>
  360. <RotateTransform Angle="90" />
  361. </Separator.LayoutTransform>
  362. </Separator>
  363. <Button
  364. Name="BtnMiniSize"
  365. Width="40"
  366. Height="40"
  367. Background="Transparent"
  368. BorderThickness="0"
  369. Click="BtnMiniSize_Click"
  370. Style="{StaticResource TitleBarBtn}">
  371. <Polygon Fill="{StaticResource color.btn.sec.text.def}" Points="14 7 14 8 2 8 2 7">
  372. <Polygon.RenderTransform>
  373. <TransformGroup>
  374. <TranslateTransform Y="-3" />
  375. </TransformGroup>
  376. </Polygon.RenderTransform>
  377. </Polygon>
  378. </Button>
  379. <Button
  380. Name="BtnReStore"
  381. Width="40"
  382. Height="40"
  383. Background="Transparent"
  384. BorderThickness="0"
  385. Click="BtnReStore_Click"
  386. Style="{StaticResource TitleBarBtn}">
  387. <Grid>
  388. <Path
  389. x:Name="ico_max"
  390. Data="M14,2 L14,14 L2,14 L2,2 L14,2 Z M13,3 L3,3 L3,13 L13,13 L13,3 Z"
  391. Fill="{StaticResource color.btn.sec.text.def}"
  392. Visibility="Collapsed" />
  393. <Grid x:Name="ico_mini" Visibility="{Binding ElementName=ico_max, Path=Visibility, Converter={StaticResource UnvisibleConvert}}">
  394. <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}" />
  395. <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" />
  396. </Grid>
  397. </Grid>
  398. </Button>
  399. <Button
  400. Name="BtnClose"
  401. Width="40"
  402. Height="40"
  403. Background="Transparent"
  404. BorderThickness="0"
  405. Click="BtnClose_Click"
  406. Style="{StaticResource CloseBtn}">
  407. <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" />
  408. </Button>
  409. </StackPanel>
  410. <!-- OCR Progress Control -->
  411. <Grid Grid.RowSpan="2" Visibility="{Binding IsProcessVisible}">
  412. <Grid.Background>
  413. <SolidColorBrush Opacity="0.05" Color="Black" />
  414. </Grid.Background>
  415. <Border
  416. Width="226"
  417. Height="58"
  418. Background="{StaticResource color.sys.layout.dark.bg}"
  419. BorderThickness="0"
  420. CornerRadius="{StaticResource border-radius.8}"
  421. Effect="{StaticResource shadow.neutral.m}">
  422. <Grid Margin="16,13" Background="Transparent">
  423. <StackPanel Orientation="Horizontal">
  424. <TextBlock Foreground="{StaticResource color.sys.text.anti.norm}" Text="{Binding ProgressTitle}" />
  425. <TextBlock Foreground="{StaticResource color.sys.text.anti.norm}" Text="{Binding Value, StringFormat={}({0})}" />
  426. </StackPanel>
  427. <Button
  428. Width="12"
  429. Height="12"
  430. Padding="0,0,1,1"
  431. HorizontalAlignment="Right"
  432. VerticalAlignment="Top"
  433. Background="{StaticResource color.sys.layout.dark.bg}"
  434. BorderThickness="0"
  435. Command="{Binding CloseOCRCommand}">
  436. <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" />
  437. </Button>
  438. <ProgressBar
  439. Height="4"
  440. Margin="0,0,0,4"
  441. VerticalAlignment="Bottom"
  442. BorderThickness="0"
  443. Foreground="{StaticResource color.slider.track-filled.norm}"
  444. Maximum="{Binding MaxValue}"
  445. Value="{Binding Value}" />
  446. </Grid>
  447. </Border>
  448. </Grid>
  449. </Grid>
  450. </Window>