2026-06-30 12:10:29 +08:00
|
|
|
<UserControl x:Class="SSPCTester.UI.Views.HomeView"
|
|
|
|
|
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: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:HomeViewModel}">
|
|
|
|
|
<ScrollViewer VerticalScrollBarVisibility="Auto" Padding="24">
|
|
|
|
|
<StackPanel>
|
|
|
|
|
<Grid Margin="0,0,0,16">
|
|
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
|
<ColumnDefinition Width="*" />
|
|
|
|
|
<ColumnDefinition Width="Auto" />
|
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
|
<TextBlock Text="概览" FontSize="{StaticResource FsH1}" FontWeight="Bold" />
|
2026-07-01 20:04:27 +08:00
|
|
|
<Button Grid.Column="1" Style="{StaticResource PrimaryButton}" Content="新建项目" Command="{Binding NewProjectCommand}" />
|
2026-06-30 12:10:29 +08:00
|
|
|
</Grid>
|
|
|
|
|
|
|
|
|
|
<Border Style="{StaticResource Card}" Margin="0,0,0,16">
|
|
|
|
|
<StackPanel>
|
|
|
|
|
<TextBlock Style="{StaticResource CardTitle}" Text="最近测试记录" />
|
|
|
|
|
<DataGrid ItemsSource="{Binding Projects}" AutoGenerateColumns="False" HeadersVisibility="Column"
|
|
|
|
|
MouseDoubleClick="OnRowDouble" IsReadOnly="True" CanUserSortColumns="True">
|
|
|
|
|
<DataGrid.Columns>
|
|
|
|
|
<DataGridTextColumn Header="项目名称" Binding="{Binding Name}" Width="*" />
|
|
|
|
|
<DataGridTextColumn Header="被测件编号" Binding="{Binding Dut.SerialNumber}" Width="180">
|
|
|
|
|
<DataGridTextColumn.ElementStyle>
|
|
|
|
|
<Style TargetType="TextBlock" BasedOn="{StaticResource MonoText}" />
|
|
|
|
|
</DataGridTextColumn.ElementStyle>
|
|
|
|
|
</DataGridTextColumn>
|
|
|
|
|
<DataGridTextColumn Header="最近测试" Binding="{Binding LastTestedAt, StringFormat=yyyy-MM-dd HH:mm}" Width="160" />
|
|
|
|
|
<DataGridTemplateColumn Header="综合判定" Width="120">
|
|
|
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
|
|
|
<DataTemplate>
|
|
|
|
|
<Border Style="{StaticResource StatusBadge}" Background="{Binding OverallStatus, Converter={StaticResource StatusToSoftBrush}}">
|
|
|
|
|
<TextBlock Text="{Binding OverallStatus, Converter={StaticResource StatusToText}}" Foreground="{Binding OverallStatus, Converter={StaticResource StatusToBrush}}" FontSize="{StaticResource FsSmall}" />
|
|
|
|
|
</Border>
|
|
|
|
|
</DataTemplate>
|
|
|
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
|
|
|
</DataGridTemplateColumn>
|
|
|
|
|
<DataGridTemplateColumn Header="操作" Width="100">
|
|
|
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
|
|
|
<DataTemplate>
|
|
|
|
|
<Button Style="{StaticResource LinkButton}" Content="打开"
|
|
|
|
|
Command="{Binding DataContext.OpenProjectCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
|
|
|
|
CommandParameter="{Binding}" />
|
|
|
|
|
</DataTemplate>
|
|
|
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
|
|
|
</DataGridTemplateColumn>
|
|
|
|
|
</DataGrid.Columns>
|
|
|
|
|
</DataGrid>
|
|
|
|
|
</StackPanel>
|
|
|
|
|
</Border>
|
|
|
|
|
|
|
|
|
|
<Border Style="{StaticResource Card}" Visibility="{Binding Projects.Count, Converter={StaticResource NullToVis}, ConverterParameter=Invert, FallbackValue=Collapsed}">
|
|
|
|
|
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Margin="40">
|
|
|
|
|
<TextBlock Text="暂无项目" FontSize="{StaticResource FsH2}" Foreground="{StaticResource TextSecondaryBrush}" HorizontalAlignment="Center" />
|
2026-07-01 20:04:27 +08:00
|
|
|
<Button Style="{StaticResource PrimaryButton}" Content="新建项目" Command="{Binding NewProjectCommand}" Margin="0,12,0,0" HorizontalAlignment="Center" />
|
2026-06-30 12:10:29 +08:00
|
|
|
</StackPanel>
|
|
|
|
|
</Border>
|
|
|
|
|
</StackPanel>
|
|
|
|
|
</ScrollViewer>
|
|
|
|
|
</UserControl>
|