MainWindow.xaml 25 KB

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