179 lines
8.9 KiB
XML
179 lines
8.9 KiB
XML
<UserControl x:Class="CurveModule.Views.CurveRecallView"
|
||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||
xmlns:prism="http://prismlibrary.com/"
|
||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||
xmlns:oxy="http://oxyplot.org/wpf"
|
||
xmlns:converters="clr-namespace:UIShare.Converters;assembly=UIShare"
|
||
prism:ViewModelLocator.AutoWireViewModel="True"
|
||
mc:Ignorable="d"
|
||
d:DesignHeight="700"
|
||
d:DesignWidth="1200">
|
||
<i:Interaction.Triggers>
|
||
<i:EventTrigger EventName="Loaded">
|
||
<i:InvokeCommandAction Command="{Binding LoadCommand}"/>
|
||
</i:EventTrigger>
|
||
</i:Interaction.Triggers>
|
||
<UserControl.Resources>
|
||
<converters:LessThanConverter x:Key="LessThanConverter"/>
|
||
</UserControl.Resources>
|
||
|
||
<Border Background="#F5F7FA">
|
||
<Grid x:Name="RootGrid" Margin="8">
|
||
<Grid.RowDefinitions>
|
||
<RowDefinition Height="Auto"/>
|
||
<RowDefinition Height="Auto"/>
|
||
<RowDefinition Height="*"/>
|
||
<RowDefinition Height="Auto"/>
|
||
</Grid.RowDefinitions>
|
||
|
||
<!-- Row0:标题 -->
|
||
<TextBlock Grid.Row="0"
|
||
Text="曲线回读"
|
||
FontSize="20" FontWeight="Bold"
|
||
Margin="4,0,0,8"/>
|
||
|
||
<!-- Row1:工具栏 -->
|
||
<Border Grid.Row="1"
|
||
Background="White"
|
||
BorderBrush="#DDD" BorderThickness="1"
|
||
CornerRadius="4" Padding="8" Margin="0,0,0,6">
|
||
<StackPanel Orientation="Horizontal">
|
||
<Button Content="📂 加载 CSV"
|
||
Command="{Binding LoadCsvCommand}"
|
||
Padding="12,4"/>
|
||
<Button Content="↺ 复原视图"
|
||
Command="{Binding ResetViewCommand}"
|
||
Padding="12,4" Margin="6,0,0,0"
|
||
ToolTip="按数据范围重置坐标轴缩放/平移"/>
|
||
<Button Content="✕ 清空"
|
||
Command="{Binding ClearCommand}"
|
||
Padding="12,4" Margin="6,0,0,0"
|
||
ToolTip="清空已加载的曲线数据"/>
|
||
<Button Content="∑ 数学统计"
|
||
Command="{Binding StatisticsCommand}"
|
||
Padding="12,4" Margin="6,0,0,0"
|
||
ToolTip="对每条曲线计算最大值、最小值、平均值、斜率、积分"/>
|
||
<Button Content=" 保存"
|
||
Command="{Binding SaveCommand}"
|
||
Padding="12,4" Margin="6,0,0,0"
|
||
ToolTip="保存配置"/>
|
||
<Button Content="{Binding CaptureButtonText}"
|
||
Command="{Binding CaptureCommand}"
|
||
Padding="12,4" Margin="6,0,0,0"
|
||
ToolTip="添加双光标选择时间范围,导出选定范围的 CSV"/>
|
||
<Button Click="Button_Click" Content="截图" Margin="6,0,0,0"/>
|
||
</StackPanel>
|
||
</Border>
|
||
|
||
<!-- Row2:主体 -->
|
||
<Grid Grid.Row="2">
|
||
<Grid.ColumnDefinitions>
|
||
<ColumnDefinition>
|
||
<ColumnDefinition.Style>
|
||
<Style TargetType="ColumnDefinition">
|
||
<Setter Property="Width" Value="260"/>
|
||
<Style.Triggers>
|
||
<DataTrigger Binding="{Binding ActualWidth, ElementName=RootGrid, Converter={StaticResource LessThanConverter}, ConverterParameter=600}" Value="True">
|
||
<Setter Property="Width" Value="0"/>
|
||
</DataTrigger>
|
||
</Style.Triggers>
|
||
</Style>
|
||
</ColumnDefinition.Style>
|
||
</ColumnDefinition>
|
||
<ColumnDefinition>
|
||
<ColumnDefinition.Style>
|
||
<Style TargetType="ColumnDefinition">
|
||
<Setter Property="Width" Value="6"/>
|
||
<Style.Triggers>
|
||
<DataTrigger Binding="{Binding ActualWidth, ElementName=RootGrid, Converter={StaticResource LessThanConverter}, ConverterParameter=600}" Value="True">
|
||
<Setter Property="Width" Value="0"/>
|
||
</DataTrigger>
|
||
</Style.Triggers>
|
||
</Style>
|
||
</ColumnDefinition.Style>
|
||
</ColumnDefinition>
|
||
<ColumnDefinition Width="*"/>
|
||
</Grid.ColumnDefinitions>
|
||
|
||
<!-- 左侧:通道列表 -->
|
||
<Border Grid.Column="0"
|
||
Background="White"
|
||
BorderBrush="#DDD" BorderThickness="1"
|
||
CornerRadius="4">
|
||
<Grid>
|
||
<Grid.RowDefinitions>
|
||
<RowDefinition Height="Auto"/>
|
||
<RowDefinition Height="*"/>
|
||
<RowDefinition Height="Auto"/>
|
||
</Grid.RowDefinitions>
|
||
|
||
<Border Grid.Row="0" Background="#ECEFF4" Padding="8,4">
|
||
<TextBlock Text="曲线通道(勾选显示/隐藏)" FontWeight="Bold"/>
|
||
</Border>
|
||
|
||
<ListBox Grid.Row="1"
|
||
ItemsSource="{Binding Channels}"
|
||
SelectedItem="{Binding SelectedChannel}"
|
||
BorderThickness="0">
|
||
<ListBox.ItemTemplate>
|
||
<DataTemplate>
|
||
<StackPanel Margin="2">
|
||
<DockPanel>
|
||
<CheckBox IsChecked="{Binding IsDisplayed}"
|
||
VerticalAlignment="Center"
|
||
ToolTip="勾选=在图表上显示,取消=隐藏"/>
|
||
<Border Width="10" Height="10"
|
||
CornerRadius="2"
|
||
VerticalAlignment="Center"
|
||
Margin="4,0,6,0">
|
||
<Border.Background>
|
||
<SolidColorBrush Color="SteelBlue"/>
|
||
</Border.Background>
|
||
</Border>
|
||
<TextBlock Text="{Binding DisplayName}"
|
||
VerticalAlignment="Center"
|
||
TextTrimming="CharacterEllipsis"/>
|
||
</DockPanel>
|
||
</StackPanel>
|
||
</DataTemplate>
|
||
</ListBox.ItemTemplate>
|
||
</ListBox>
|
||
|
||
<TextBlock Grid.Row="2"
|
||
Text="{Binding StatusMessage}"
|
||
FontSize="11" Foreground="#666"
|
||
Margin="4,2" TextWrapping="Wrap"/>
|
||
</Grid>
|
||
</Border>
|
||
|
||
<GridSplitter Grid.Column="1"
|
||
HorizontalAlignment="Stretch"
|
||
Background="Transparent"/>
|
||
|
||
<!-- 右侧:OxyPlot 图表 -->
|
||
<Border Grid.Column="2"
|
||
Background="White"
|
||
BorderBrush="#DDD" BorderThickness="1"
|
||
CornerRadius="4">
|
||
<oxy:PlotView Model="{Binding Plot}"
|
||
x:Name="Chart"
|
||
Background="Transparent"/>
|
||
</Border>
|
||
</Grid>
|
||
|
||
<!-- Row3:状态栏 -->
|
||
<Border Grid.Row="3"
|
||
Background="#ECEFF4"
|
||
Padding="8,4" Margin="0,6,0,0"
|
||
CornerRadius="2">
|
||
<TextBlock Text="{Binding StatusMessage}"
|
||
Foreground="#444"
|
||
FontSize="12"/>
|
||
</Border>
|
||
</Grid>
|
||
</Border>
|
||
</UserControl>
|