MainWindow.xaml 26 KB

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