终端一体化运控平台
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 

571 wiersze
29 KiB

  1. <Window
  2. x:Class="BPASmartClient.CustomResource.Pages.View.MainView"
  3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="clr-namespace:BPASmartClient.CustomResource.Pages.View"
  7. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  8. xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel"
  9. Title="MainView"
  10. Width="1200"
  11. Height="700"
  12. AllowsTransparency="True"
  13. Background="{x:Null}"
  14. Topmost="False"
  15. WindowStartupLocation="CenterScreen"
  16. WindowStyle="None"
  17. mc:Ignorable="d">
  18. <Window.DataContext>
  19. <vm:MainViewModel />
  20. </Window.DataContext>
  21. <Window.Resources>
  22. <!--#region 静态资源-->
  23. <ImageBrush x:Key="leftImage" ImageSource="../../Image/leftImage.png" />
  24. <ImageBrush x:Key="leftImageSub" ImageSource="../../Image/leftImageSub.png" />
  25. <ImageBrush x:Key="topImage" ImageSource="../../Image/topImage.png" />
  26. <!--#endregion-->
  27. <!--#region 标题栏按钮样式-->
  28. <Style x:Key="TitleBarStyle" TargetType="Button">
  29. <Setter Property="Foreground" Value="White" />
  30. <Setter Property="FontSize" Value="24" />
  31. <Setter Property="FontFamily" Value="../../Fonts/#iconfont" />
  32. <Setter Property="Template">
  33. <Setter.Value>
  34. <ControlTemplate TargetType="Button">
  35. <Border Name="TitleBarBr" Background="Transparent">
  36. <ContentPresenter
  37. Margin="{TemplateBinding Margin}"
  38. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  39. VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
  40. </Border>
  41. <ControlTemplate.Triggers>
  42. <Trigger Property="IsMouseOver" Value="true">
  43. <Setter TargetName="TitleBarBr" Property="Background" Value="#22ffffff" />
  44. </Trigger>
  45. </ControlTemplate.Triggers>
  46. </ControlTemplate>
  47. </Setter.Value>
  48. </Setter>
  49. </Style>
  50. <!--#endregion-->
  51. <!--#region 导航栏样式-->
  52. <Style x:Key="NavButtonStyle" TargetType="{x:Type RadioButton}">
  53. <Setter Property="Foreground" Value="White" />
  54. <Setter Property="Template">
  55. <Setter.Value>
  56. <ControlTemplate TargetType="{x:Type RadioButton}">
  57. <Border
  58. x:Name="NvaBor"
  59. Background="Transparent"
  60. BorderBrush="#55ffffff"
  61. BorderThickness="0,0,0,1.5">
  62. <ContentControl
  63. Margin="10,4"
  64. HorizontalAlignment="Center"
  65. VerticalAlignment="Center"
  66. HorizontalContentAlignment="Center"
  67. VerticalContentAlignment="Center"
  68. Content="{TemplateBinding Content}"
  69. FontSize="16" />
  70. </Border>
  71. <ControlTemplate.Triggers>
  72. <Trigger Property="IsChecked" Value="True">
  73. <Setter TargetName="NvaBor" Property="Background" Value="#865eec" />
  74. <Setter TargetName="NvaBor" Property="BorderThickness" Value="0,0,1.5,1.5" />
  75. </Trigger>
  76. <MultiTrigger>
  77. <MultiTrigger.Conditions>
  78. <Condition Property="IsChecked" Value="false" />
  79. <Condition Property="IsMouseOver" Value="True" />
  80. </MultiTrigger.Conditions>
  81. <MultiTrigger.Setters>
  82. <Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" />
  83. </MultiTrigger.Setters>
  84. </MultiTrigger>
  85. </ControlTemplate.Triggers>
  86. </ControlTemplate>
  87. </Setter.Value>
  88. </Setter>
  89. </Style>
  90. <!--#endregion-->
  91. <!--#region 下拉列表单选按钮样式-->
  92. <Style x:Key="RadioMiniButtonStyle" TargetType="{x:Type RadioButton}">
  93. <Setter Property="Margin" Value="5,10,1,5" />
  94. <Setter Property="Width" Value="160" />
  95. <Setter Property="Height" Value="30" />
  96. <Setter Property="FontSize" Value="14" />
  97. <Setter Property="FontFamily" Value="粗体" />
  98. <Setter Property="Foreground" Value="#DDD" />
  99. <Setter Property="VerticalContentAlignment" Value="Center" />
  100. <Setter Property="HorizontalContentAlignment" Value="Center" />
  101. <Setter Property="BorderBrush" Value="Transparent" />
  102. <Setter Property="BorderThickness" Value="0" />
  103. <Setter Property="Background" Value="#DDD" />
  104. <Setter Property="HorizontalAlignment" Value="Right" />
  105. <Setter Property="Template">
  106. <Setter.Value>
  107. <ControlTemplate TargetType="{x:Type RadioButton}">
  108. <Grid
  109. x:Name="templateRoot"
  110. Background="Transparent"
  111. SnapsToDevicePixels="True">
  112. <Border x:Name="border2" />
  113. <ContentPresenter
  114. x:Name="contentPresenter"
  115. Margin="{TemplateBinding Padding}"
  116. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  117. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  118. Content="{TemplateBinding Content}"
  119. ContentStringFormat="{TemplateBinding ContentStringFormat}"
  120. ContentTemplate="{TemplateBinding ContentTemplate}"
  121. Focusable="False"
  122. RecognizesAccessKey="True"
  123. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  124. </Grid>
  125. <ControlTemplate.Triggers>
  126. <Trigger Property="HasContent" Value="True">
  127. <Setter Property="FocusVisualStyle">
  128. <Setter.Value>
  129. <Style>
  130. <Setter Property="Control.Template">
  131. <Setter.Value>
  132. <ControlTemplate>
  133. <Rectangle
  134. Margin="14,0,0,0"
  135. SnapsToDevicePixels="True"
  136. Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
  137. StrokeDashArray="1 2"
  138. StrokeThickness="1" />
  139. </ControlTemplate>
  140. </Setter.Value>
  141. </Setter>
  142. </Style>
  143. </Setter.Value>
  144. </Setter>
  145. <Setter Property="Padding" Value="4,-1,0,0" />
  146. </Trigger>
  147. <Trigger Property="IsChecked" Value="{x:Null}" />
  148. <Trigger Property="IsChecked" Value="true">
  149. <Setter Property="Foreground" Value="White" />
  150. <Setter TargetName="border2" Property="Background" Value="{StaticResource ResourceKey=leftImageSub}">
  151. <!--<Setter.Value>
  152. <ImageBrush ImageSource="./images/back.png" />
  153. </Setter.Value>-->
  154. </Setter>
  155. </Trigger>
  156. <Trigger Property="IsChecked" Value="false">
  157. <Setter TargetName="border2" Property="Background" Value="#101F3F" />
  158. <Setter Property="Foreground" Value="#4B8EC4" />
  159. </Trigger>
  160. <MultiTrigger>
  161. <MultiTrigger.Conditions>
  162. <Condition Property="IsChecked" Value="false" />
  163. <Condition Property="IsMouseOver" Value="True" />
  164. </MultiTrigger.Conditions>
  165. <MultiTrigger.Setters>
  166. <Setter TargetName="border2" Property="Background" Value="#55007acc" />
  167. </MultiTrigger.Setters>
  168. </MultiTrigger>
  169. </ControlTemplate.Triggers>
  170. </ControlTemplate>
  171. </Setter.Value>
  172. </Setter>
  173. </Style>
  174. <!--#endregion-->
  175. <!--#region 下拉列表样式-->
  176. <Style x:Key="ToggleButtonStyle" TargetType="{x:Type ToggleButton}">
  177. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  178. <Setter Property="Height" Value="80" />
  179. <Setter Property="HorizontalContentAlignment" Value="Right" />
  180. <Setter Property="VerticalContentAlignment" Value="Center" />
  181. <Setter Property="Padding" Value="10,10" />
  182. <Setter Property="Template">
  183. <Setter.Value>
  184. <ControlTemplate TargetType="{x:Type ToggleButton}">
  185. <Grid>
  186. <Border
  187. x:Name="border2"
  188. Margin="{TemplateBinding Padding}"
  189. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  190. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  191. Background="{TemplateBinding Background}">
  192. <ContentPresenter
  193. Margin="{TemplateBinding Padding}"
  194. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  195. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  196. RecognizesAccessKey="True"
  197. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  198. </Border>
  199. </Grid>
  200. <ControlTemplate.Triggers>
  201. <Trigger Property="IsPressed" Value="true">
  202. <Setter Property="Background" Value="#FFd2e7f4" />
  203. </Trigger>
  204. <Trigger Property="IsChecked" Value="true">
  205. <Setter TargetName="border2" Property="Background" Value="{StaticResource ResourceKey=leftImage}" />
  206. </Trigger>
  207. <Trigger Property="IsChecked" Value="false">
  208. <Setter TargetName="border2" Property="Background" Value="#191E36" />
  209. </Trigger>
  210. <Trigger Property="IsEnabled" Value="false">
  211. <Setter Property="Foreground" Value="White" />
  212. </Trigger>
  213. </ControlTemplate.Triggers>
  214. </ControlTemplate>
  215. </Setter.Value>
  216. </Setter>
  217. </Style>
  218. <Style x:Key="ExpanderStyle" TargetType="{x:Type Expander}">
  219. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
  220. <Setter Property="HorizontalContentAlignment" Value="Stretch" />
  221. <Setter Property="VerticalContentAlignment" Value="Stretch" />
  222. <Setter Property="BorderBrush" Value="Transparent" />
  223. <Setter Property="BorderThickness" Value="1" />
  224. <Setter Property="Template">
  225. <Setter.Value>
  226. <ControlTemplate TargetType="{x:Type Expander}">
  227. <DockPanel>
  228. <ToggleButton
  229. x:Name="HeaderSite"
  230. Height="60"
  231. MinWidth="0"
  232. MinHeight="0"
  233. Margin="1"
  234. Padding="{TemplateBinding Padding}"
  235. HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
  236. VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
  237. Content="{TemplateBinding Header}"
  238. ContentTemplate="{TemplateBinding HeaderTemplate}"
  239. ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
  240. DockPanel.Dock="Top"
  241. FontFamily="{TemplateBinding FontFamily}"
  242. FontSize="{TemplateBinding FontSize}"
  243. FontStretch="{TemplateBinding FontStretch}"
  244. FontStyle="{TemplateBinding FontStyle}"
  245. FontWeight="{TemplateBinding FontWeight}"
  246. Foreground="{TemplateBinding Foreground}"
  247. IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
  248. Style="{StaticResource ToggleButtonStyle}" />
  249. <ContentPresenter
  250. x:Name="ExpandSite"
  251. Margin="{TemplateBinding Padding}"
  252. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  253. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  254. DockPanel.Dock="Left"
  255. Focusable="false"
  256. Visibility="Collapsed" />
  257. </DockPanel>
  258. <ControlTemplate.Triggers>
  259. <Trigger Property="IsExpanded" Value="true">
  260. <Setter TargetName="ExpandSite" Property="Visibility" Value="Visible" />
  261. </Trigger>
  262. </ControlTemplate.Triggers>
  263. </ControlTemplate>
  264. </Setter.Value>
  265. </Setter>
  266. </Style>
  267. <!--#endregion-->
  268. <Style x:Key="checkBoxStyle" TargetType="CheckBox">
  269. <Setter Property="Foreground" Value="#a2c2e8" />
  270. <Setter Property="VerticalContentAlignment" Value="Center" />
  271. <Setter Property="FocusVisualStyle">
  272. <Setter.Value>
  273. <Style>
  274. <Setter Property="Control.Template">
  275. <Setter.Value>
  276. <ControlTemplate>
  277. <Rectangle
  278. Margin="1"
  279. SnapsToDevicePixels="True"
  280. Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
  281. StrokeDashArray="1 2"
  282. StrokeThickness="1" />
  283. </ControlTemplate>
  284. </Setter.Value>
  285. </Setter>
  286. </Style>
  287. </Setter.Value>
  288. </Setter>
  289. <Setter Property="Template">
  290. <Setter.Value>
  291. <ControlTemplate TargetType="{x:Type CheckBox}">
  292. <StackPanel
  293. Background="Transparent"
  294. Orientation="Horizontal"
  295. SnapsToDevicePixels="True">
  296. <Grid>
  297. <Image
  298. Width="12"
  299. Height="14"
  300. Source="/BPASmartClient.CustomResource;component/Image/Cb_HalfChecked.png" />
  301. <Image
  302. x:Name="image1"
  303. Width="12"
  304. Height="14"
  305. Source="/BPASmartClient.CustomResource;component/Image/Cb_HalfChecked.png" />
  306. </Grid>
  307. <ContentPresenter
  308. Margin="{TemplateBinding Padding}"
  309. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  310. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  311. Content="{TemplateBinding Content}"
  312. ContentStringFormat="{TemplateBinding ContentStringFormat}"
  313. RecognizesAccessKey="True"
  314. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  315. </StackPanel>
  316. <ControlTemplate.Triggers>
  317. <Trigger Property="HasContent" Value="True">
  318. <Setter Property="FocusVisualStyle">
  319. <Setter.Value>
  320. <Style>
  321. <Setter Property="Control.Template">
  322. <Setter.Value>
  323. <ControlTemplate>
  324. <Rectangle
  325. Margin="14,0,0,0"
  326. SnapsToDevicePixels="True"
  327. Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
  328. StrokeDashArray="1 2"
  329. StrokeThickness="1" />
  330. </ControlTemplate>
  331. </Setter.Value>
  332. </Setter>
  333. </Style>
  334. </Setter.Value>
  335. </Setter>
  336. <Setter Property="Padding" Value="4,0,0,0" />
  337. </Trigger>
  338. <Trigger Property="IsEnabled" Value="False">
  339. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  340. </Trigger>
  341. <Trigger Property="IsChecked" Value="true">
  342. <Setter TargetName="image1" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/Cb_Checked.png" />
  343. </Trigger>
  344. <Trigger Property="IsChecked" Value="{x:Null}">
  345. <Setter TargetName="image1" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/Cb_HalfChecked.png" />
  346. </Trigger>
  347. </ControlTemplate.Triggers>
  348. </ControlTemplate>
  349. </Setter.Value>
  350. </Setter>
  351. </Style>
  352. </Window.Resources>
  353. <Grid Background="#103153">
  354. <Grid.RowDefinitions>
  355. <RowDefinition Height="50" />
  356. <RowDefinition />
  357. </Grid.RowDefinitions>
  358. <!--#region 标题栏设置-->
  359. <Border
  360. x:Name="MoveBorder"
  361. Height="50"
  362. VerticalAlignment="Top"
  363. Background="#0C2349"
  364. BorderBrush="#55ffffff"
  365. BorderThickness="0,0,0,1">
  366. <StackPanel Orientation="Horizontal">
  367. <Image Margin="15,5,0,5" Source="../../Image/HBL.png" />
  368. <TextBlock
  369. Name="tbTitle"
  370. Margin="20,0"
  371. HorizontalAlignment="Left"
  372. VerticalAlignment="Center"
  373. FontSize="18"
  374. Foreground="White"
  375. Text="自动化产线上位机控制系统软件 V1.0" />
  376. </StackPanel>
  377. </Border>
  378. <UniformGrid
  379. Width="150"
  380. Height="50"
  381. HorizontalAlignment="Right"
  382. Columns="3">
  383. <Button
  384. Name="ButMin"
  385. Content="&#xe664;"
  386. IsEnabled="False"
  387. Style="{StaticResource TitleBarStyle}"
  388. Visibility="Hidden" />
  389. <Button
  390. Name="ButMax"
  391. Content="&#xe65d;"
  392. FontSize="22"
  393. IsEnabled="False"
  394. Style="{StaticResource TitleBarStyle}"
  395. Visibility="Hidden" />
  396. <Button
  397. Name="ButClose"
  398. Content="&#xe679;"
  399. Foreground="Red"
  400. Style="{StaticResource TitleBarStyle}" />
  401. </UniformGrid>
  402. <!--#endregion-->
  403. <!--#region 显示区设置-->
  404. <Grid Grid.Row="1">
  405. <Grid.ColumnDefinitions>
  406. <ColumnDefinition Width="200" />
  407. <ColumnDefinition />
  408. </Grid.ColumnDefinitions>
  409. <!-- 侧边栏菜单设置 -->
  410. <ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
  411. <Grid>
  412. <Border BorderBrush="#121F40" BorderThickness="1">
  413. <Border.Background>
  414. <ImageBrush ImageSource="../../Image/leftback.png" />
  415. </Border.Background>
  416. </Border>
  417. <ScrollViewer
  418. Name="scroll"
  419. Grid.Row="1"
  420. Margin="10"
  421. HorizontalScrollBarVisibility="Hidden"
  422. VerticalScrollBarVisibility="Hidden">
  423. <ItemsControl ItemsSource="{Binding menuModels}">
  424. <ItemsControl.ItemTemplate>
  425. <DataTemplate>
  426. <Grid Visibility="{Binding MainMenuVisibility}">
  427. <Expander x:Name="E1" Style="{DynamicResource ExpanderStyle}">
  428. <Expander.Header>
  429. <StackPanel
  430. Margin="10,0,0,10"
  431. HorizontalAlignment="Left"
  432. VerticalAlignment="Center"
  433. Orientation="Horizontal">
  434. <TextBlock
  435. VerticalAlignment="Center"
  436. FontFamily="../../Fonts/#iconfont"
  437. FontSize="25"
  438. Foreground="#ddd"
  439. Text="{Binding MainMenuIcon, Converter={StaticResource StringToIconConverter}}" />
  440. <StackPanel Margin="10,0,0,0" VerticalAlignment="Center">
  441. <TextBlock
  442. FontSize="16"
  443. Foreground="White"
  444. Text="{Binding MainMenuName}" />
  445. <TextBlock
  446. FontSize="13"
  447. Foreground="Gray"
  448. Text="{Binding Alias}" />
  449. </StackPanel>
  450. </StackPanel>
  451. </Expander.Header>
  452. <Expander.Content>
  453. <StackPanel>
  454. <ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
  455. <ItemsControl ItemsSource="{Binding subMenumodels}">
  456. <ItemsControl.ItemTemplate>
  457. <DataTemplate>
  458. <RadioButton
  459. Command="{Binding DataContext.NavChangedCommand, RelativeSource={RelativeSource AncestorType=Window, Mode=FindAncestor}}"
  460. CommandParameter="{Binding}"
  461. Content="{Binding SubMenuName}"
  462. GroupName="All"
  463. Style="{StaticResource RadioMiniButtonStyle}"
  464. Visibility="{Binding SubMenuVisibility}" />
  465. </DataTemplate>
  466. </ItemsControl.ItemTemplate>
  467. </ItemsControl>
  468. </ScrollViewer>
  469. </StackPanel>
  470. </Expander.Content>
  471. </Expander>
  472. </Grid>
  473. </DataTemplate>
  474. </ItemsControl.ItemTemplate>
  475. </ItemsControl>
  476. </ScrollViewer>
  477. </Grid>
  478. </ScrollViewer>
  479. <!--#endregion-->
  480. <!--#region 页面显示-->
  481. <Grid Grid.Column="1">
  482. <Grid.Background>
  483. <ImageBrush ImageSource="../../Image/WindowImages.png" />
  484. </Grid.Background>
  485. <Grid.RowDefinitions>
  486. <RowDefinition Height="0.1*" />
  487. <RowDefinition />
  488. </Grid.RowDefinitions>
  489. <StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
  490. <CheckBox
  491. Margin="5,0,5,0"
  492. Content="开机启动"
  493. IsChecked="{Binding AutoStart}"
  494. Style="{StaticResource checkBoxStyle}" />
  495. <!--<CheckBox
  496. Margin="5,0,5,0"
  497. Content="设备初始化"
  498. IsChecked="{Binding Status}"
  499. Style="{StaticResource checkBoxStyle}" />-->
  500. </StackPanel>
  501. <TextBlock
  502. Margin="0,0,0,20"
  503. HorizontalAlignment="Center"
  504. VerticalAlignment="Center"
  505. FontSize="20"
  506. Foreground="#1A8ADE"
  507. Text="{Binding DisplayName}" />
  508. <TextBlock
  509. Margin="10,10,0,5"
  510. HorizontalAlignment="left"
  511. VerticalAlignment="Center"
  512. FontSize="18"
  513. Foreground="#1A8ADE"
  514. Text="{Binding DateVisible}" />
  515. <TextBlock
  516. Margin="0,10,50,5"
  517. HorizontalAlignment="Right"
  518. VerticalAlignment="Center"
  519. FontSize="18"
  520. Foreground="#1A8ADE"
  521. Text="{Binding TimeVisible}" />
  522. <ContentControl
  523. Grid.Row="1"
  524. Width="auto"
  525. Height="auto"
  526. Content="{Binding MainContent}" />
  527. </Grid>
  528. <!--#endregion-->
  529. </Grid>
  530. <!--#endregion-->
  531. </Grid>
  532. </Window>