RealTimeFalutInfoView.xaml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <UserControl x:Class="NEIntelligentControl2.Views.Alarm.RealTimeFalutInfoView"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="clr-namespace:NEIntelligentControl2.Views.Alarm"
  7. mc:Ignorable="d"
  8. d:DesignHeight="800" d:DesignWidth="595" Width="595" Height="800" Background="#FFE3E3E3">
  9. <UserControl.Resources>
  10. <ControlTemplate x:Key="unfixed">
  11. <Viewbox>
  12. <Canvas Width="1024" Height="1024" Background="#01FFFFFF">
  13. <Path Fill="#CC464646" Data="M187.690667 874.709333h-0.277334a37.504 37.504 0 0 1-26.602666-11.264 37.845333 37.845333 0 0 1-3.904-49.877333l166.762666-229.76-125.013333-125.056a38.229333 38.229333 0 0 1-6.058667-46.336 140.8 140.8 0 0 1 53.504-45.674667 154.24 154.24 0 0 1 67.84-15.552 161.792 161.792 0 0 1 51.84 8.533334l6.4 0.661333c5.781333 0.405333 10.901333 0.981333 15.701334 1.749333a161.877333 161.877333 0 0 0 104.277333-47.253333 144.874667 144.874667 0 0 0 58.474667-90.346667c0-5.802667 0-11.904-0.234667-17.664a80.576 80.576 0 0 1 15.658667-74.858666A84.949333 84.949333 0 0 1 626.858667 106.666667a85.525333 85.525333 0 0 1 54.08 19.328l1.962666 1.941333c18.88 18.432 207.253333 206.933333 209.066667 208.746667A85.930667 85.930667 0 0 1 917.333333 397.888a85.973333 85.973333 0 0 1-25.6 61.205333 67.456 67.456 0 0 1-46.549333 16.874667 199.210667 199.210667 0 0 1-30.229333-3.008 226.176 226.176 0 0 0-15.701334-0.362667h-1.493333a115.605333 115.605333 0 0 0-77.930667 45.205334 210.752 210.752 0 0 0-59.456 118.976c0.917333 7.850667 2.56 21.333333 2.858667 23.125333a144.298667 144.298667 0 0 1-57.258667 165.056 38.229333 38.229333 0 0 1-20.138666 5.717333 38.058667 38.058667 0 0 1-27.093334-11.2l-123.562666-123.733333L209.92 866.986667a36.266667 36.266667 0 0 1-22.229333 7.722666z"/>
  14. </Canvas>
  15. </Viewbox>
  16. </ControlTemplate>
  17. <ControlTemplate x:Key="fixed">
  18. <Viewbox>
  19. <Canvas Width="1024" Height="1024" Background="#01FFFFFF">
  20. <Path Fill="#CC464646" Data="m559.42 1006.7-0.19651 0.1957a37.504 37.504 45 0 1-26.798 10.792 37.845 37.845 0 0 1-37.963-32.585l-43.975-280.47-176.83-0.3904a38.229 38.229 0 0 1-36.991-28.556 140.8 140.8 0 0 1 5.679-70.118 154.24 154.24 0 0 1 37.093-58.892 161.79 161.79 0 0 1 42.753-30.535l5.0014-4.0477c4.3824-3.7925 8.4166-6.9974 12.36-9.8404a161.88 161.88 0 0 0 40.54-107.07 144.87 144.87 0 0 0-22.322-105.28c-4.0947-4.1115-8.4002-8.4345-12.631-12.35a80.576 80.576 0 0 1-41.73-64.091 84.949 84.949 0 0 1 25.195-60.862 85.525 85.525 0 0 1 51.957-24.468l2.7606-9e-3c26.384-0.26304 292.87 0.37037 295.44 0.37559a85.931 85.931 0 0 1 61.163 25.467 85.973 85.973 0 0 1 25.052 61.432 67.456 67.456 0 0 1-21.074 44.805 199.21 199.21 0 0 1-23.542 19.2 226.18 226.18 0 0 0-11.381 10.823l-1.0581 1.0538a115.61 115.61 0 0 0-23.318 87.023 210.75 210.75 0 0 0 41.83 126.26c6.1899 4.9152 16.868 13.309 18.344 14.368a144.3 144.3 45 0 1 75.904 157.36 38.229 38.229 0 0 1-10.235 18.262 38.059 38.059 0 0 1-27.1 11.183l-174.86-0.47738-38.766 280.29a36.267 36.267 0 0 1-10.301 21.158z"/>
  21. </Canvas>
  22. </Viewbox>
  23. </ControlTemplate>
  24. <Style TargetType="{x:Type ScrollBar}">
  25. <Setter Property="Background" Value="#77F0F8FF"/>
  26. <Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
  27. <Setter Property="Stylus.IsFlicksEnabled" Value="false"/>
  28. <!--滚动条宽度-->
  29. <Setter Property="Width" Value="8"/>
  30. <Setter Property="MinWidth" Value="6"/>
  31. <Setter Property="Template">
  32. <Setter.Value>
  33. <ControlTemplate TargetType="{x:Type ScrollBar}">
  34. <!--滚动条背景色-->
  35. <Grid x:Name="Bg" Background="#77DDDDDD" SnapsToDevicePixels="true" Width="8">
  36. <Grid.RowDefinitions>
  37. <RowDefinition />
  38. </Grid.RowDefinitions>
  39. <Track x:Name="PART_Track" IsDirectionReversed="true" IsEnabled="{TemplateBinding IsMouseOver}">
  40. <Track.DecreaseRepeatButton>
  41. <RepeatButton Command="{x:Static ScrollBar.PageUpCommand}" Style="{StaticResource VerticalScrollBarPageButton}"/>
  42. </Track.DecreaseRepeatButton>
  43. <Track.IncreaseRepeatButton>
  44. <RepeatButton Command="{x:Static ScrollBar.PageDownCommand}" Style="{StaticResource VerticalScrollBarPageButton}"/>
  45. </Track.IncreaseRepeatButton>
  46. <Track.Thumb>
  47. <Thumb Style="{StaticResource ScrollBarThumb}"/>
  48. </Track.Thumb>
  49. </Track>
  50. </Grid>
  51. <ControlTemplate.Triggers>
  52. <Trigger Property="IsEnabled" Value="false">
  53. <Setter Property="Background" TargetName="Bg" Value="{StaticResource ScrollBarDisabledBackground}"/>
  54. </Trigger>
  55. </ControlTemplate.Triggers>
  56. </ControlTemplate>
  57. </Setter.Value>
  58. </Setter>
  59. <Style.Triggers>
  60. <Trigger Property="Orientation" Value="Horizontal">
  61. <Setter Property="Width" Value="Auto"/>
  62. <Setter Property="MinWidth" Value="0"/>
  63. <Setter Property="Height" Value="6"/>
  64. <Setter Property="MinHeight" Value="6"/>
  65. <Setter Property="Background" Value="#77F0F8FF"/>
  66. <Setter Property="Template">
  67. <Setter.Value>
  68. <ControlTemplate TargetType="{x:Type ScrollBar}">
  69. <Grid x:Name="Bg" Background="Red" SnapsToDevicePixels="true">
  70. <Grid.ColumnDefinitions>
  71. <ColumnDefinition />
  72. </Grid.ColumnDefinitions>
  73. <Track x:Name="PART_Track" IsEnabled="{TemplateBinding IsMouseOver}">
  74. <Track.DecreaseRepeatButton>
  75. <RepeatButton Command="{x:Static ScrollBar.PageLeftCommand}" Style="{StaticResource HorizontalScrollBarPageButton}"/>
  76. </Track.DecreaseRepeatButton>
  77. <Track.IncreaseRepeatButton>
  78. <RepeatButton Command="{x:Static ScrollBar.PageRightCommand}" Style="{StaticResource HorizontalScrollBarPageButton}"/>
  79. </Track.IncreaseRepeatButton>
  80. <Track.Thumb>
  81. <Thumb Style="{StaticResource ScrollBarThumb}" />
  82. </Track.Thumb>
  83. </Track>
  84. </Grid>
  85. <ControlTemplate.Triggers>
  86. <Trigger Property="IsEnabled" Value="false">
  87. <Setter Property="Background" TargetName="Bg" Value="{StaticResource ScrollBarDisabledBackground}"/>
  88. </Trigger>
  89. </ControlTemplate.Triggers>
  90. </ControlTemplate>
  91. </Setter.Value>
  92. </Setter>
  93. </Trigger>
  94. </Style.Triggers>
  95. </Style>
  96. <Style x:Key="RealTimeButtonStyle" TargetType="{x:Type Button}">
  97. <Setter Property="Background" Value="#FF636363"/>
  98. <Setter Property="Foreground" Value="WhiteSmoke"/>
  99. <Setter Property="HorizontalContentAlignment" Value="Center"/>
  100. <Setter Property="VerticalContentAlignment" Value="Center"/>
  101. <Setter Property="Padding" Value="17,4"/>
  102. <Setter Property="FontSize" Value="14"/>
  103. <Setter Property="BorderThickness" Value="0"/>
  104. <Setter Property="Template">
  105. <Setter.Value>
  106. <ControlTemplate TargetType="{x:Type Button}">
  107. <Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true" CornerRadius="3">
  108. <ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  109. </Border>
  110. <ControlTemplate.Triggers>
  111. <Trigger Property="IsMouseOver" Value="true">
  112. <Setter Property="Background" TargetName="border" Value="#FF828282"/>
  113. </Trigger>
  114. <Trigger Property="IsPressed" Value="true">
  115. <Setter Property="Background" TargetName="border" Value="#FF636363"/>
  116. </Trigger>
  117. </ControlTemplate.Triggers>
  118. </ControlTemplate>
  119. </Setter.Value>
  120. </Setter>
  121. </Style>
  122. <Style x:Key="HistoryButtonStyle" TargetType="{x:Type Button}">
  123. <Setter Property="Background" Value="#FF006ACC"/>
  124. <Setter Property="Foreground" Value="WhiteSmoke"/>
  125. <Setter Property="HorizontalContentAlignment" Value="Center"/>
  126. <Setter Property="VerticalContentAlignment" Value="Center"/>
  127. <Setter Property="Padding" Value="17,4"/>
  128. <Setter Property="FontSize" Value="14"/>
  129. <Setter Property="BorderThickness" Value="0"/>
  130. <Setter Property="Template">
  131. <Setter.Value>
  132. <ControlTemplate TargetType="{x:Type Button}">
  133. <Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true" CornerRadius="3">
  134. <ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  135. </Border>
  136. <ControlTemplate.Triggers>
  137. <Trigger Property="IsMouseOver" Value="true">
  138. <Setter Property="Background" TargetName="border" Value="#FF2E81CC"/>
  139. </Trigger>
  140. <Trigger Property="IsPressed" Value="true">
  141. <Setter Property="Background" TargetName="border" Value="#FF006ACC"/>
  142. </Trigger>
  143. </ControlTemplate.Triggers>
  144. </ControlTemplate>
  145. </Setter.Value>
  146. </Setter>
  147. </Style>
  148. </UserControl.Resources>
  149. <Grid Margin="5">
  150. <Grid.RowDefinitions>
  151. <RowDefinition Height="Auto"/>
  152. <RowDefinition/>
  153. <RowDefinition Height="Auto"/>
  154. </Grid.RowDefinitions>
  155. <Border CornerRadius="7,7,0,0" Margin="0,5,0,0">
  156. <Border.Background>
  157. <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
  158. <GradientStop Color="WhiteSmoke"/>
  159. <GradientStop Color="#FFBDBDBD" Offset="1"/>
  160. </LinearGradientBrush>
  161. </Border.Background>
  162. <Grid>
  163. <TextBlock Margin="10" FontSize="14" VerticalAlignment="Center">
  164. <TextBlock.Style>
  165. <Style TargetType="TextBlock">
  166. <Style.Triggers>
  167. <DataTrigger Binding="{Binding RelativeSource= {RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=IsFault}" Value="True">
  168. <Setter Property="Text" Value="最近报警"/>
  169. </DataTrigger>
  170. <DataTrigger Binding="{Binding RelativeSource= {RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=IsFault}" Value="False">
  171. <Setter Property="Text" Value="最近故障"/>
  172. </DataTrigger>
  173. </Style.Triggers>
  174. </Style>
  175. </TextBlock.Style>
  176. </TextBlock>
  177. <StackPanel HorizontalAlignment="Right" Orientation="Horizontal" VerticalAlignment="Center" Margin="10,5">
  178. <Button Click="Button_Click" Tag="fault" Padding="12,3" FontSize="14" Margin="3">
  179. <Button.Style>
  180. <Style TargetType="Button">
  181. <Style.Triggers>
  182. <DataTrigger Binding="{Binding RelativeSource= {RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=IsFault}" Value="True">
  183. <Setter Property="Content" Value="查看故障"/>
  184. <Setter Property="Background" Value="#FFED602A"/>
  185. </DataTrigger>
  186. <DataTrigger Binding="{Binding RelativeSource= {RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=IsFault}" Value="False">
  187. <Setter Property="Content" Value="查看报警"/>
  188. <Setter Property="Background" Value="#FFEDA72A"/>
  189. </DataTrigger>
  190. </Style.Triggers>
  191. </Style>
  192. </Button.Style>
  193. </Button>
  194. <ContentControl x:Name="cc" MouseLeftButtonUp="cc_MouseLeftButtonUp" HorizontalAlignment="Right" VerticalAlignment="Top" Width="25" Height="25">
  195. <ContentControl.Style>
  196. <Style TargetType="ContentControl">
  197. <Style.Triggers>
  198. <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=IsFixed}" Value="True">
  199. <Setter Property="Template" Value="{DynamicResource fixed}"/>
  200. </DataTrigger>
  201. <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=IsFixed}" Value="False">
  202. <Setter Property="Template" Value="{DynamicResource unfixed}"/>
  203. </DataTrigger>
  204. </Style.Triggers>
  205. </Style>
  206. </ContentControl.Style>
  207. </ContentControl>
  208. </StackPanel>
  209. </Grid>
  210. </Border>
  211. <DataGrid x:Name="_GDFault" Grid.Row="1" AutoGenerateColumns="False" BorderBrush="#FFABABAB" IsReadOnly="True" HorizontalGridLinesBrush="#FFA4A4A4" VerticalGridLinesBrush="#FFA4A4A4" SelectionUnit="Cell">
  212. <DataGrid.Style>
  213. <Style TargetType="DataGrid">
  214. <Style.Triggers>
  215. <DataTrigger Binding="{Binding RelativeSource= {RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=IsFault}" Value="True">
  216. <Setter Property="Visibility" Value="Visible"/>
  217. </DataTrigger>
  218. <DataTrigger Binding="{Binding RelativeSource= {RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=IsFault}" Value="False">
  219. <Setter Property="Visibility" Value="Collapsed"/>
  220. </DataTrigger>
  221. </Style.Triggers>
  222. </Style>
  223. </DataGrid.Style>
  224. <DataGrid.Columns>
  225. <DataGridTextColumn Header="时间" Binding="{Binding AlertTimeString}" Width="127"/>
  226. <DataGridTextColumn Header="设备" Binding="{Binding ThingName}" Width="120"/>
  227. <DataGridTextColumn Header="故障信息" Binding="{Binding AlertString}" Width="260"/>
  228. <DataGridTemplateColumn Header="当前报警">
  229. <DataGridTemplateColumn.CellTemplate>
  230. <DataTemplate>
  231. <Grid Background="#01FFFFFF" MouseLeftButtonUp="Grid_MouseLeftButtonUp">
  232. <TextBlock Text="{Binding AgCount}" Foreground="#FF4040DA" HorizontalAlignment="Center" TextDecorations="Underline"/>
  233. </Grid>
  234. </DataTemplate>
  235. </DataGridTemplateColumn.CellTemplate>
  236. </DataGridTemplateColumn>
  237. </DataGrid.Columns>
  238. </DataGrid>
  239. <DataGrid x:Name="_GDAlarm" Grid.Row="1" AutoGenerateColumns="False" BorderBrush="#FFABABAB" IsReadOnly="True" HorizontalGridLinesBrush="#FFA4A4A4" VerticalGridLinesBrush="#FFA4A4A4" SelectionUnit="CellOrRowHeader">
  240. <DataGrid.Style>
  241. <Style TargetType="DataGrid">
  242. <Style.Triggers>
  243. <DataTrigger Binding="{Binding RelativeSource= {RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=IsFault}" Value="False">
  244. <Setter Property="Visibility" Value="Visible"/>
  245. </DataTrigger>
  246. <DataTrigger Binding="{Binding RelativeSource= {RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=IsFault}" Value="True">
  247. <Setter Property="Visibility" Value="Collapsed"/>
  248. </DataTrigger>
  249. </Style.Triggers>
  250. </Style>
  251. </DataGrid.Style>
  252. <DataGrid.Columns>
  253. <DataGridTextColumn Header="时间" Binding="{Binding LatestUpdateTimeString}" Width="127"/>
  254. <DataGridTextColumn Header="设备" Binding="{Binding ObjectName}" Width="120"/>
  255. <DataGridTextColumn Header="报警信息" Binding="{Binding AlertText}" Width="320"/>
  256. </DataGrid.Columns>
  257. </DataGrid>
  258. <StackPanel Grid.Row="2" Orientation="Horizontal" Margin="10" HorizontalAlignment="Center">
  259. <Button Style="{DynamicResource RealTimeButtonStyle}" Content="实时报警" Margin="10,0" Click="Button_Click" Tag="rtalarm"/>
  260. <Button Content="历史报警" Margin="10,0" Style="{DynamicResource HistoryButtonStyle}" Click="Button_Click" Tag="hisalarm"/>
  261. <Button Content="历史故障" Margin="10,0" Style="{DynamicResource HistoryButtonStyle}" Click="Button_Click" Tag="hisfault"/>
  262. </StackPanel>
  263. </Grid>
  264. </UserControl>