- Replace LCD-style readings with a 3×2 KPI tile grid (Fluent card surfaces, 52pt values) - Add persistent top connection strip with horizontal chips + pump name badge - Add elapsed test timer (DispatcherTimer, mm:ss) to Test Summary card - Restyle Test Summary and Active Alarms with Fluent brushes/iconography - Add Devices column (CAN / K-Line / Bench tiles) between KPI grid and test/alarms - Enumerates attached PCAN USB channels via PCAN_ATTACHED_CHANNELS API - Enumerates FTDI K-Line adapters via existing FtdiInterface helpers - Click to connect/disconnect; confirmation dialog when session active or test running - Hover tint: blue = will connect, red = will disconnect; Bench row is read-only stub - Extend ICanService with SelectedChannel + EnumerateAttachedChannels() - Expose IKwpService.ConnectedPort for active session device tracking - Add DeviceRow button style with MultiDataTrigger hover colour logic - Add 30+ new localization keys (ES + EN) for KPI labels, devices, confirmations Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
347 lines
23 KiB
XML
347 lines
23 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"/>
|
|
|
|
<!-- ── 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,4,0"/>
|
|
|
|
<!-- Devices column: CAN / K-Line / Bench device tiles -->
|
|
<uc:DashboardDevicesView Grid.Column="1" Margin="4,0,4,0"/>
|
|
|
|
<!-- Right column: test summary + alarms -->
|
|
<Grid Grid.Column="2" Margin="4,0,0,0">
|
|
<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>
|
|
|
|
<!-- Start Test -->
|
|
<ui:Button DockPanel.Dock="Left"
|
|
Appearance="Primary"
|
|
Content="{DynamicResource Dashboard.Action.StartTest}"
|
|
Command="{Binding Root.StartTestCommand}"
|
|
MinWidth="160" Height="46"
|
|
Margin="0,0,8,0"
|
|
ToolTipService.ShowOnDisabled="True"
|
|
ToolTip="{DynamicResource Dashboard.Action.StartTest.Tip}">
|
|
<ui:Button.Icon>
|
|
<ui:SymbolIcon Symbol="PlayCircle24"/>
|
|
</ui:Button.Icon>
|
|
</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>
|