MainWindow.xaml 27 KB

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