MainWindow.xaml 27 KB

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