终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

569 lines
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. Topmost="False"
  13. AllowsTransparency="True"
  14. Background="{x:Null}"
  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="上位机监控系统" />
  376. </StackPanel>
  377. </Border>
  378. <UniformGrid
  379. Width="150"
  380. Height="50"
  381. HorizontalAlignment="Right"
  382. Columns="3">
  383. <Button
  384. Visibility="Hidden"
  385. IsEnabled="False"
  386. Name="ButMin"
  387. Content="&#xe664;"
  388. Style="{StaticResource TitleBarStyle}" />
  389. <Button
  390. Visibility="Hidden"
  391. IsEnabled="False"
  392. Name="ButMax"
  393. Content="&#xe65d;"
  394. FontSize="22"
  395. Style="{StaticResource TitleBarStyle}" />
  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. >
  424. <ItemsControl ItemsSource="{Binding menuModels}">
  425. <ItemsControl.ItemTemplate>
  426. <DataTemplate>
  427. <Grid Visibility="{Binding MainMenuVisibility}">
  428. <Expander x:Name="E1" Style="{DynamicResource ExpanderStyle}">
  429. <Expander.Header>
  430. <StackPanel
  431. Margin="10,0,0,10"
  432. HorizontalAlignment="Left"
  433. VerticalAlignment="Center"
  434. Orientation="Horizontal">
  435. <TextBlock
  436. VerticalAlignment="Center"
  437. FontFamily="../../Fonts/#iconfont"
  438. FontSize="25"
  439. Foreground="#ddd"
  440. Text="{Binding MainMenuIcon, Converter={StaticResource StringToIconConverter}}" />
  441. <StackPanel Margin="10,0,0,0" VerticalAlignment="Center">
  442. <TextBlock
  443. FontSize="16"
  444. Foreground="White"
  445. Text="{Binding MainMenuName}" />
  446. <TextBlock
  447. FontSize="13"
  448. Foreground="Gray"
  449. Text="{Binding Alias}" />
  450. </StackPanel>
  451. </StackPanel>
  452. </Expander.Header>
  453. <Expander.Content>
  454. <StackPanel>
  455. <ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
  456. <ItemsControl ItemsSource="{Binding subMenumodels}">
  457. <ItemsControl.ItemTemplate>
  458. <DataTemplate>
  459. <RadioButton
  460. Command="{Binding DataContext.NavChangedCommand, RelativeSource={RelativeSource AncestorType=Window, Mode=FindAncestor}}"
  461. CommandParameter="{Binding ToggleWindowPath}"
  462. Content="{Binding SubMenuName}"
  463. GroupName="All"
  464. Style="{StaticResource RadioMiniButtonStyle}"
  465. Visibility="{Binding SubMenuVisibility}" />
  466. </DataTemplate>
  467. </ItemsControl.ItemTemplate>
  468. </ItemsControl>
  469. </ScrollViewer>
  470. </StackPanel>
  471. </Expander.Content>
  472. </Expander>
  473. </Grid>
  474. </DataTemplate>
  475. </ItemsControl.ItemTemplate>
  476. </ItemsControl>
  477. </ScrollViewer>
  478. </Grid>
  479. </ScrollViewer>
  480. <!--#endregion-->
  481. <!--#region 页面显示-->
  482. <Grid Grid.Column="1">
  483. <Grid.Background>
  484. <ImageBrush ImageSource="../../Image/WindowImages.png" />
  485. </Grid.Background>
  486. <Grid.RowDefinitions>
  487. <RowDefinition Height="80" />
  488. <RowDefinition />
  489. </Grid.RowDefinitions>
  490. <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
  491. <CheckBox
  492. Style="{StaticResource checkBoxStyle}"
  493. Margin="5,0,5,0"
  494. Content="开机启动"
  495. IsChecked="{Binding AutoStart}" />
  496. <CheckBox
  497. Style="{StaticResource checkBoxStyle}"
  498. Margin="5,0,5,0"
  499. Content="设备初始化"
  500. IsChecked="{Binding Status}"
  501. />
  502. </StackPanel>
  503. <TextBlock
  504. Margin="0,0,0,20"
  505. HorizontalAlignment="Center"
  506. VerticalAlignment="Center"
  507. FontSize="20"
  508. Foreground="#1A8ADE"
  509. Text="{Binding DisplayName}" />
  510. <TextBlock
  511. Margin="10,10,0,5"
  512. HorizontalAlignment="left"
  513. VerticalAlignment="Center"
  514. FontSize="18"
  515. Foreground="#1A8ADE"
  516. Text="{Binding DateVisible}" />
  517. <TextBlock
  518. Margin="0,10,50,5"
  519. HorizontalAlignment="Right"
  520. VerticalAlignment="Center"
  521. FontSize="18"
  522. Foreground="#1A8ADE"
  523. Text="{Binding TimeVisible}" />
  524. <ContentControl Grid.Row="1" Width="auto" Height="auto" Content="{Binding MainContent}" />
  525. </Grid>
  526. <!--#endregion-->
  527. </Grid>
  528. <!--#endregion-->
  529. </Grid>
  530. </Window>