MainWindow.xaml 20 KB

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