Bundles several feature streams that have been iterating on the working tree: - Developer Tools page (Debug-only via DEVELOPER_TOOLS symbol): hosts the identification card, manual KWP write + transaction log, ROM/EEPROM dump card with progress banner and completion message, persisted custom-commands library, persisted EEPROM passwords library. New service primitives: IKwpService.SendRawCustomAsync / ReadEepromAsync / ReadRomEepromAsync. Persistence mirrors the Clients XML pattern in two new files (custom_commands.xml, eeprom_passwords.xml). - Auto-test orchestrator (IAutoTestOrchestrator + AutoTestState): linear K-Line read -> unlock -> bench-on -> test sequence with snackbar UI and progress dialog VM, gated on dashboard alarms. - BIP-STATUS display: BipDisplayViewModel + BipDisplayView, RAM read at 0x0106 via IKwpService.ReadBipStatusAsync; status definitions in BipStatusDefinition. - Tests page redesign: TestSectionCard + PhaseTileView replacing the old TestPlanView/TestRunningView/TestDoneView/TestPreconditionsView/ TestSectionView controls and their VMs. - Pump command sliders: Fluent thick-track style with overhang thumb, click-anywhere-and-drag, mouse-wheel adjustment. - Window startup: app.manifest declares PerMonitorV2 DPI awareness, MainWindow installs a WM_GETMINMAXINFO hook in OnSourceInitialized and maximizes there (after the hook is in place) so the app fits the work area exactly on any display configuration. - Misc: PercentToPixelsConverter, seed_aliases.py one-shot pump-alias importer, tools/Import-BipStatus.ps1, kline_eeprom_spec.md and dump-functions reference docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
367 lines
24 KiB
XML
367 lines
24 KiB
XML
<UserControl x:Class="HC_APTBS.Views.Pages.DashboardPage"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:uc="clr-namespace:HC_APTBS.Views.UserControls"
|
|
mc:Ignorable="d"
|
|
d:DesignHeight="860" d:DesignWidth="1740">
|
|
<!--
|
|
Dashboard — operator "at a glance" landing page.
|
|
DataContext: DashboardPageViewModel.
|
|
Layout: connection strip (top) | KPI tiles (left) + devices column (centre) + test/alarms column (right) | action bar (bottom)
|
|
Connect/Disconnect for CAN and K-Line is performed via the Devices column tiles.
|
|
-->
|
|
<UserControl.Resources>
|
|
<BooleanToVisibilityConverter x:Key="BoolToVis"/>
|
|
</UserControl.Resources>
|
|
|
|
<Grid Margin="12">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/> <!-- connection strip -->
|
|
<RowDefinition Height="*"/> <!-- main content -->
|
|
<RowDefinition Height="Auto"/> <!-- action bar -->
|
|
</Grid.RowDefinitions>
|
|
|
|
<!-- ── Row 0: Connection strip ─────────────────────────────────────── -->
|
|
<uc:DashboardConnectionView Grid.Row="0" Height="66"/>
|
|
|
|
<!-- ── Row 1: KPI grid (left) + devices column (centre) + test/alarms (right) -->
|
|
<Grid Grid.Row="1" Margin="0,0,0,8">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="2.2*"/>
|
|
<ColumnDefinition Width="0.9*" MinWidth="260"/>
|
|
<ColumnDefinition Width="1*" MinWidth="380"/>
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<!-- KPI readings grid -->
|
|
<uc:DashboardReadingsView Grid.Column="0" Margin="0,0,0,0"/>
|
|
|
|
<!-- Devices column: CAN / K-Line / Bench device tiles -->
|
|
<uc:DashboardDevicesView Grid.Column="1" Margin="4"/>
|
|
|
|
<!-- Right column: test summary + alarms -->
|
|
<Grid Grid.Column="2" Margin="4">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="*"/>
|
|
</Grid.RowDefinitions>
|
|
|
|
<!-- ── Test summary card ────────────────────────────────────── -->
|
|
<Border Grid.Row="0"
|
|
Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
|
|
BorderBrush="{DynamicResource CardStrokeColorDefaultBrush}"
|
|
BorderThickness="1" CornerRadius="8" Padding="16" Margin="0,0,0,8">
|
|
<StackPanel>
|
|
<!-- Card header -->
|
|
<DockPanel Margin="0,0,0,12">
|
|
<ui:SymbolIcon DockPanel.Dock="Left" Symbol="Timer24" FontSize="16"
|
|
Foreground="{DynamicResource AccentTextFillColorPrimaryBrush}"
|
|
Margin="0,0,8,0" VerticalAlignment="Center"/>
|
|
<TextBlock Text="{DynamicResource Dashboard.TestSummary}"
|
|
FontSize="14" FontWeight="SemiBold"
|
|
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
|
|
VerticalAlignment="Center"/>
|
|
</DockPanel>
|
|
|
|
<!-- Running view -->
|
|
<Grid Visibility="{Binding Root.IsTestRunning, Converter={StaticResource BoolToVis}}">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="Auto"/>
|
|
</Grid.RowDefinitions>
|
|
|
|
<!-- Test name + spinner -->
|
|
<DockPanel Grid.Row="0" Margin="0,0,0,8">
|
|
<ui:ProgressRing DockPanel.Dock="Right" Width="22" Height="22"
|
|
IsIndeterminate="True"
|
|
VerticalAlignment="Center" Margin="8,0,0,0"/>
|
|
<TextBlock Text="{Binding Root.TestPanel.TestName}"
|
|
FontSize="14" FontWeight="SemiBold"
|
|
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
|
|
TextTrimming="CharacterEllipsis" VerticalAlignment="Center"/>
|
|
</DockPanel>
|
|
|
|
<!-- Phase name -->
|
|
<Grid Grid.Row="1" Margin="0,0,0,6">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="*"/>
|
|
</Grid.ColumnDefinitions>
|
|
<TextBlock Text="{DynamicResource Dashboard.TestPhase}"
|
|
FontSize="12" Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
|
Margin="0,0,8,0" VerticalAlignment="Center"/>
|
|
<TextBlock Grid.Column="1" Text="{Binding Root.CurrentPhaseName}"
|
|
FontSize="12" FontWeight="SemiBold"
|
|
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
|
|
TextTrimming="CharacterEllipsis" VerticalAlignment="Center"/>
|
|
</Grid>
|
|
|
|
<!-- Elapsed timer -->
|
|
<Grid Grid.Row="2" Margin="0,0,0,8">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="*"/>
|
|
</Grid.ColumnDefinitions>
|
|
<TextBlock Text="{DynamicResource Dashboard.TestSummary.Elapsed}"
|
|
FontSize="12" Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
|
Margin="0,0,8,0" VerticalAlignment="Center"/>
|
|
<TextBlock Grid.Column="1"
|
|
Text="{Binding Root.TestElapsed, StringFormat={}{0:mm\\:ss}}"
|
|
FontSize="13" FontWeight="SemiBold" FontFamily="Consolas"
|
|
Foreground="{DynamicResource AccentTextFillColorPrimaryBrush}"
|
|
VerticalAlignment="Center"/>
|
|
</Grid>
|
|
|
|
<!-- Verbose status -->
|
|
<TextBlock Grid.Row="3" Text="{Binding Root.VerboseStatus}"
|
|
FontSize="11" FontStyle="Italic"
|
|
Foreground="{DynamicResource TextFillColorTertiaryBrush}"
|
|
TextWrapping="Wrap" MaxHeight="32"
|
|
TextTrimming="CharacterEllipsis"/>
|
|
</Grid>
|
|
|
|
<!-- Idle view -->
|
|
<StackPanel>
|
|
<StackPanel.Style>
|
|
<Style TargetType="StackPanel">
|
|
<Setter Property="Visibility" Value="Visible"/>
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding Root.IsTestRunning}" Value="True">
|
|
<Setter Property="Visibility" Value="Collapsed"/>
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</StackPanel.Style>
|
|
|
|
<TextBlock Text="{DynamicResource Dashboard.NoTestRunning}"
|
|
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
|
FontStyle="Italic" FontSize="12" Margin="0,0,0,10"/>
|
|
|
|
<!-- Last test result pill — only visible while result is unsaved -->
|
|
<Border Padding="10,6" CornerRadius="6" HorizontalAlignment="Left">
|
|
<Border.Style>
|
|
<Style TargetType="Border">
|
|
<Setter Property="Background" Value="{DynamicResource SystemFillColorCriticalBackgroundBrush}"/>
|
|
<Setter Property="Visibility" Value="Collapsed"/>
|
|
<Style.Triggers>
|
|
<MultiDataTrigger>
|
|
<MultiDataTrigger.Conditions>
|
|
<Condition Binding="{Binding Root.IsTestSaved}" Value="False"/>
|
|
</MultiDataTrigger.Conditions>
|
|
<Setter Property="Visibility" Value="Visible"/>
|
|
</MultiDataTrigger>
|
|
<DataTrigger Binding="{Binding Root.LastTestSuccess}" Value="True">
|
|
<Setter Property="Background" Value="{DynamicResource SystemFillColorSuccessBackgroundBrush}"/>
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</Border.Style>
|
|
<StackPanel Orientation="Horizontal">
|
|
<ui:SymbolIcon FontSize="14" Margin="0,0,6,0" VerticalAlignment="Center">
|
|
<ui:SymbolIcon.Style>
|
|
<Style TargetType="ui:SymbolIcon">
|
|
<Setter Property="Symbol" Value="DismissCircle24"/>
|
|
<Setter Property="Foreground" Value="{DynamicResource SystemFillColorCriticalBrush}"/>
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding Root.LastTestSuccess}" Value="True">
|
|
<Setter Property="Symbol" Value="CheckmarkCircle24"/>
|
|
<Setter Property="Foreground" Value="{DynamicResource SystemFillColorSuccessBrush}"/>
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</ui:SymbolIcon.Style>
|
|
</ui:SymbolIcon>
|
|
<TextBlock FontWeight="SemiBold" FontSize="12" VerticalAlignment="Center">
|
|
<TextBlock.Style>
|
|
<Style TargetType="TextBlock">
|
|
<Setter Property="Text" Value="{DynamicResource Dashboard.LastTestFail}"/>
|
|
<Setter Property="Foreground" Value="{DynamicResource SystemFillColorCriticalBrush}"/>
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding Root.LastTestSuccess}" Value="True">
|
|
<Setter Property="Text" Value="{DynamicResource Dashboard.LastTestPass}"/>
|
|
<Setter Property="Foreground" Value="{DynamicResource SystemFillColorSuccessBrush}"/>
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</TextBlock.Style>
|
|
</TextBlock>
|
|
</StackPanel>
|
|
</Border>
|
|
</StackPanel>
|
|
</StackPanel>
|
|
</Border>
|
|
|
|
<!-- ── Active alarms card ───────────────────────────────────── -->
|
|
<Border Grid.Row="1"
|
|
Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
|
|
BorderBrush="{DynamicResource CardStrokeColorDefaultBrush}"
|
|
BorderThickness="1" CornerRadius="8" Padding="16">
|
|
<DockPanel>
|
|
<!-- Card header -->
|
|
<DockPanel DockPanel.Dock="Top" Margin="0,0,0,12">
|
|
<ui:SymbolIcon DockPanel.Dock="Left" Symbol="AlertUrgent24" FontSize="16"
|
|
Foreground="{DynamicResource SystemFillColorCautionBrush}"
|
|
Margin="0,0,8,0" VerticalAlignment="Center"/>
|
|
<TextBlock Text="{DynamicResource Dashboard.Alarms}"
|
|
FontSize="14" FontWeight="SemiBold"
|
|
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
|
|
VerticalAlignment="Center"/>
|
|
</DockPanel>
|
|
|
|
<!-- System OK banner (no active alarms) -->
|
|
<Border DockPanel.Dock="Top"
|
|
Background="{DynamicResource SystemFillColorSuccessBackgroundBrush}"
|
|
BorderBrush="{DynamicResource SystemFillColorSuccessBrush}"
|
|
BorderThickness="1" CornerRadius="6" Padding="12,8" Margin="0,0,0,4"
|
|
Visibility="{Binding Alarms.IsClear, Converter={StaticResource BoolToVis}}">
|
|
<StackPanel Orientation="Horizontal">
|
|
<ui:SymbolIcon Symbol="CheckmarkCircle24" FontSize="16"
|
|
Foreground="{DynamicResource SystemFillColorSuccessBrush}"
|
|
Margin="0,0,8,0" VerticalAlignment="Center"/>
|
|
<TextBlock Text="{DynamicResource Dashboard.AlarmsNone}"
|
|
FontWeight="SemiBold" FontSize="12"
|
|
Foreground="{DynamicResource SystemFillColorSuccessBrush}"
|
|
VerticalAlignment="Center"/>
|
|
</StackPanel>
|
|
</Border>
|
|
|
|
<!-- Active alarm list -->
|
|
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
|
<ScrollViewer.Style>
|
|
<Style TargetType="ScrollViewer">
|
|
<Setter Property="Visibility" Value="Visible"/>
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding Alarms.IsClear}" Value="True">
|
|
<Setter Property="Visibility" Value="Collapsed"/>
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</ScrollViewer.Style>
|
|
<ItemsControl ItemsSource="{Binding Alarms.ActiveAlarms}">
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate>
|
|
<Border Margin="0,3" Padding="10,8" CornerRadius="6">
|
|
<Border.Style>
|
|
<Style TargetType="Border">
|
|
<Setter Property="Background" Value="{DynamicResource SystemFillColorCautionBackgroundBrush}"/>
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding IsCritical}" Value="True">
|
|
<Setter Property="Background" Value="{DynamicResource SystemFillColorCriticalBackgroundBrush}"/>
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</Border.Style>
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
</Grid.ColumnDefinitions>
|
|
<ui:SymbolIcon VerticalAlignment="Center" Margin="0,0,8,0">
|
|
<ui:SymbolIcon.Style>
|
|
<Style TargetType="ui:SymbolIcon">
|
|
<Setter Property="Symbol" Value="AlertOn24"/>
|
|
<Setter Property="FontSize" Value="16"/>
|
|
<Setter Property="Foreground" Value="{DynamicResource SystemFillColorCautionBrush}"/>
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding IsCritical}" Value="True">
|
|
<Setter Property="Symbol" Value="ErrorCircle24"/>
|
|
<Setter Property="Foreground" Value="{DynamicResource SystemFillColorCriticalBrush}"/>
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</ui:SymbolIcon.Style>
|
|
</ui:SymbolIcon>
|
|
<TextBlock Grid.Column="1" Text="{Binding Description}"
|
|
FontWeight="SemiBold" FontSize="12"
|
|
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
|
|
VerticalAlignment="Center" TextWrapping="Wrap"/>
|
|
<TextBlock Grid.Column="2"
|
|
FontSize="11" FontFamily="Consolas"
|
|
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
|
VerticalAlignment="Center" Margin="10,0,0,0">
|
|
<Run Text="bit "/><Run Text="{Binding Bit, Mode=OneWay}"/>
|
|
</TextBlock>
|
|
</Grid>
|
|
</Border>
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
</ScrollViewer>
|
|
</DockPanel>
|
|
</Border>
|
|
</Grid>
|
|
</Grid>
|
|
|
|
<!-- ── Row 2: Action bar ────────────────────────────────────────────── -->
|
|
<Border Grid.Row="2"
|
|
BorderBrush="{DynamicResource ControlStrokeColorDefaultBrush}"
|
|
BorderThickness="0,1,0,0" Padding="4,10">
|
|
<DockPanel LastChildFill="False">
|
|
|
|
<!-- E-Stop — pinned right, visually dominant -->
|
|
<ui:Button DockPanel.Dock="Right"
|
|
Appearance="Danger"
|
|
Content="{DynamicResource Dashboard.Action.EmergencyStop}"
|
|
Command="{Binding Root.EmergencyStopCommand}"
|
|
FontSize="15" FontWeight="Bold"
|
|
MinWidth="240" Height="50">
|
|
<ui:Button.Icon>
|
|
<ui:SymbolIcon Symbol="DismissCircle24"/>
|
|
</ui:Button.Icon>
|
|
</ui:Button>
|
|
|
|
<!-- Connect & Auto Test — transforms into Cancel while running -->
|
|
<ui:Button DockPanel.Dock="Left"
|
|
MinWidth="200" Height="46"
|
|
Margin="0,0,8,0"
|
|
ToolTipService.ShowOnDisabled="True">
|
|
<ui:Button.Style>
|
|
<Style TargetType="ui:Button" BasedOn="{StaticResource {x:Type ui:Button}}">
|
|
<!-- Default (idle): Connect & Auto Test -->
|
|
<Setter Property="Appearance" Value="Primary"/>
|
|
<Setter Property="Content" Value="{DynamicResource Dashboard.Action.AutoTest}"/>
|
|
<Setter Property="Command" Value="{Binding Root.ConnectAndAutoTestCommand}"/>
|
|
<Setter Property="ToolTip" Value="{DynamicResource Dashboard.Action.AutoTest.Tip}"/>
|
|
<Setter Property="Icon">
|
|
<Setter.Value>
|
|
<ui:SymbolIcon Symbol="Play24"/>
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Style.Triggers>
|
|
<!-- Running: swap to Cancel appearance -->
|
|
<DataTrigger Binding="{Binding Root.IsAutoTestActive}" Value="True">
|
|
<Setter Property="Appearance" Value="Caution"/>
|
|
<Setter Property="Content" Value="{DynamicResource Common.Cancel}"/>
|
|
<Setter Property="Command" Value="{Binding Root.CancelAutoTestCommand}"/>
|
|
<Setter Property="Icon">
|
|
<Setter.Value>
|
|
<ui:SymbolIcon Symbol="DismissCircle24"/>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</ui:Button.Style>
|
|
</ui:Button>
|
|
|
|
<!-- Stop -->
|
|
<ui:Button DockPanel.Dock="Left"
|
|
Appearance="Secondary"
|
|
Content="{DynamicResource Dashboard.Action.Stop}"
|
|
Command="{Binding Root.StopTestCommand}"
|
|
MinWidth="120" Height="46">
|
|
<ui:Button.Icon>
|
|
<ui:SymbolIcon Symbol="RecordStop24"/>
|
|
</ui:Button.Icon>
|
|
</ui:Button>
|
|
|
|
</DockPanel>
|
|
</Border>
|
|
</Grid>
|
|
</UserControl>
|