MainWindow.xaml 26 KB

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