DeviceDetailAlarmWindow.xaml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <Window x:Class="NEIntelligentControl2.Windows.Alarm.DeviceDetailAlarmWindow"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  5. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  6. xmlns:local="clr-namespace:NEIntelligentControl2.Windows.Alarm"
  7. mc:Ignorable="d"
  8. x:Name="window"
  9. Title="设备报警详情" Height="662" Width="1200" Background="#FFE3E3E3" WindowStyle="None" WindowStartupLocation="CenterOwner" Loaded="window_Loaded">
  10. <WindowChrome.WindowChrome>
  11. <WindowChrome/>
  12. </WindowChrome.WindowChrome>
  13. <Window.Resources>
  14. <ResourceDictionary>
  15. <ResourceDictionary.MergedDictionaries>
  16. <ResourceDictionary Source="/Res/Alarm.xaml"/>
  17. </ResourceDictionary.MergedDictionaries>
  18. <Style x:Key="GenerateButtonStyle" TargetType="{x:Type Button}">
  19. <Setter Property="Background" Value="#FFFE8864"/>
  20. <Setter Property="Foreground" Value="WhiteSmoke"/>
  21. <Setter Property="HorizontalContentAlignment" Value="Center"/>
  22. <Setter Property="VerticalContentAlignment" Value="Center"/>
  23. <Setter Property="Padding" Value="17,6"/>
  24. <Setter Property="FontSize" Value="14"/>
  25. <Setter Property="BorderThickness" Value="0"/>
  26. <Setter Property="Margin" Value="20,0"/>
  27. <Setter Property="Template">
  28. <Setter.Value>
  29. <ControlTemplate TargetType="{x:Type Button}">
  30. <Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true" CornerRadius="3">
  31. <ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  32. </Border>
  33. <ControlTemplate.Triggers>
  34. <Trigger Property="IsMouseOver" Value="true">
  35. <Setter Property="Background" TargetName="border" Value="#FFFE9777"/>
  36. </Trigger>
  37. <Trigger Property="IsPressed" Value="true">
  38. <Setter Property="Background" TargetName="border" Value="#FFFE8864"/>
  39. </Trigger>
  40. </ControlTemplate.Triggers>
  41. </ControlTemplate>
  42. </Setter.Value>
  43. </Setter>
  44. </Style>
  45. <Style x:Key="ConfirmButtonStyle" TargetType="{x:Type Button}">
  46. <Setter Property="Background" Value="#FF006ACC"/>
  47. <Setter Property="Foreground" Value="WhiteSmoke"/>
  48. <Setter Property="HorizontalContentAlignment" Value="Center"/>
  49. <Setter Property="VerticalContentAlignment" Value="Center"/>
  50. <Setter Property="Padding" Value="17,6"/>
  51. <Setter Property="FontSize" Value="14"/>
  52. <Setter Property="BorderThickness" Value="0"/>
  53. <Setter Property="Margin" Value="20,0"/>
  54. <Setter Property="Template">
  55. <Setter.Value>
  56. <ControlTemplate TargetType="{x:Type Button}">
  57. <Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true" CornerRadius="3">
  58. <ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  59. </Border>
  60. <ControlTemplate.Triggers>
  61. <Trigger Property="IsMouseOver" Value="true">
  62. <Setter Property="Background" TargetName="border" Value="#FF2E81CC"/>
  63. </Trigger>
  64. <Trigger Property="IsPressed" Value="true">
  65. <Setter Property="Background" TargetName="border" Value="#FF006ACC"/>
  66. </Trigger>
  67. </ControlTemplate.Triggers>
  68. </ControlTemplate>
  69. </Setter.Value>
  70. </Setter>
  71. </Style>
  72. <Style TargetType="{x:Type ScrollBar}">
  73. <Setter Property="Background" Value="#77F0F8FF"/>
  74. <Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
  75. <Setter Property="Stylus.IsFlicksEnabled" Value="false"/>
  76. <!--滚动条宽度-->
  77. <Setter Property="Width" Value="8"/>
  78. <Setter Property="MinWidth" Value="6"/>
  79. <Setter Property="Template">
  80. <Setter.Value>
  81. <ControlTemplate TargetType="{x:Type ScrollBar}">
  82. <!--滚动条背景色-->
  83. <Grid x:Name="Bg" Background="#77DDDDDD" SnapsToDevicePixels="true" Width="8">
  84. <Grid.RowDefinitions>
  85. <RowDefinition />
  86. </Grid.RowDefinitions>
  87. <Track x:Name="PART_Track" IsDirectionReversed="true" IsEnabled="{TemplateBinding IsMouseOver}">
  88. <Track.DecreaseRepeatButton>
  89. <RepeatButton Command="{x:Static ScrollBar.PageUpCommand}" Style="{StaticResource VerticalScrollBarPageButton}"/>
  90. </Track.DecreaseRepeatButton>
  91. <Track.IncreaseRepeatButton>
  92. <RepeatButton Command="{x:Static ScrollBar.PageDownCommand}" Style="{StaticResource VerticalScrollBarPageButton}"/>
  93. </Track.IncreaseRepeatButton>
  94. <Track.Thumb>
  95. <Thumb Style="{StaticResource ScrollBarThumb}"/>
  96. </Track.Thumb>
  97. </Track>
  98. </Grid>
  99. <ControlTemplate.Triggers>
  100. <Trigger Property="IsEnabled" Value="false">
  101. <Setter Property="Background" TargetName="Bg" Value="{StaticResource ScrollBarDisabledBackground}"/>
  102. </Trigger>
  103. </ControlTemplate.Triggers>
  104. </ControlTemplate>
  105. </Setter.Value>
  106. </Setter>
  107. <Style.Triggers>
  108. <Trigger Property="Orientation" Value="Horizontal">
  109. <Setter Property="Width" Value="Auto"/>
  110. <Setter Property="MinWidth" Value="0"/>
  111. <Setter Property="Height" Value="6"/>
  112. <Setter Property="MinHeight" Value="6"/>
  113. <Setter Property="Background" Value="#77F0F8FF"/>
  114. <Setter Property="Template">
  115. <Setter.Value>
  116. <ControlTemplate TargetType="{x:Type ScrollBar}">
  117. <Grid x:Name="Bg" Background="#77DDDDDD" SnapsToDevicePixels="true">
  118. <Grid.ColumnDefinitions>
  119. <ColumnDefinition />
  120. </Grid.ColumnDefinitions>
  121. <Track x:Name="PART_Track" IsEnabled="{TemplateBinding IsMouseOver}">
  122. <Track.DecreaseRepeatButton>
  123. <RepeatButton Command="{x:Static ScrollBar.PageLeftCommand}" Style="{StaticResource HorizontalScrollBarPageButton}"/>
  124. </Track.DecreaseRepeatButton>
  125. <Track.IncreaseRepeatButton>
  126. <RepeatButton Command="{x:Static ScrollBar.PageRightCommand}" Style="{StaticResource HorizontalScrollBarPageButton}"/>
  127. </Track.IncreaseRepeatButton>
  128. <Track.Thumb>
  129. <Thumb Style="{StaticResource ScrollBarThumb}" />
  130. </Track.Thumb>
  131. </Track>
  132. </Grid>
  133. <ControlTemplate.Triggers>
  134. <Trigger Property="IsEnabled" Value="false">
  135. <Setter Property="Background" TargetName="Bg" Value="{StaticResource ScrollBarDisabledBackground}"/>
  136. </Trigger>
  137. </ControlTemplate.Triggers>
  138. </ControlTemplate>
  139. </Setter.Value>
  140. </Setter>
  141. </Trigger>
  142. </Style.Triggers>
  143. </Style>
  144. </ResourceDictionary>
  145. </Window.Resources>
  146. <Grid Margin="5">
  147. <Grid.RowDefinitions>
  148. <RowDefinition Height="Auto"/>
  149. <RowDefinition/>
  150. <RowDefinition Height="Auto"/>
  151. </Grid.RowDefinitions>
  152. <Border Background="#FF3A4E66" CornerRadius="9,0,0,0">
  153. <Grid Margin="0,10">
  154. <StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
  155. <ContentControl Template="{StaticResource title_icon}" Width="24" Height="24" Margin="5,5,0,5"/>
  156. <TextBlock x:Name="_TBTitle" Text="设备报警详情" FontSize="16" Foreground="WhiteSmoke" Margin="5"/>
  157. </StackPanel>
  158. <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
  159. <ContentControl Width="24" Height="24" Margin="5" MouseLeftButtonUp="ContentControl_MouseLeftButtonUp" Tag="maximized" ToolTip="最大最小化" WindowChrome.IsHitTestVisibleInChrome="True">
  160. <ContentControl.Style>
  161. <Style TargetType="ContentControl">
  162. <Style.Triggers>
  163. <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Window, Mode=FindAncestor}, Path=WindowState}" Value="Maximized">
  164. <Setter Property="Template" Value="{StaticResource unmaximize}"/>
  165. </DataTrigger>
  166. <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Window, Mode=FindAncestor}, Path=WindowState}" Value="Normal">
  167. <Setter Property="Template" Value="{StaticResource maximize}"/>
  168. </DataTrigger>
  169. </Style.Triggers>
  170. </Style>
  171. </ContentControl.Style>
  172. </ContentControl>
  173. <ContentControl Width="24" Height="24" Template="{StaticResource close}" Background="WhiteSmoke" Margin="5" MouseLeftButtonUp="ContentControl_MouseLeftButtonUp" Tag="close" ToolTip="关闭" WindowChrome.IsHitTestVisibleInChrome="True"/>
  174. </StackPanel>
  175. </Grid>
  176. </Border>
  177. <DataGrid x:Name="_DGMain" Grid.Row="1" ColumnWidth="*" Background="#FFABABAB" AutoGenerateColumns="False" HorizontalGridLinesBrush="#FFA4A4A4" VerticalGridLinesBrush="#FFA4A4A4" SelectionUnit="Cell" CanUserAddRows="False" FontSize="14" SelectedCellsChanged="_DGMain_SelectedCellsChanged">
  178. <DataGrid.Columns>
  179. <DataGridCheckBoxColumn Binding="{Binding IsSelected}" Width="Auto"/>
  180. <DataGridTextColumn Header="时间" Binding="{Binding LastUpdateTimeString}" IsReadOnly="True"/>
  181. <DataGridTextColumn Header="报警信息" Binding="{Binding AlertText}" IsReadOnly="True" MinWidth="450"/>
  182. <DataGridTextColumn Header="级别" Binding="{Binding RankName}" IsReadOnly="True"/>
  183. <DataGridTextColumn Header="报警类型" IsReadOnly="True" Binding="{Binding CategoryName}"/>
  184. <!-- <DataGridTextColumn Header="停机类型" IsReadOnly="True" Binding="{Binding FaultCategory}"/>
  185. <DataGridTextColumn Header="故障类型" IsReadOnly="True" Binding="{Binding HaltType}"/>
  186. <DataGridTextColumn Header="故障原因" IsReadOnly="True" Binding="{Binding FaultCause}"/>-->
  187. </DataGrid.Columns>
  188. </DataGrid>
  189. <StackPanel Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="10" Orientation="Horizontal">
  190. <StackPanel.Style>
  191. <Style TargetType="StackPanel">
  192. <Style.Triggers>
  193. <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Window, Mode=FindAncestor}, Path=IsConfirm}" Value="True">
  194. <Setter Property="Visibility" Value="Visible"/>
  195. </DataTrigger>
  196. <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Window, Mode=FindAncestor}, Path=IsConfirm}" Value="False">
  197. <Setter Property="Visibility" Value="Collapsed"/>
  198. </DataTrigger>
  199. </Style.Triggers>
  200. </Style>
  201. </StackPanel.Style>
  202. <Button Content="生成缺陷单" Style="{DynamicResource GenerateButtonStyle}" Click="Button_Click" Tag="generate"/>
  203. <Button Content="确 认" Style="{DynamicResource ConfirmButtonStyle}" Click="Button_Click" Tag="ok"/>
  204. </StackPanel>
  205. </Grid>
  206. </Window>