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. Loaded="Window_Loaded"
  20. d:DataContext="{d:DesignInstance Type=viewmodels:MainWindowViewModel}"
  21. prism:ViewModelLocator.AutoWireViewModel="True"
  22. Activated="Window_Activated"
  23. BorderBrush="{StaticResource color.sys.layout.bg.tabbar}"
  24. BorderThickness="2"
  25. Closed="Window_Closed"
  26. Closing="Window_Closing"
  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. DockPanel.Dock="Left"
  245. x:Name="Grid_Openhight"
  246. IsVisibleChanged="Grid_Openhight_IsVisibleChanged"
  247. Visibility="Collapsed">
  248. <WrapPanel VerticalAlignment="Center">
  249. <Border
  250. Width="35"
  251. Height="28"
  252. Margin="0,0,-4,0"
  253. HorizontalAlignment="Left"
  254. VerticalAlignment="Center"
  255. Background=" #FFCF52"
  256. CornerRadius="4" />
  257. <Border VerticalAlignment="Center">
  258. <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" />
  259. </Border>
  260. </WrapPanel>
  261. <TextBlock
  262. HorizontalAlignment="Center"
  263. VerticalAlignment="Center"
  264. FontFamily="PingFang SC"
  265. FontSize="14"
  266. LineHeight="19.6"
  267. Text="{Binding Msgtologin}" />
  268. </Grid>
  269. <StackPanel
  270. Name="StkPnlRight"
  271. HorizontalAlignment="Right"
  272. Orientation="Horizontal"
  273. WindowChrome.IsHitTestVisibleInChrome="True">
  274. <Border Width="87" Height="24" Visibility="{Binding UpgradeVis}">
  275. <Border.InputBindings>
  276. <MouseBinding MouseAction="LeftClick" Command="{Binding UpgradelinkCommand}" />
  277. </Border.InputBindings>
  278. <Image Source="pack://application:,,,/PDF Master;component/Resources/Service/Upgrade.png" />
  279. </Border>
  280. <Button
  281. x:Name="Btn_Register"
  282. Width="40"
  283. Height="40"
  284. Background="Transparent"
  285. Command="{Binding OpenRegisterCommand}"
  286. Style="{StaticResource subToolBar}"
  287. Visibility="{Binding RegisterVis, Mode=TwoWay}">
  288. <Grid>
  289. <Border
  290. x:Name="myBorder1"
  291. Width="24"
  292. Height="24"
  293. Background="White"
  294. CornerRadius="12" />
  295. <Border
  296. Width="24"
  297. Height="24"
  298. Background="{StaticResource color.icon.base.neutral.norm.lv1}"
  299. BorderBrush="{StaticResource color.icon.base.neutral.norm.lv1}">
  300. <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" />
  301. <Border.OpacityMask>
  302. <VisualBrush Visual="{Binding ElementName=myBorder1}" />
  303. </Border.OpacityMask>
  304. </Border>
  305. <Border
  306. Width="24"
  307. Height="24"
  308. BorderBrush="{StaticResource color.icon.base.neutral.norm.lv1}"
  309. BorderThickness="2"
  310. CornerRadius="100" />
  311. </Grid>
  312. </Button>
  313. <Button
  314. x:Name="Btn_Login"
  315. Width="40"
  316. Height="40"
  317. Background="Transparent"
  318. Command="{Binding OpenLoginCommand}"
  319. Style="{StaticResource subToolBar}"
  320. Visibility="{Binding LoginVis, Mode=TwoWay}">
  321. <Grid>
  322. <Border
  323. x:Name="myBorder2"
  324. Width="24"
  325. Height="24"
  326. Background="White"
  327. CornerRadius="12" />
  328. <Border
  329. Width="24"
  330. Height="24"
  331. Background="{StaticResource color.icon.base.neutral.norm.lv1}"
  332. BorderBrush="{StaticResource color.icon.base.neutral.norm.lv1}">
  333. <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" />
  334. <Border.OpacityMask>
  335. <VisualBrush Visual="{Binding ElementName=myBorder2}" />
  336. </Border.OpacityMask>
  337. </Border>
  338. <Border
  339. Width="24"
  340. Height="24"
  341. BorderBrush="{StaticResource color.icon.base.neutral.norm.lv1}"
  342. BorderThickness="2"
  343. CornerRadius="100" />
  344. </Grid>
  345. </Button>
  346. <Button
  347. x:Name="Btn_User"
  348. Width="40"
  349. Height="40"
  350. Background="Transparent"
  351. Command="{Binding OpenUserCommand}"
  352. Style="{StaticResource subToolBar}"
  353. Visibility="{Binding UserVis, Mode=TwoWay}">
  354. <Grid>
  355. <Border
  356. Width="24"
  357. Height="24"
  358. Background="#1770F4"
  359. BorderBrush="#1770F4"
  360. CornerRadius="100">
  361. <TextBlock
  362. HorizontalAlignment="Center"
  363. VerticalAlignment="Center"
  364. FontFamily="SF Pro Text"
  365. FontSize="14"
  366. FontWeight="SemiBold"
  367. Foreground="White"
  368. Text="{Binding Useremailchar,Mode=TwoWay}" />
  369. </Border>
  370. </Grid>
  371. </Button>
  372. <Separator Background="{StaticResource color.sys.layout.divider}" Width="16" Height="1">
  373. <Separator.LayoutTransform>
  374. <RotateTransform Angle="90" />
  375. </Separator.LayoutTransform>
  376. </Separator>
  377. <Button
  378. Name="BtnMiniSize"
  379. Width="46"
  380. Height="40"
  381. Background="Transparent"
  382. BorderThickness="0"
  383. Click="BtnMiniSize_Click"
  384. Style="{StaticResource TitleBarBtn}">
  385. <Polygon Fill="{StaticResource color.btn.sec.text.def}" Points="14 7 14 8 2 8 2 7">
  386. <Polygon.RenderTransform>
  387. <TransformGroup>
  388. <TranslateTransform Y="-3" />
  389. </TransformGroup>
  390. </Polygon.RenderTransform>
  391. </Polygon>
  392. </Button>
  393. <Button
  394. Name="BtnReStore"
  395. Width="46"
  396. Height="40"
  397. Background="Transparent"
  398. BorderThickness="0"
  399. Click="BtnReStore_Click"
  400. Style="{StaticResource TitleBarBtn}">
  401. <Grid>
  402. <Path
  403. x:Name="ico_max"
  404. Data="M14,2 L14,14 L2,14 L2,2 L14,2 Z M13,3 L3,3 L3,13 L13,13 L13,3 Z"
  405. Fill="{StaticResource color.btn.sec.text.def}"
  406. Visibility="Collapsed" />
  407. <Grid x:Name="ico_mini" Visibility="{Binding ElementName=ico_max, Path=Visibility, Converter={StaticResource UnvisibleConvert}}">
  408. <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}" />
  409. <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" />
  410. </Grid>
  411. </Grid>
  412. </Button>
  413. <Button
  414. Name="BtnClose"
  415. Width="46"
  416. Height="40"
  417. Background="Transparent"
  418. BorderThickness="0"
  419. Click="BtnClose_Click"
  420. Style="{StaticResource CloseBtn}">
  421. <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" />
  422. </Button>
  423. </StackPanel>
  424. </DockPanel>
  425. <!-- OCR Progress Control -->
  426. <Grid Grid.RowSpan="2" Visibility="{Binding IsProcessVisible}">
  427. <Grid.Background>
  428. <SolidColorBrush Opacity="0.05" Color="Black" />
  429. </Grid.Background>
  430. <Border
  431. Width="226"
  432. Height="58"
  433. Background="{StaticResource color.sys.layout.dark.bg}"
  434. BorderThickness="0"
  435. CornerRadius="{StaticResource border-radius.8}"
  436. Effect="{StaticResource shadow.neutral.m}">
  437. <Grid Margin="16,13" Background="Transparent">
  438. <StackPanel Orientation="Horizontal">
  439. <TextBlock Foreground="{StaticResource color.sys.text.anti.norm}" Text="{Binding ProgressTitle}" />
  440. <TextBlock
  441. Foreground="{StaticResource color.sys.text.anti.norm}"
  442. Text="{Binding Value, StringFormat={}({0})}"
  443. Visibility="Collapsed" />
  444. </StackPanel>
  445. <Button
  446. Width="12"
  447. Height="12"
  448. Padding="0,0,1,1"
  449. HorizontalAlignment="Right"
  450. VerticalAlignment="Top"
  451. Background="{StaticResource color.sys.layout.dark.bg}"
  452. BorderThickness="0"
  453. Command="{Binding CloseOCRCommand}"
  454. Visibility="{Binding ProcessCloseBtnVisible}">
  455. <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" />
  456. </Button>
  457. <ProgressBar
  458. Height="4"
  459. Margin="0,0,0,4"
  460. VerticalAlignment="Bottom"
  461. BorderThickness="0"
  462. Foreground="{StaticResource color.slider.track-filled.norm}"
  463. Maximum="{Binding MaxValue}"
  464. Value="{Binding Value}" />
  465. </Grid>
  466. </Border>
  467. </Grid>
  468. </Grid>
  469. </Window>