2025-09-11 11:04:07 +08:00
|
|
|
<UserControl
|
|
|
|
|
x:Class="DMS.WPF.Views.VariableHistoryView"
|
|
|
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
|
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
|
|
|
xmlns:controls="http://schemas.inkore.net/lib/ui/wpf/modern"
|
|
|
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
|
|
|
xmlns:enums="clr-namespace:DMS.Core.Enums;assembly=DMS.Core"
|
|
|
|
|
xmlns:ex="clr-namespace:DMS.Extensions"
|
2025-09-12 08:35:35 +08:00
|
|
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
2025-09-11 11:04:07 +08:00
|
|
|
xmlns:helper="clr-namespace:DMS.WPF.Helper"
|
|
|
|
|
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
|
|
|
|
xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf"
|
|
|
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
|
|
|
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
|
|
|
|
xmlns:valueConverts="clr-namespace:DMS.WPF.ValueConverts"
|
|
|
|
|
xmlns:vm="clr-namespace:DMS.WPF.ViewModels"
|
2025-09-17 13:32:29 +08:00
|
|
|
xmlns:converters="clr-namespace:DMS.WPF.Converters"
|
2025-09-22 06:24:08 +08:00
|
|
|
xmlns:lvc="clr-namespace:LiveChartsCore.SkiaSharpView.WPF;assembly=LiveChartsCore.SkiaSharpView.WPF"
|
2025-09-11 11:04:07 +08:00
|
|
|
d:DataContext="{d:DesignInstance vm:VariableHistoryViewModel}"
|
|
|
|
|
d:DesignHeight="600"
|
|
|
|
|
d:DesignWidth="800"
|
|
|
|
|
mc:Ignorable="d">
|
|
|
|
|
<UserControl.Resources>
|
2025-09-17 13:32:29 +08:00
|
|
|
<!-- <ex:BindingProxy x:Key="proxy" Data="{Binding}" /> -->
|
|
|
|
|
<!-- <valueConverts:EnumDescriptionConverter x:Key="EnumDescriptionConverter" /> -->
|
|
|
|
|
<!-- <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" /> -->
|
|
|
|
|
<!-- -->
|
|
|
|
|
<!-- ~1~ 添加需要的转换器 @1@ -->
|
|
|
|
|
<!-- <converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" /> -->
|
|
|
|
|
<!-- <converters:CountToVisibilityConverter x:Key="CountToVisibilityConverter" /> -->
|
|
|
|
|
<!-- <converters:BoolToStringConverter x:Key="BoolToStringConverter" /> -->
|
|
|
|
|
<!-- <converters:BoolToColorConverter x:Key="BoolToColorConverter" /> -->
|
|
|
|
|
<!-- <converters:NullToVisibilityConverter x:Key="NullToVisibilityConverter" /> -->
|
2025-09-11 11:04:07 +08:00
|
|
|
</UserControl.Resources>
|
|
|
|
|
|
|
|
|
|
<DockPanel>
|
2025-10-03 23:06:04 +08:00
|
|
|
<Border DockPanel.Dock="Top" Margin="20,10" Padding="15">
|
2025-10-03 22:28:58 +08:00
|
|
|
|
|
|
|
|
<Grid>
|
|
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
|
<ColumnDefinition Width="Auto"/>
|
|
|
|
|
<ColumnDefinition Width="*"/>
|
|
|
|
|
</Grid.ColumnDefinitions>
|
2025-09-17 13:32:29 +08:00
|
|
|
|
2025-10-03 22:28:58 +08:00
|
|
|
<!-- 返回变量表按钮 -->
|
|
|
|
|
<Button Grid.Column="0"
|
|
|
|
|
Command="{Binding NavigateToVariableTableCommand}"
|
2025-10-03 23:06:04 +08:00
|
|
|
Style="{StaticResource ButtonDefault}"
|
|
|
|
|
ToolTip="返回变量表"
|
|
|
|
|
Margin="0,0,10,0">
|
|
|
|
|
<Button.Content>
|
|
|
|
|
<StackPanel Orientation="Horizontal">
|
|
|
|
|
<ui:FontIcon
|
|
|
|
|
Icon="{x:Static ui:SegoeFluentIcons.ArrowLeft8}" />
|
|
|
|
|
</StackPanel>
|
|
|
|
|
</Button.Content>
|
|
|
|
|
</Button>
|
2025-09-17 13:32:29 +08:00
|
|
|
|
2025-10-03 22:28:58 +08:00
|
|
|
<!-- 操作菜单栏 -->
|
|
|
|
|
<ui:CommandBar Grid.Column="1"
|
|
|
|
|
DefaultLabelPosition="Right"
|
|
|
|
|
IsOpen="False"
|
|
|
|
|
HorizontalAlignment="Right">
|
|
|
|
|
<!-- 重新加载 -->
|
|
|
|
|
<ui:AppBarButton Command="{Binding ReloadCommand}" Label="重新加载">
|
|
|
|
|
<ui:AppBarButton.Icon>
|
|
|
|
|
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Refresh}" />
|
|
|
|
|
</ui:AppBarButton.Icon>
|
|
|
|
|
</ui:AppBarButton>
|
|
|
|
|
|
|
|
|
|
<ui:AppBarButton x:Name="ExportButton" Label="导出">
|
|
|
|
|
<ui:AppBarButton.Icon>
|
|
|
|
|
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Save}" />
|
|
|
|
|
</ui:AppBarButton.Icon>
|
|
|
|
|
</ui:AppBarButton>
|
|
|
|
|
|
|
|
|
|
<ui:AppBarButton x:Name="ShareButton" Label="分享">
|
|
|
|
|
<ui:AppBarButton.Icon>
|
|
|
|
|
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Share}" />
|
|
|
|
|
</ui:AppBarButton.Icon>
|
|
|
|
|
</ui:AppBarButton>
|
|
|
|
|
|
|
|
|
|
<ui:CommandBar.SecondaryCommands>
|
|
|
|
|
<ui:AppBarButton
|
|
|
|
|
x:Name="SettingsButton"
|
|
|
|
|
Icon="Setting"
|
|
|
|
|
Label="设置" />
|
|
|
|
|
</ui:CommandBar.SecondaryCommands>
|
|
|
|
|
</ui:CommandBar>
|
|
|
|
|
</Grid>
|
|
|
|
|
</Border>
|
|
|
|
|
|
|
|
|
|
<!-- 时间范围选择器和详细信息区域 -->
|
|
|
|
|
<Border DockPanel.Dock="Top"
|
|
|
|
|
Background="White"
|
|
|
|
|
BorderBrush="#E0E0E0"
|
|
|
|
|
BorderThickness="1"
|
|
|
|
|
CornerRadius="8"
|
|
|
|
|
Margin="20,10"
|
|
|
|
|
Padding="15">
|
|
|
|
|
<Border.Effect>
|
|
|
|
|
<DropShadowEffect ShadowDepth="2"
|
|
|
|
|
BlurRadius="5"
|
|
|
|
|
Opacity="0.1"
|
|
|
|
|
Color="#888888"/>
|
|
|
|
|
</Border.Effect>
|
2025-09-12 08:35:35 +08:00
|
|
|
|
2025-10-03 22:28:58 +08:00
|
|
|
<ikw:SimpleStackPanel Spacing="15">
|
|
|
|
|
<!-- 时间范围选择 -->
|
|
|
|
|
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="10">
|
|
|
|
|
<TextBlock Text="开始时间:"
|
|
|
|
|
VerticalAlignment="Center"
|
|
|
|
|
Foreground="#666666"
|
|
|
|
|
FontSize="14"/>
|
|
|
|
|
<hc:DateTimePicker Width="200" SelectedDateTime="{Binding StartTime}" />
|
2025-09-17 13:32:29 +08:00
|
|
|
|
2025-10-03 22:28:58 +08:00
|
|
|
<TextBlock Text="结束时间:"
|
|
|
|
|
VerticalAlignment="Center"
|
|
|
|
|
Foreground="#666666"
|
|
|
|
|
FontSize="14"
|
|
|
|
|
Margin="10,0,0,0"/>
|
|
|
|
|
<hc:DateTimePicker Width="200" SelectedDateTime="{Binding EndTime}" />
|
|
|
|
|
|
|
|
|
|
<Button Content="重新加载"
|
|
|
|
|
Command="{Binding ReloadCommand}"
|
|
|
|
|
Style="{StaticResource ButtonPrimary}"
|
|
|
|
|
Margin="10,0,0,0"/>
|
2025-09-12 08:35:35 +08:00
|
|
|
</ikw:SimpleStackPanel>
|
2025-10-03 22:28:58 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
</ikw:SimpleStackPanel>
|
|
|
|
|
</Border>
|
2025-09-11 11:04:07 +08:00
|
|
|
|
2025-09-17 14:13:48 +08:00
|
|
|
<!-- 变量历史记录列表和图表 -->
|
2025-09-22 06:24:08 +08:00
|
|
|
<TabControl Margin="20">
|
|
|
|
|
<TabItem Header="数据表格">
|
|
|
|
|
<ui:TabItemHelper.Icon>
|
|
|
|
|
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Settings}"/>
|
|
|
|
|
</ui:TabItemHelper.Icon>
|
2025-09-17 14:13:48 +08:00
|
|
|
<DataGrid
|
|
|
|
|
AutoGenerateColumns="False"
|
|
|
|
|
CanUserDeleteRows="False"
|
|
|
|
|
CanUserSortColumns="True"
|
|
|
|
|
IsReadOnly="True"
|
|
|
|
|
ItemsSource="{Binding VariableHistories}"
|
|
|
|
|
SelectionMode="Single"
|
|
|
|
|
Style="{StaticResource DataGridBaseStyle}">
|
|
|
|
|
<DataGrid.Columns>
|
2025-10-03 11:58:15 +08:00
|
|
|
<DataGridTextColumn Binding="{Binding Value}" Header="{Binding DataContext.CurrentVariable.Name, RelativeSource={RelativeSource AncestorType=UserControl}, FallbackValue='值'}" />
|
2025-09-17 14:13:48 +08:00
|
|
|
<DataGridTextColumn
|
|
|
|
|
Binding="{Binding Timestamp, StringFormat='{}{0:yyyy-MM-dd HH:mm:ss}'}"
|
|
|
|
|
Header="时间戳"
|
|
|
|
|
IsReadOnly="True" />
|
|
|
|
|
</DataGrid.Columns>
|
|
|
|
|
</DataGrid>
|
2025-09-22 06:24:08 +08:00
|
|
|
</TabItem>
|
|
|
|
|
<TabItem Header="数据图表">
|
|
|
|
|
<ui:TabItemHelper.Icon>
|
|
|
|
|
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Settings}"/>
|
|
|
|
|
</ui:TabItemHelper.Icon>
|
|
|
|
|
<lvc:CartesianChart ZoomMode="X" Series="{Binding LineSeriesCollection}"
|
|
|
|
|
XAxes="{Binding LineAxisX}"
|
|
|
|
|
YAxes="{Binding LineAxisY}"
|
|
|
|
|
Margin="10"/>
|
|
|
|
|
</TabItem>
|
|
|
|
|
</TabControl>
|
2025-09-11 11:04:07 +08:00
|
|
|
</DockPanel>
|
|
|
|
|
</UserControl>
|