RealTimeView.xaml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. <UserControl x:Class="VirgoUI.Client.Models.Operate.RealTime.RealTimeView"
  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:i="http://schemas.microsoft.com/expression/2010/interactivity"
  7. xmlns:cal="http://www.caliburn.org"
  8. xmlns:ctrl="http://OpenSEMI.Ctrlib.com/presentation"
  9. xmlns:s="http://schemas.abtsoftware.co.uk/scichart"
  10. xmlns:visuals="http://schemas.abtsoftware.co.uk/scichart"
  11. xmlns:control="clr-namespace:Aitex.Core.UI.Control;assembly=MECF.Framework.UI.Core"
  12. xmlns:converters="clr-namespace:Aitex.Core.UI.Converters;assembly=MECF.Framework.UI.Core"
  13. mc:Ignorable="d" IsEnabled="{Binding PageEnabled}"
  14. d:DesignHeight="450" d:DesignWidth="1800">
  15. <UserControl.Resources>
  16. <converters:LineColorConverter x:Key="colorConverter"/>
  17. <DataTemplate x:Key="SeriesInfoTemplate" DataType="s:SeriesInfo">
  18. <StackPanel Margin="0 1" Orientation="Vertical">
  19. <TextBlock Text="{Binding SeriesName, StringFormat='{}{0}:'}"/>
  20. <TextBlock Text="{Binding FormattedXValue, StringFormat='X: {0}'}" />
  21. <TextBlock Text="{Binding FormattedYValue, StringFormat='Y: {0}'}" />
  22. </StackPanel>
  23. </DataTemplate>
  24. <!-- Demonstrates a custom cursor tooltip style -->
  25. <Style x:Key="CursorTooltipStyle" TargetType="s:CursorLabelControl">
  26. <Setter Property="Template">
  27. <Setter.Value>
  28. <ControlTemplate TargetType="s:CursorLabelControl">
  29. <Border Background="Blue"
  30. BorderBrush="Blue"
  31. BorderThickness="2"
  32. Opacity="0.7"
  33. Padding="2.5">
  34. <ItemsControl ItemsSource="{Binding DataContext.SeriesData.SeriesInfo, RelativeSource={RelativeSource TemplatedParent}}">
  35. <ItemsControl.ItemTemplate>
  36. <DataTemplate DataType="s:SeriesInfo">
  37. <ContentControl Content="{Binding}" ContentTemplate="{StaticResource SeriesInfoTemplate}" />
  38. </DataTemplate>
  39. </ItemsControl.ItemTemplate>
  40. </ItemsControl>
  41. </Border>
  42. </ControlTemplate>
  43. </Setter.Value>
  44. </Setter>
  45. </Style>
  46. <!-- Demonstrates custom cursor line style -->
  47. <Style x:Key="CursorLineStyle" TargetType="Line">
  48. <Setter Property="StrokeThickness" Value="2" />
  49. <Setter Property="Stroke" Value="Blue" />
  50. </Style>
  51. </UserControl.Resources>
  52. <Grid>
  53. <Grid.ColumnDefinitions>
  54. <ColumnDefinition Width="400" ></ColumnDefinition>
  55. <ColumnDefinition Width="Auto" />
  56. <ColumnDefinition ></ColumnDefinition>
  57. </Grid.ColumnDefinitions>
  58. <Grid.RowDefinitions>
  59. <RowDefinition ></RowDefinition>
  60. <RowDefinition Height="200" ></RowDefinition>
  61. </Grid.RowDefinitions>
  62. <Grid Grid.Column="0" Grid.RowSpan="2">
  63. <Grid.RowDefinitions>
  64. <RowDefinition Height="0"/>
  65. <RowDefinition Height="0"/>
  66. <RowDefinition />
  67. </Grid.RowDefinitions>
  68. <Grid>
  69. <Grid.ColumnDefinitions>
  70. <ColumnDefinition Width="80"/>
  71. <ColumnDefinition Width="70"/>
  72. <ColumnDefinition Width="115"/>
  73. <ColumnDefinition Width="70"/>
  74. <ColumnDefinition />
  75. </Grid.ColumnDefinitions>
  76. <Border BorderBrush="{DynamicResource Table_BD}" BorderThickness="1" Background="{DynamicResource Table_BG_Title}" Padding="5,1" Height="30">
  77. <TextBlock Text="Interval(s)" FontFamily="Arial" FontSize="14" Foreground="{DynamicResource FG_Black}" HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock>
  78. </Border>
  79. <Border Grid.Column="1" BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,1,1,1" Background="{DynamicResource Table_BG_Content}" Padding="5,1">
  80. <TextBox Width="Auto"/>
  81. </Border>
  82. <Border Grid.Column="2" BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,1,1,1" Background="{DynamicResource Table_BG_Title}" Padding="5,1">
  83. <TextBlock Text="Time Window(s)" FontFamily="Arial" FontSize="14" Foreground="{DynamicResource FG_Black}" HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock>
  84. </Border>
  85. <Border Grid.Column="3" BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,1,1,1" Background="{DynamicResource Table_BG_Content}" Padding="5,1">
  86. <TextBox Width="Auto"/>
  87. </Border>
  88. <Border Grid.Column="4" BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,1,1,1" Background="{DynamicResource Table_BG_Content}" Padding="5,1">
  89. <Button Content="Apply" Width="50" Height="22">
  90. <i:Interaction.Triggers>
  91. <i:EventTrigger EventName="Click">
  92. <cal:ActionMessage MethodName="Apply"/>
  93. </i:EventTrigger>
  94. </i:Interaction.Triggers>
  95. </Button>
  96. </Border>
  97. </Grid>
  98. <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10">
  99. <Button Content="Preset Selection" Margin="0,0,5,0" Width="100" Height="30">
  100. <i:Interaction.Triggers>
  101. <i:EventTrigger EventName="Click">
  102. <cal:ActionMessage MethodName="Preset"/>
  103. </i:EventTrigger>
  104. </i:Interaction.Triggers>
  105. </Button>
  106. <Button Content="Clear Selection" Width="100">
  107. <i:Interaction.Triggers>
  108. <i:EventTrigger EventName="Click">
  109. <cal:ActionMessage MethodName="Clear"/>
  110. </i:EventTrigger>
  111. </i:Interaction.Triggers>
  112. </Button>
  113. </StackPanel>
  114. <Border Grid.Row="2" BorderBrush="{DynamicResource Tab_BD}" BorderThickness="1" SnapsToDevicePixels="True" Background="{DynamicResource Tab_BG}" Padding="12">
  115. <TreeView x:Name="ParameterTreeView" ItemsSource="{Binding ParameterNodes}">
  116. <!--<i:Interaction.Triggers>
  117. <i:EventTrigger EventName="TreeView.SelectedItemChanged">
  118. <cal:ActionMessage MethodName="OnTreeSelectedChanged">
  119. <cal:Parameter Value="{Binding ElementName=ParameterTreeView,Path=SelectedItem}"></cal:Parameter>
  120. </cal:ActionMessage>
  121. </i:EventTrigger>
  122. </i:Interaction.Triggers>-->
  123. <TreeView.ItemTemplate>
  124. <HierarchicalDataTemplate ItemsSource="{Binding ChildNodes}">
  125. <StackPanel Orientation="Horizontal">
  126. <CheckBox IsChecked="{Binding Selected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" >
  127. <i:Interaction.Triggers>
  128. <i:EventTrigger EventName="Click">
  129. <cal:ActionMessage MethodName="ParameterCheck">
  130. <cal:Parameter Value="{Binding }"/>
  131. </cal:ActionMessage>
  132. </i:EventTrigger>
  133. </i:Interaction.Triggers>
  134. </CheckBox>
  135. <TextBlock Text="{Binding Name}" />
  136. </StackPanel>
  137. </HierarchicalDataTemplate>
  138. </TreeView.ItemTemplate>
  139. </TreeView>
  140. </Border>
  141. </Grid>
  142. <GridSplitter Grid.Row="0" Grid.RowSpan="2" Grid.Column="1" Background="LightBlue"
  143. HorizontalAlignment="Left" VerticalAlignment="Stretch" Width="5" Margin="0,0,2,0">
  144. </GridSplitter>
  145. <!--data chart-->
  146. <Grid Grid.Column="2" Grid.Row="0" Margin="5,0,0,0">
  147. <s:SciChartSurface Name="sciChart" RenderableSeries="{Binding SelectedData}"
  148. s:ThemeManager.Theme="ExpressionLight"
  149. Padding="0,0,0,0"
  150. DebugWhyDoesntSciChartRender="False" BorderBrush="Gray" Focusable="False" IsTabStop="False">
  151. <!-- Create an X Axis -->
  152. <s:SciChartSurface.XAxis>
  153. <s:DateTimeAxis DrawMinorTicks="False"
  154. DrawMinorGridLines="False"
  155. Margin="0,0,0,0"
  156. SubDayTextFormatting="HH:mm:ss"
  157. TitleFontSize="15"
  158. FontSize="20"
  159. AutoRange="{Binding ChartAutoRange}"
  160. TextFormatting="HH:mm:ss"
  161. Id="DefaultAxisId" TitleFontWeight="Normal" />
  162. </s:SciChartSurface.XAxis>
  163. <!-- Create a Y Axis -->
  164. <s:SciChartSurface.YAxis>
  165. <s:NumericAxis DrawMinorTicks="False"
  166. DrawMinorGridLines="False"
  167. AxisAlignment="Right"
  168. MinWidth="35" MaxWidth="35"
  169. HorizontalAlignment="Center"
  170. CursorTextFormatting="0.######"
  171. Id="DefaultAxisId" MajorDelta="0.001"
  172. MinorDelta="0.001" DrawMajorBands="False" Focusable="False"
  173. BorderThickness="0" AutoRange="{Binding ChartAutoRange}"
  174. DrawLabels="True" DrawMajorGridLines="True" DrawMajorTicks="False">
  175. <s:NumericAxis.GrowBy>
  176. <s:DoubleRange Min="0.001" Max="0.001"/>
  177. </s:NumericAxis.GrowBy>
  178. </s:NumericAxis>
  179. </s:SciChartSurface.YAxis>
  180. <s:SciChartSurface.ChartModifier>
  181. <s:ModifierGroup >
  182. <s:RubberBandXyZoomModifier x:Name="rubberBandZoomModifier" IsEnabled="True"
  183. IsXAxisOnly="False"
  184. ZoomExtentsY="True"
  185. IsAnimated="True" ExecuteOn="MouseLeftButton" ReceiveHandledEvents="True" />
  186. <s:CursorModifier x:Name="CursorModifier" IsEnabled="True"
  187. LineOverlayStyle="{StaticResource CursorLineStyle}"
  188. ShowAxisLabels="True"
  189. ShowTooltip="True"
  190. ShowTooltipOn="MouseOver"
  191. SourceMode="AllSeries"
  192. TooltipContainerStyle="{StaticResource CursorTooltipStyle}"
  193. UseInterpolation="True" />
  194. <s:LegendModifier ShowLegend="False" GetLegendDataFor="AllSeries" x:Name="legendModifier"/>
  195. <s:ZoomExtentsModifier x:Name="zoomExtentsModifier" XyDirection="XYDirection" ExecuteOn="MouseDoubleClick"/>
  196. <s:ZoomPanModifier x:Name="zoomPanModifier" IsEnabled="True" ClipModeX="None" XyDirection="XYDirection" ExecuteOn="MouseRightButton" ZoomExtentsY="False" />
  197. <s:RolloverModifier x:Name="rolloverModifier"
  198. UseInterpolation="False" FontSize="9" IsEnabled="False"
  199. DrawVerticalLine="False" FontFamily="Arial,SimSun"
  200. SnapsToDevicePixels="False"
  201. ShowAxisLabels="False" />
  202. <s:MouseWheelZoomModifier x:Name="mouseWheelZoomModifier" XyDirection="XYDirection"/>
  203. <s:SeriesValueModifier/>
  204. </s:ModifierGroup>
  205. </s:SciChartSurface.ChartModifier>
  206. </s:SciChartSurface>
  207. <CheckBox IsChecked="{Binding EnableAutoZoom, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="0,10,1208,0" VerticalAlignment="Top" Content="Auto Zoom" HorizontalAlignment="Right"></CheckBox>
  208. </Grid>
  209. <DataGrid Grid.Column="2" Grid.Row="1" Margin="5,10,0,0"
  210. AlternationCount="2" ColumnHeaderHeight="30"
  211. ItemsSource="{Binding SelectedData}" AutoGenerateColumns="False"
  212. CanUserAddRows="False" CanUserResizeRows="False" CanUserResizeColumns="True" FontFamily="Arial" FontSize="12">
  213. <DataGrid.Columns>
  214. <DataGridTemplateColumn>
  215. <DataGridTemplateColumn.HeaderTemplate >
  216. <DataTemplate>
  217. <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
  218. <!--<CheckBox Foreground="{DynamicResource FG_White}" VerticalAlignment="Center">
  219. <i:Interaction.Triggers>
  220. <i:EventTrigger EventName="Click">
  221. <cal:ActionMessage MethodName="VisibleCheckAll">
  222. </cal:ActionMessage>
  223. </i:EventTrigger>
  224. </i:Interaction.Triggers>
  225. </CheckBox>-->
  226. <TextBlock Text="Visible" FontFamily="Arial" FontSize="12" VerticalAlignment="Bottom" Margin="3,0,0,0"/>
  227. </StackPanel>
  228. </DataTemplate>
  229. </DataGridTemplateColumn.HeaderTemplate>
  230. <DataGridTemplateColumn.CellTemplate>
  231. <DataTemplate>
  232. <CheckBox IsChecked="{Binding IsVisible, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" >
  233. <!--<i:Interaction.Triggers>
  234. <i:EventTrigger EventName="Click">
  235. <cal:ActionMessage MethodName="VisibleCheck">
  236. <cal:Parameter Value="{Binding }"/>
  237. </cal:ActionMessage>
  238. </i:EventTrigger>
  239. </i:Interaction.Triggers>-->
  240. </CheckBox>
  241. </DataTemplate>
  242. </DataGridTemplateColumn.CellTemplate>
  243. </DataGridTemplateColumn>
  244. <DataGridTemplateColumn Header="Name" MinWidth="100">
  245. <DataGridTemplateColumn.CellTemplate>
  246. <DataTemplate>
  247. <TextBlock Text="{Binding DataName}" Margin="5,0" FontFamily="Arial" FontSize="14" Foreground="{DynamicResource FG_Black}" HorizontalAlignment="Left" VerticalAlignment="Center" />
  248. </DataTemplate>
  249. </DataGridTemplateColumn.CellTemplate>
  250. </DataGridTemplateColumn>
  251. <DataGridTemplateColumn Header="Color" MinWidth="100" >
  252. <DataGridTemplateColumn.CellTemplate>
  253. <DataTemplate>
  254. <Button Style="{DynamicResource Color_Button}" HorizontalAlignment="Stretch" Background="{Binding Stroke, Converter={StaticResource colorConverter}}" Width="50">
  255. <i:Interaction.Triggers>
  256. <i:EventTrigger EventName="Click">
  257. <cal:ActionMessage MethodName="SelectColor">
  258. <cal:Parameter Value="{Binding}" ></cal:Parameter>
  259. </cal:ActionMessage>
  260. </i:EventTrigger>
  261. </i:Interaction.Triggers>
  262. </Button>
  263. </DataTemplate>
  264. </DataGridTemplateColumn.CellTemplate>
  265. </DataGridTemplateColumn>
  266. <DataGridTemplateColumn Header="Factor" MinWidth="100">
  267. <DataGridTemplateColumn.CellTemplate>
  268. <DataTemplate>
  269. <ctrl:TextBoxEx AllowBackgroundChange="False" Text="{Binding DataFactor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="80" Margin="5,0" FontFamily="Arial" FontSize="14" Foreground="{DynamicResource FG_Black}" HorizontalAlignment="Left" VerticalAlignment="Center" />
  270. <!--<i:Interaction.Triggers>
  271. <i:EventTrigger EventName="LostFocus">
  272. <cal:ActionMessage MethodName="FactorLostFocus">
  273. <cal:Parameter Value="{Binding}" />
  274. </cal:ActionMessage>
  275. </i:EventTrigger>
  276. <i:EventTrigger EventName="KeyDown">
  277. <cal:ActionMessage MethodName="FactorKeyDown">
  278. <cal:Parameter Value="$eventargs" />
  279. <cal:Parameter Value="{Binding}" />
  280. </cal:ActionMessage>
  281. </i:EventTrigger>
  282. </i:Interaction.Triggers>-->
  283. </DataTemplate>
  284. </DataGridTemplateColumn.CellTemplate>
  285. </DataGridTemplateColumn>
  286. <DataGridTemplateColumn Header="Offset" MinWidth="100">
  287. <DataGridTemplateColumn.CellTemplate>
  288. <DataTemplate>
  289. <ctrl:TextBoxEx AllowBackgroundChange="False" Text="{Binding DataOffset, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="80" Margin="5,0" FontFamily="Arial" FontSize="14" Foreground="{DynamicResource FG_Black}" HorizontalAlignment="Left" VerticalAlignment="Center" >
  290. <!--<i:Interaction.Triggers>
  291. <i:EventTrigger EventName="LostFocus">
  292. <cal:ActionMessage MethodName="OffsetLostFocus">
  293. <cal:Parameter Value="{Binding}" />
  294. </cal:ActionMessage>
  295. </i:EventTrigger>
  296. <i:EventTrigger EventName="KeyDown">
  297. <cal:ActionMessage MethodName="OffsetKeyDown">
  298. <cal:Parameter Value="$eventargs" />
  299. <cal:Parameter Value="{Binding}" />
  300. </cal:ActionMessage>
  301. </i:EventTrigger>
  302. </i:Interaction.Triggers>-->
  303. </ctrl:TextBoxEx>
  304. </DataTemplate>
  305. </DataGridTemplateColumn.CellTemplate>
  306. </DataGridTemplateColumn>
  307. <DataGridTemplateColumn Header="Width" MinWidth="60">
  308. <DataGridTemplateColumn.CellTemplate>
  309. <DataTemplate>
  310. <ctrl:TextBoxEx AllowBackgroundChange="False" Text="{Binding LineThickness, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="80" Margin="5,0" FontFamily="Arial" FontSize="14" Foreground="{DynamicResource FG_Black}" HorizontalAlignment="Left" VerticalAlignment="Center" >
  311. <!--<i:Interaction.Triggers>
  312. <i:EventTrigger EventName="LostFocus">
  313. <cal:ActionMessage MethodName="WidthLostFocus">
  314. <cal:Parameter Value="{Binding}" />
  315. </cal:ActionMessage>
  316. </i:EventTrigger>
  317. <i:EventTrigger EventName="KeyDown">
  318. <cal:ActionMessage MethodName="WidthKeyDown">
  319. <cal:Parameter Value="$eventargs" />
  320. <cal:Parameter Value="{Binding}" />
  321. </cal:ActionMessage>
  322. </i:EventTrigger>
  323. </i:Interaction.Triggers>-->
  324. </ctrl:TextBoxEx>
  325. </DataTemplate>
  326. </DataGridTemplateColumn.CellTemplate>
  327. </DataGridTemplateColumn>
  328. <DataGridTemplateColumn Width="80">
  329. <DataGridTemplateColumn.HeaderTemplate >
  330. <DataTemplate>
  331. <Button Content="Export All" Width="65" Height="22">
  332. <i:Interaction.Triggers>
  333. <i:EventTrigger EventName="Click">
  334. <cal:ActionMessage MethodName="ExportAll">
  335. </cal:ActionMessage>
  336. </i:EventTrigger>
  337. </i:Interaction.Triggers>
  338. </Button>
  339. </DataTemplate>
  340. </DataGridTemplateColumn.HeaderTemplate>
  341. <DataGridTemplateColumn.CellTemplate>
  342. <DataTemplate>
  343. <Button Content="Export" Width="65" Height="22">
  344. <i:Interaction.Triggers>
  345. <i:EventTrigger EventName="Click">
  346. <cal:ActionMessage MethodName="Export">
  347. <cal:Parameter Value="{Binding }"/>
  348. </cal:ActionMessage>
  349. </i:EventTrigger>
  350. </i:Interaction.Triggers>
  351. </Button>
  352. </DataTemplate>
  353. </DataGridTemplateColumn.CellTemplate>
  354. </DataGridTemplateColumn>
  355. <DataGridTemplateColumn Width="80">
  356. <DataGridTemplateColumn.HeaderTemplate >
  357. <DataTemplate>
  358. <Button Content="Delete All" Width="65" Height="22">
  359. <i:Interaction.Triggers>
  360. <i:EventTrigger EventName="Click">
  361. <cal:ActionMessage MethodName="DeleteAll">
  362. </cal:ActionMessage>
  363. </i:EventTrigger>
  364. </i:Interaction.Triggers>
  365. </Button>
  366. </DataTemplate>
  367. </DataGridTemplateColumn.HeaderTemplate>
  368. <DataGridTemplateColumn.CellTemplate>
  369. <DataTemplate>
  370. <Button Content="Delete" Width="65" Height="22">
  371. <i:Interaction.Triggers>
  372. <i:EventTrigger EventName="Click">
  373. <cal:ActionMessage MethodName="Delete">
  374. <cal:Parameter Value="{Binding }"/>
  375. </cal:ActionMessage>
  376. </i:EventTrigger>
  377. </i:Interaction.Triggers>
  378. </Button>
  379. </DataTemplate>
  380. </DataGridTemplateColumn.CellTemplate>
  381. </DataGridTemplateColumn>
  382. </DataGrid.Columns>
  383. </DataGrid>
  384. </Grid>
  385. </UserControl>