MainWindow.xaml 25 KB

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