MainWindow.xaml 22 KB

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