2026-06-30 12:10:29 +08:00
|
|
|
<UserControl x:Class="SSPCTester.UI.Views.BasicTestView"
|
|
|
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
|
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
|
|
|
xmlns:vm="clr-namespace:SSPCTester.UI.ViewModels"
|
|
|
|
|
xmlns:m="clr-namespace:SSPCTester.Logic.Models;assembly=SSPCTester.Logic"
|
|
|
|
|
xmlns:svc="clr-namespace:SSPCTester.UI.Services"
|
|
|
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
|
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
|
|
|
mc:Ignorable="d"
|
|
|
|
|
d:DataContext="{d:DesignInstance Type=vm:BasicTestViewModel}">
|
|
|
|
|
<Grid Margin="20">
|
|
|
|
|
<Grid.RowDefinitions>
|
|
|
|
|
<RowDefinition Height="Auto" />
|
|
|
|
|
<RowDefinition Height="3*" MinHeight="260" />
|
|
|
|
|
<RowDefinition Height="*" MinHeight="140" />
|
|
|
|
|
</Grid.RowDefinitions>
|
|
|
|
|
|
|
|
|
|
<!-- 顶部:统计条 + 操作 -->
|
|
|
|
|
<Border Style="{StaticResource Card}" Margin="0,0,0,12">
|
|
|
|
|
<Grid>
|
|
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
|
<ColumnDefinition Width="*" />
|
|
|
|
|
<ColumnDefinition Width="Auto" />
|
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
|
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
|
|
|
|
<Border Style="{StaticResource StatusBadge}" Background="{StaticResource NeutralSoftBrush}" Margin="0,0,8,0">
|
|
|
|
|
<TextBlock>
|
|
|
|
|
<Run Text="已完成 " Foreground="{StaticResource TextSecondaryBrush}" />
|
|
|
|
|
<Run Text="{Binding PassCount, Mode=OneWay}" FontWeight="Bold" />
|
|
|
|
|
<Run Text=" / " Foreground="{StaticResource TextMutedBrush}" />
|
|
|
|
|
<Run Text="{Binding Total, Mode=OneWay}" />
|
|
|
|
|
</TextBlock>
|
|
|
|
|
</Border>
|
|
|
|
|
<Border Style="{StaticResource StatusBadge}" Background="{StaticResource SuccessSoftBrush}" Margin="0,0,8,0">
|
|
|
|
|
<TextBlock>
|
|
|
|
|
<Ellipse Width="6" Height="6" Fill="{StaticResource SuccessBrush}" />
|
|
|
|
|
<Run Text=" 合格 " Foreground="{StaticResource SuccessBrush}" />
|
|
|
|
|
<Run Text="{Binding PassCount, Mode=OneWay}" FontWeight="Bold" Foreground="{StaticResource SuccessBrush}" />
|
|
|
|
|
</TextBlock>
|
|
|
|
|
</Border>
|
|
|
|
|
<Border Style="{StaticResource StatusBadge}" Background="{StaticResource DangerSoftBrush}" Margin="0,0,8,0">
|
|
|
|
|
<TextBlock>
|
|
|
|
|
<Run Text=" 不合格 " Foreground="{StaticResource DangerBrush}" />
|
|
|
|
|
<Run Text="{Binding FailCount, Mode=OneWay}" FontWeight="Bold" Foreground="{StaticResource DangerBrush}" />
|
|
|
|
|
</TextBlock>
|
|
|
|
|
</Border>
|
|
|
|
|
<Border Style="{StaticResource StatusBadge}" Background="{StaticResource NeutralSoftBrush}">
|
|
|
|
|
<TextBlock>
|
|
|
|
|
<Run Text=" 未测 " Foreground="{StaticResource TextSecondaryBrush}" />
|
|
|
|
|
<Run Text="{Binding UntestedCount, Mode=OneWay}" FontWeight="Bold" />
|
|
|
|
|
</TextBlock>
|
|
|
|
|
</Border>
|
|
|
|
|
</StackPanel>
|
|
|
|
|
<StackPanel Orientation="Horizontal" Grid.Column="1">
|
|
|
|
|
<TextBlock Text="刷新频率" VerticalAlignment="Center" Margin="0,0,8,0" />
|
|
|
|
|
<ComboBox Width="72"
|
|
|
|
|
ItemsSource="{Binding RefreshRatesHz}"
|
|
|
|
|
SelectedItem="{Binding SelectedRefreshRateHz}"
|
|
|
|
|
Margin="0,0,12,0">
|
|
|
|
|
<ComboBox.ItemTemplate>
|
|
|
|
|
<DataTemplate>
|
|
|
|
|
<TextBlock Text="{Binding StringFormat={}{0} Hz}" />
|
|
|
|
|
</DataTemplate>
|
|
|
|
|
</ComboBox.ItemTemplate>
|
|
|
|
|
</ComboBox>
|
|
|
|
|
<Button Content="清空结果" Command="{Binding ClearCommand}" Margin="0,0,8,0" />
|
2026-07-01 20:04:27 +08:00
|
|
|
<Button Style="{StaticResource PrimaryButton}" Content="一键测试全部" Command="{Binding RunAllCommand}" IsEnabled="{Binding CanRunAll}" Visibility="{Binding IsBatchRunning, Converter={StaticResource BoolToVis}, ConverterParameter=Invert}" />
|
2026-06-30 12:10:29 +08:00
|
|
|
<Button Style="{StaticResource DangerButton}" Content="中断批量测试" Command="{Binding CancelRunAllCommand}" Visibility="{Binding IsBatchRunning, Converter={StaticResource BoolToVis}}" />
|
|
|
|
|
</StackPanel>
|
|
|
|
|
</Grid>
|
|
|
|
|
</Border>
|
|
|
|
|
|
|
|
|
|
<!-- 24 通道表 -->
|
|
|
|
|
<DataGrid Grid.Row="1" ItemsSource="{Binding Rows}" CanUserAddRows="False">
|
|
|
|
|
<DataGrid.Columns>
|
|
|
|
|
<DataGridTextColumn Header="通道" Width="80">
|
|
|
|
|
<DataGridTextColumn.Binding>
|
|
|
|
|
<Binding Path="Channel" StringFormat="CH{0}" />
|
|
|
|
|
</DataGridTextColumn.Binding>
|
|
|
|
|
<DataGridTextColumn.ElementStyle>
|
|
|
|
|
<Style TargetType="TextBlock">
|
|
|
|
|
<Setter Property="FontWeight" Value="SemiBold" />
|
|
|
|
|
<Setter Property="HorizontalAlignment" Value="Center" />
|
|
|
|
|
<Setter Property="VerticalAlignment" Value="Center" />
|
|
|
|
|
</Style>
|
|
|
|
|
</DataGridTextColumn.ElementStyle>
|
|
|
|
|
</DataGridTextColumn>
|
|
|
|
|
<DataGridTextColumn Header="电压(V)" Width="*">
|
|
|
|
|
<DataGridTextColumn.Binding>
|
|
|
|
|
<Binding Path="VoltageOn" Converter="{StaticResource NumberOrDash}" ConverterParameter="F2" />
|
|
|
|
|
</DataGridTextColumn.Binding>
|
|
|
|
|
<DataGridTextColumn.ElementStyle>
|
|
|
|
|
<Style TargetType="TextBlock" BasedOn="{StaticResource MonoText}" />
|
|
|
|
|
</DataGridTextColumn.ElementStyle>
|
|
|
|
|
</DataGridTextColumn>
|
|
|
|
|
<DataGridTextColumn Header="电流(A)" Width="*">
|
|
|
|
|
<DataGridTextColumn.Binding>
|
|
|
|
|
<Binding Path="CurrentOn" Converter="{StaticResource NumberOrDash}" ConverterParameter="F3" />
|
|
|
|
|
</DataGridTextColumn.Binding>
|
|
|
|
|
<DataGridTextColumn.ElementStyle>
|
|
|
|
|
<Style TargetType="TextBlock" BasedOn="{StaticResource MonoText}" />
|
|
|
|
|
</DataGridTextColumn.ElementStyle>
|
|
|
|
|
</DataGridTextColumn>
|
|
|
|
|
<DataGridTemplateColumn Header="开" Width="80">
|
|
|
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
|
|
|
<DataTemplate>
|
|
|
|
|
<Button Style="{StaticResource ToggleOnButton}" Content="开"
|
|
|
|
|
Command="{Binding DataContext.TurnOnCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
|
|
|
|
CommandParameter="{Binding}" />
|
|
|
|
|
</DataTemplate>
|
|
|
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
|
|
|
</DataGridTemplateColumn>
|
|
|
|
|
<DataGridTemplateColumn Header="关" Width="80">
|
|
|
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
|
|
|
<DataTemplate>
|
|
|
|
|
<Button Style="{StaticResource ToggleOffButton}" Content="关"
|
|
|
|
|
Command="{Binding DataContext.TurnOffCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
|
|
|
|
CommandParameter="{Binding}" />
|
|
|
|
|
</DataTemplate>
|
|
|
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
|
|
|
</DataGridTemplateColumn>
|
|
|
|
|
<DataGridTemplateColumn Header="结果" Width="100">
|
|
|
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
|
|
|
<DataTemplate>
|
|
|
|
|
<Border Style="{StaticResource StatusBadge}" Background="{Binding Status, Converter={StaticResource StatusToSoftBrush}}">
|
|
|
|
|
<TextBlock Text="{Binding Status, Converter={StaticResource StatusToText}}" Foreground="{Binding Status, Converter={StaticResource StatusToBrush}}" FontSize="{StaticResource FsSmall}" />
|
|
|
|
|
</Border>
|
|
|
|
|
</DataTemplate>
|
|
|
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
|
|
|
</DataGridTemplateColumn>
|
|
|
|
|
</DataGrid.Columns>
|
|
|
|
|
</DataGrid>
|
|
|
|
|
|
|
|
|
|
<!-- 日志 -->
|
|
|
|
|
<Grid Grid.Row="2" Margin="0,12,0,0">
|
|
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
|
<ColumnDefinition Width="*" />
|
|
|
|
|
<ColumnDefinition Width="576" />
|
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
|
|
|
|
|
|
<Border Style="{StaticResource LogPanel}" Margin="0,0,12,0">
|
|
|
|
|
<DockPanel>
|
|
|
|
|
<TextBlock DockPanel.Dock="Top" Text="测试日志" FontWeight="SemiBold" Margin="0,0,0,6" />
|
|
|
|
|
<ListBox x:Name="LogList" BorderThickness="0" Background="Transparent"
|
|
|
|
|
ItemsSource="{Binding Source={x:Static svc:AppLog.Sink}, Path=Entries}">
|
|
|
|
|
<ListBox.ItemContainerStyle>
|
|
|
|
|
<Style TargetType="ListBoxItem">
|
|
|
|
|
<Setter Property="Padding" Value="0,1" />
|
|
|
|
|
<Setter Property="Background" Value="Transparent" />
|
|
|
|
|
<Setter Property="BorderThickness" Value="0" />
|
|
|
|
|
</Style>
|
|
|
|
|
</ListBox.ItemContainerStyle>
|
|
|
|
|
<ListBox.ItemTemplate>
|
|
|
|
|
<DataTemplate>
|
|
|
|
|
<StackPanel Orientation="Horizontal">
|
|
|
|
|
<TextBlock FontFamily="{StaticResource FontMono}" FontSize="{StaticResource FsSmall}"
|
|
|
|
|
Foreground="{StaticResource TextMutedBrush}" Text="{Binding TimeText}" />
|
|
|
|
|
<TextBlock Margin="10,0,0,0" Text="{Binding Message}" Foreground="{Binding Level, Converter={StaticResource LogLevelToBrush}}" />
|
|
|
|
|
</StackPanel>
|
|
|
|
|
</DataTemplate>
|
|
|
|
|
</ListBox.ItemTemplate>
|
|
|
|
|
</ListBox>
|
|
|
|
|
</DockPanel>
|
|
|
|
|
</Border>
|
|
|
|
|
|
|
|
|
|
<Border Grid.Column="1" Style="{StaticResource Card}" Padding="14">
|
|
|
|
|
<Grid>
|
|
|
|
|
<Grid.RowDefinitions>
|
|
|
|
|
<RowDefinition Height="Auto" />
|
|
|
|
|
<RowDefinition Height="*" />
|
|
|
|
|
</Grid.RowDefinitions>
|
|
|
|
|
<TextBlock Style="{StaticResource CardTitle}" Text="测试说明" />
|
|
|
|
|
<TextBox Grid.Row="1"
|
|
|
|
|
Text="{Binding Project.TestFunction.Basic, UpdateSourceTrigger=PropertyChanged}"
|
|
|
|
|
AcceptsReturn="True"
|
|
|
|
|
TextWrapping="Wrap"
|
|
|
|
|
VerticalScrollBarVisibility="Auto"
|
|
|
|
|
Height="Auto"
|
|
|
|
|
MinHeight="88"
|
|
|
|
|
Padding="8"
|
|
|
|
|
VerticalContentAlignment="Top" />
|
|
|
|
|
</Grid>
|
|
|
|
|
</Border>
|
|
|
|
|
</Grid>
|
|
|
|
|
</Grid>
|
|
|
|
|
</UserControl>
|