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"
|
|
|
|
|
d:DataContext="{d:DesignInstance vm:VariableHistoryViewModel}"
|
|
|
|
|
d:DesignHeight="600"
|
|
|
|
|
d:DesignWidth="800"
|
|
|
|
|
mc:Ignorable="d">
|
|
|
|
|
<UserControl.Resources>
|
|
|
|
|
<ex:BindingProxy x:Key="proxy" Data="{Binding}" />
|
|
|
|
|
<valueConverts:EnumDescriptionConverter x:Key="EnumDescriptionConverter" />
|
|
|
|
|
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
|
|
|
|
|
|
|
|
|
<!-- 标签字体的样式 -->
|
|
|
|
|
<Style x:Key="VarHistoryLabelStyle" TargetType="TextBlock">
|
|
|
|
|
<Setter Property="Foreground" Value="{DynamicResource SecondaryTextBrush}" />
|
|
|
|
|
<Setter Property="FontSize" Value="14" />
|
|
|
|
|
<Setter Property="VerticalAlignment" Value="Center" />
|
|
|
|
|
</Style>
|
|
|
|
|
<!-- 值字体的样式 -->
|
|
|
|
|
<Style x:Key="VarHistoryValueStyle" TargetType="TextBlock">
|
|
|
|
|
<Setter Property="FontWeight" Value="Bold" />
|
|
|
|
|
<Setter Property="FontSize" Value="14" />
|
|
|
|
|
<Setter Property="MinWidth" Value="100" />
|
|
|
|
|
<Setter Property="VerticalAlignment" Value="Center" />
|
|
|
|
|
</Style>
|
|
|
|
|
</UserControl.Resources>
|
|
|
|
|
|
|
|
|
|
<DockPanel>
|
|
|
|
|
<ikw:SimpleStackPanel Margin="10" DockPanel.Dock="Top">
|
2025-09-11 18:09:35 +08:00
|
|
|
<!-- 搜索区域 -->
|
|
|
|
|
<GroupBox Header="搜索条件">
|
2025-09-11 11:04:07 +08:00
|
|
|
<ikw:SimpleStackPanel Margin="5" Spacing="10">
|
|
|
|
|
<ikw:SimpleStackPanel
|
2025-09-11 18:09:35 +08:00
|
|
|
HorizontalAlignment="Left"
|
2025-09-11 11:04:07 +08:00
|
|
|
Orientation="Horizontal"
|
|
|
|
|
Spacing="10">
|
|
|
|
|
<TextBlock Style="{StaticResource VarHistoryLabelStyle}" Text="搜索变量:" />
|
2025-09-11 18:09:35 +08:00
|
|
|
<ui:AutoSuggestBox
|
2025-09-12 08:35:35 +08:00
|
|
|
x:Name="SearchAutoSuggestBox"
|
2025-09-11 11:04:07 +08:00
|
|
|
Width="200"
|
|
|
|
|
ui:ControlHelper.PlaceholderText="搜索变量..."
|
2025-09-11 18:09:35 +08:00
|
|
|
Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged}"
|
|
|
|
|
ItemsSource="{Binding SuggestedVariables}"
|
|
|
|
|
DisplayMemberPath="VariableName"
|
|
|
|
|
IsSuggestionListOpen="{Binding IsSuggestionListOpen, Mode=TwoWay}"
|
|
|
|
|
TextMemberPath="VariableName" />
|
2025-09-11 11:04:07 +08:00
|
|
|
</ikw:SimpleStackPanel>
|
|
|
|
|
</ikw:SimpleStackPanel>
|
|
|
|
|
</GroupBox>
|
2025-09-12 08:35:35 +08:00
|
|
|
|
|
|
|
|
<!-- 时间范围和详细信息区域 -->
|
|
|
|
|
<GroupBox Header="详细信息">
|
|
|
|
|
<ikw:SimpleStackPanel Margin="5" Spacing="10">
|
|
|
|
|
<!-- 变量详细信息 -->
|
|
|
|
|
<Grid>
|
|
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
|
<ColumnDefinition Width="Auto" />
|
|
|
|
|
<ColumnDefinition Width="*" />
|
|
|
|
|
<ColumnDefinition Width="Auto" />
|
|
|
|
|
<ColumnDefinition Width="*" />
|
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
|
<Grid.RowDefinitions>
|
|
|
|
|
<RowDefinition Height="Auto" />
|
|
|
|
|
<RowDefinition Height="Auto" />
|
|
|
|
|
</Grid.RowDefinitions>
|
|
|
|
|
|
|
|
|
|
<TextBlock Grid.Row="0" Grid.Column="0" Style="{StaticResource VarHistoryLabelStyle}" Text="变量ID:" />
|
|
|
|
|
<TextBlock Grid.Row="0" Grid.Column="1" Style="{StaticResource VarHistoryValueStyle}" Text="{Binding SelectedVariable.Id}" />
|
|
|
|
|
|
|
|
|
|
<TextBlock Grid.Row="0" Grid.Column="2" Style="{StaticResource VarHistoryLabelStyle}" Text="变量名:" />
|
|
|
|
|
<TextBlock Grid.Row="0" Grid.Column="3" Style="{StaticResource VarHistoryValueStyle}" Text="{Binding SelectedVariable.VariableName}" />
|
|
|
|
|
|
|
|
|
|
<TextBlock Grid.Row="1" Grid.Column="0" Style="{StaticResource VarHistoryLabelStyle}" Text="当前值:" />
|
|
|
|
|
<TextBlock Grid.Row="1" Grid.Column="1" Style="{StaticResource VarHistoryValueStyle}" Text="{Binding SelectedVariable.Value}" />
|
|
|
|
|
|
|
|
|
|
<TextBlock Grid.Row="1" Grid.Column="2" Style="{StaticResource VarHistoryLabelStyle}" Text="更新时间:" />
|
|
|
|
|
<TextBlock Grid.Row="1" Grid.Column="3" Style="{StaticResource VarHistoryValueStyle}" Text="{Binding SelectedVariable.Timestamp, StringFormat='{}{0:yyyy-MM-dd HH:mm:ss.fff}'}" />
|
|
|
|
|
</Grid>
|
|
|
|
|
|
|
|
|
|
<!-- 时间范围选择 -->
|
|
|
|
|
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="10">
|
|
|
|
|
<TextBlock Style="{StaticResource VarHistoryLabelStyle}" Text="开始时间:" />
|
|
|
|
|
<hc:DateTimePicker Width="200" SelectedDateTime="{Binding StartTime}" />
|
|
|
|
|
|
|
|
|
|
<TextBlock Style="{StaticResource VarHistoryLabelStyle}" Text="结束时间:" />
|
|
|
|
|
<hc:DateTimePicker Width="200" SelectedDateTime="{Binding EndTime}" />
|
|
|
|
|
|
|
|
|
|
<Button Content="重新加载" Command="{Binding ReloadCommand}" />
|
|
|
|
|
</ikw:SimpleStackPanel>
|
|
|
|
|
</ikw:SimpleStackPanel>
|
|
|
|
|
</GroupBox>
|
2025-09-11 11:04:07 +08:00
|
|
|
</ikw:SimpleStackPanel>
|
|
|
|
|
|
|
|
|
|
<DataGrid
|
|
|
|
|
Margin="10"
|
|
|
|
|
AutoGenerateColumns="False"
|
|
|
|
|
CanUserDeleteRows="False"
|
|
|
|
|
CanUserSortColumns="False"
|
|
|
|
|
IsReadOnly="True"
|
|
|
|
|
ItemsSource="{Binding VariableHistories}"
|
2025-09-12 08:35:35 +08:00
|
|
|
SelectedItem="{Binding SelectedVariable}"
|
2025-09-11 11:04:07 +08:00
|
|
|
SelectionMode="Single"
|
|
|
|
|
Style="{StaticResource DataGridBaseStyle}">
|
|
|
|
|
<DataGrid.Columns>
|
2025-09-11 18:09:35 +08:00
|
|
|
<DataGridTextColumn Binding="{Binding VariableName}" Header="变量名" />
|
2025-09-11 11:04:07 +08:00
|
|
|
<DataGridTextColumn Binding="{Binding Value}" Header="值" />
|
|
|
|
|
<DataGridTextColumn
|
|
|
|
|
Binding="{Binding Timestamp, StringFormat='{}{0:yyyy-MM-dd HH:mm:ss.fff}'}"
|
|
|
|
|
Header="时间戳"
|
|
|
|
|
IsReadOnly="True" />
|
|
|
|
|
</DataGrid.Columns>
|
|
|
|
|
</DataGrid>
|
|
|
|
|
</DockPanel>
|
|
|
|
|
</UserControl>
|