feat: redesign dashboard with Fluent KPI tiles, connection strip, and devices column

- 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>
This commit is contained in:
2026-04-19 22:25:00 +02:00
parent 0280a2fad1
commit 197e9d1775
26 changed files with 1638 additions and 515 deletions

View File

@@ -17,7 +17,7 @@
<ToggleButton IsChecked="{Binding BenchControl.IsDirectionRight}"
Height="32" FontSize="12" FontWeight="SemiBold">
<ToggleButton.Style>
<Style TargetType="ToggleButton">
<Style TargetType="ToggleButton" BasedOn="{StaticResource {x:Type ToggleButton}}">
<Setter Property="Content" Value="{DynamicResource Bench.Left}"/>
<Style.Triggers>
<Trigger Property="IsChecked" Value="True">
@@ -72,13 +72,13 @@
<ToggleButton IsChecked="{Binding BenchControl.IsOilPumpOn}"
Height="32" FontSize="12" FontWeight="SemiBold">
<ToggleButton.Style>
<Style TargetType="ToggleButton">
<Style TargetType="ToggleButton" BasedOn="{StaticResource FluentStateToggle}">
<Setter Property="Content" Value="{DynamicResource Bench.OilOff}"/>
<Setter Property="Background" Value="LightGray"/>
<Style.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Content" Value="{DynamicResource Bench.OilOn}"/>
<Setter Property="Background" Value="#80FF80"/>
<Setter Property="Background" Value="#26C200"/>
<Setter Property="Foreground" Value="White"/>
</Trigger>
</Style.Triggers>
</Style>

View File

@@ -1,158 +1,232 @@
<UserControl x:Class="HC_APTBS.Views.UserControls.DashboardConnectionView"
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:models="clr-namespace:HC_APTBS.Models"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:models="clr-namespace:HC_APTBS.Models"
mc:Ignorable="d"
d:DesignHeight="160" d:DesignWidth="220">
d:DesignHeight="72" d:DesignWidth="1100">
<!--
Connection status block for the Dashboard.
DataContext is DashboardPageViewModel; pills read from Root.X.
Pill uses the shared ConnIndicator style. Gray = offline, green = live, red = K-Line failed.
Connection status strip for the Dashboard — four horizontal chips + pump name badge.
DataContext is DashboardPageViewModel; reads Root.IsCanConnected, Root.IsBenchConnected,
Root.IsPumpConnected, Root.KLineState via DataTriggers.
-->
<StackPanel>
<TextBlock Text="{DynamicResource Dashboard.Connections}"
FontSize="13" FontWeight="SemiBold" Foreground="#333"
Margin="0,0,0,6"/>
<Border Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
BorderBrush="{DynamicResource CardStrokeColorDefaultBrush}"
BorderThickness="1" CornerRadius="8"
Padding="14,10" Margin="0,0,0,8">
<DockPanel LastChildFill="False">
<!-- CAN bus -->
<Grid Margin="0,2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="80"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{DynamicResource Dashboard.Conn.Can}" VerticalAlignment="Center" FontSize="12"/>
<Border Grid.Column="1" MinWidth="72" Height="22">
<Border.Style>
<Style TargetType="Border" BasedOn="{StaticResource ConnIndicator}">
<Style.Triggers>
<DataTrigger Binding="{Binding Root.IsCanConnected}" Value="True">
<Setter Property="Background" Value="#26C200"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center"
FontSize="10" FontWeight="SemiBold" Foreground="White"
Text="{DynamicResource Dashboard.StateOnline}">
<!-- ── Pump name badge (right-docked) ──────────────────────────── -->
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal" VerticalAlignment="Center" Margin="16,0,0,0">
<TextBlock Text="{DynamicResource Dashboard.Conn.Pump.Label}"
FontSize="12" Foreground="{DynamicResource TextFillColorSecondaryBrush}"
VerticalAlignment="Center" Margin="0,0,6,0"/>
<!-- Model name — shown when pump is selected -->
<TextBlock Text="{Binding Root.PumpIdentification.CurrentPump.Model}"
FontSize="13" FontWeight="SemiBold"
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
VerticalAlignment="Center">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Text" Value="{DynamicResource Dashboard.StateOffline}"/>
<Setter Property="Visibility" Value="Visible"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Root.IsCanConnected}" Value="True">
<Setter Property="Text" Value="{DynamicResource Dashboard.StateOnline}"/>
<DataTrigger Binding="{Binding Root.PumpIdentification.CurrentPump}" Value="{x:Null}">
<Setter Property="Visibility" Value="Collapsed"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Border>
</Grid>
<!-- Bench liveness -->
<Grid Margin="0,2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="80"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{DynamicResource Dashboard.Conn.Bench}" VerticalAlignment="Center" FontSize="12"/>
<Border Grid.Column="1" MinWidth="72" Height="22">
<Border.Style>
<Style TargetType="Border" BasedOn="{StaticResource ConnIndicator}">
<Style.Triggers>
<DataTrigger Binding="{Binding Root.IsBenchConnected}" Value="True">
<Setter Property="Background" Value="#26C200"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center"
FontSize="10" FontWeight="SemiBold" Foreground="White">
<!-- Placeholder — shown when no pump is selected -->
<TextBlock Text="{DynamicResource Dashboard.Conn.NoPump}"
FontSize="12" FontStyle="Italic"
Foreground="{DynamicResource TextFillColorTertiaryBrush}"
VerticalAlignment="Center">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Text" Value="{DynamicResource Dashboard.StateOffline}"/>
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Root.IsBenchConnected}" Value="True">
<Setter Property="Text" Value="{DynamicResource Dashboard.StateOnline}"/>
<DataTrigger Binding="{Binding Root.PumpIdentification.CurrentPump}" Value="{x:Null}">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Border>
</Grid>
</StackPanel>
<!-- Pump liveness -->
<Grid Margin="0,2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="80"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{DynamicResource Dashboard.Conn.Pump}" VerticalAlignment="Center" FontSize="12"/>
<Border Grid.Column="1" MinWidth="72" Height="22">
<Border.Style>
<Style TargetType="Border" BasedOn="{StaticResource ConnIndicator}">
<Style.Triggers>
<DataTrigger Binding="{Binding Root.IsPumpConnected}" Value="True">
<Setter Property="Background" Value="#26C200"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center"
FontSize="10" FontWeight="SemiBold" Foreground="White">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Text" Value="{DynamicResource Dashboard.StateOffline}"/>
<!-- ── Connection chips ─────────────────────────────────────────── -->
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<!-- CAN bus chip -->
<Border Style="{StaticResource ConnChip}">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<ui:SymbolIcon Symbol="PlugConnected24" FontSize="15"
Foreground="{DynamicResource TextFillColorSecondaryBrush}" Margin="0,0,6,0"/>
<TextBlock Text="{DynamicResource Dashboard.Conn.Can}" FontSize="12"
Foreground="{DynamicResource TextFillColorPrimaryBrush}" VerticalAlignment="Center"
Margin="0,0,10,0"/>
<Ellipse>
<Ellipse.Style>
<Style TargetType="Ellipse" BasedOn="{StaticResource StatusDot}">
<Style.Triggers>
<DataTrigger Binding="{Binding Root.IsCanConnected}" Value="True">
<Setter Property="Fill" Value="{DynamicResource SystemFillColorSuccessBrush}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Ellipse.Style>
</Ellipse>
<TextBlock FontSize="11" FontWeight="SemiBold" VerticalAlignment="Center">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Text" Value="{DynamicResource Dashboard.StateOffline}"/>
<Setter Property="Foreground" Value="{DynamicResource TextFillColorTertiaryBrush}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Root.IsCanConnected}" Value="True">
<Setter Property="Text" Value="{DynamicResource Dashboard.StateOnline}"/>
<Setter Property="Foreground" Value="{DynamicResource SystemFillColorSuccessBrush}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</StackPanel>
</Border>
<!-- Bench controller chip -->
<Border Style="{StaticResource ConnChip}">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<ui:SymbolIcon Symbol="DesktopPulse24" FontSize="15"
Foreground="{DynamicResource TextFillColorSecondaryBrush}" Margin="0,0,6,0"/>
<TextBlock Text="{DynamicResource Dashboard.Conn.Bench}" FontSize="12"
Foreground="{DynamicResource TextFillColorPrimaryBrush}" VerticalAlignment="Center"
Margin="0,0,10,0"/>
<Ellipse>
<Ellipse.Style>
<Style TargetType="Ellipse" BasedOn="{StaticResource StatusDot}">
<Style.Triggers>
<DataTrigger Binding="{Binding Root.IsBenchConnected}" Value="True">
<Setter Property="Fill" Value="{DynamicResource SystemFillColorSuccessBrush}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Ellipse.Style>
</Ellipse>
<TextBlock FontSize="11" FontWeight="SemiBold" VerticalAlignment="Center">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Text" Value="{DynamicResource Dashboard.StateOffline}"/>
<Setter Property="Foreground" Value="{DynamicResource TextFillColorTertiaryBrush}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Root.IsBenchConnected}" Value="True">
<Setter Property="Text" Value="{DynamicResource Dashboard.StateOnline}"/>
<Setter Property="Foreground" Value="{DynamicResource SystemFillColorSuccessBrush}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</StackPanel>
</Border>
<!-- Pump ECU chip -->
<Border Style="{StaticResource ConnChip}">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<ui:SymbolIcon Symbol="Server24" FontSize="15"
Foreground="{DynamicResource TextFillColorSecondaryBrush}" Margin="0,0,6,0"/>
<TextBlock Text="{DynamicResource Dashboard.Conn.Pump}" FontSize="12"
Foreground="{DynamicResource TextFillColorPrimaryBrush}" VerticalAlignment="Center"
Margin="0,0,10,0"/>
<Ellipse>
<Ellipse.Style>
<Style TargetType="Ellipse" BasedOn="{StaticResource StatusDot}">
<Style.Triggers>
<DataTrigger Binding="{Binding Root.IsPumpConnected}" Value="True">
<Setter Property="Fill" Value="{DynamicResource SystemFillColorSuccessBrush}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Ellipse.Style>
</Ellipse>
<TextBlock FontSize="11" FontWeight="SemiBold" VerticalAlignment="Center">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Text" Value="{DynamicResource Dashboard.StateOffline}"/>
<Setter Property="Foreground" Value="{DynamicResource TextFillColorTertiaryBrush}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Root.IsPumpConnected}" Value="True">
<Setter Property="Text" Value="{DynamicResource Dashboard.StateOnline}"/>
<Setter Property="Foreground" Value="{DynamicResource SystemFillColorSuccessBrush}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</StackPanel>
</Border>
<!-- K-Line session chip -->
<Border>
<Border.Style>
<Style TargetType="Border" BasedOn="{StaticResource ConnChip}">
<Style.Triggers>
<DataTrigger Binding="{Binding Root.IsPumpConnected}" Value="True">
<Setter Property="Text" Value="{DynamicResource Dashboard.StateOnline}"/>
<DataTrigger Binding="{Binding Root.KLineState}"
Value="{x:Static models:KLineConnectionState.Failed}">
<Setter Property="Background" Value="{DynamicResource SystemFillColorCautionBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource SystemFillColorCautionBrush}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Border>
</Grid>
</Border.Style>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<ui:SymbolIcon Symbol="UsbPlug24" FontSize="15"
Foreground="{DynamicResource TextFillColorSecondaryBrush}" Margin="0,0,6,0"/>
<TextBlock Text="{DynamicResource Dashboard.Conn.KLine}" FontSize="12"
Foreground="{DynamicResource TextFillColorPrimaryBrush}" VerticalAlignment="Center"
Margin="0,0,10,0"/>
<Ellipse>
<Ellipse.Style>
<Style TargetType="Ellipse" BasedOn="{StaticResource StatusDot}">
<Style.Triggers>
<DataTrigger Binding="{Binding Root.KLineState}"
Value="{x:Static models:KLineConnectionState.Connected}">
<Setter Property="Fill" Value="{DynamicResource SystemFillColorSuccessBrush}"/>
</DataTrigger>
<DataTrigger Binding="{Binding Root.KLineState}"
Value="{x:Static models:KLineConnectionState.Failed}">
<Setter Property="Fill" Value="{DynamicResource SystemFillColorCautionBrush}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Ellipse.Style>
</Ellipse>
<TextBlock FontSize="11" FontWeight="SemiBold" VerticalAlignment="Center">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Text" Value="{DynamicResource Dashboard.StateClosed}"/>
<Setter Property="Foreground" Value="{DynamicResource TextFillColorTertiaryBrush}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Root.KLineState}"
Value="{x:Static models:KLineConnectionState.Connected}">
<Setter Property="Text" Value="{DynamicResource Dashboard.StateOpen}"/>
<Setter Property="Foreground" Value="{DynamicResource SystemFillColorSuccessBrush}"/>
</DataTrigger>
<DataTrigger Binding="{Binding Root.KLineState}"
Value="{x:Static models:KLineConnectionState.Failed}">
<Setter Property="Text" Value="{DynamicResource Dashboard.StateFailed}"/>
<Setter Property="Foreground" Value="{DynamicResource SystemFillColorCautionBrush}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</StackPanel>
</Border>
<!-- K-Line session -->
<Grid Margin="0,2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="80"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{DynamicResource Dashboard.Conn.KLine}" VerticalAlignment="Center" FontSize="12"/>
<Border Grid.Column="1" MinWidth="72" Height="22">
<Border.Style>
<Style TargetType="Border" BasedOn="{StaticResource ConnIndicator}">
<Style.Triggers>
<DataTrigger Binding="{Binding Root.KLineState}" Value="{x:Static models:KLineConnectionState.Connected}">
<Setter Property="Background" Value="#26C200"/>
</DataTrigger>
<DataTrigger Binding="{Binding Root.KLineState}" Value="{x:Static models:KLineConnectionState.Failed}">
<Setter Property="Background" Value="#FF3333"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center"
FontSize="10" FontWeight="SemiBold" Foreground="White">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Text" Value="{DynamicResource Dashboard.StateClosed}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Root.KLineState}" Value="{x:Static models:KLineConnectionState.Connected}">
<Setter Property="Text" Value="{DynamicResource Dashboard.StateOpen}"/>
</DataTrigger>
<DataTrigger Binding="{Binding Root.KLineState}" Value="{x:Static models:KLineConnectionState.Failed}">
<Setter Property="Text" Value="{DynamicResource Dashboard.StateFailed}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Border>
</Grid>
</StackPanel>
</StackPanel>
</DockPanel>
</Border>
</UserControl>

View File

@@ -0,0 +1,272 @@
<UserControl x:Class="HC_APTBS.Views.UserControls.DashboardDevicesView"
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:vm="clr-namespace:HC_APTBS.ViewModels.Pages"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="600" d:DesignWidth="280">
<!--
Devices column — three equal-height tiles (CAN / K-Line / Bench).
DataContext is DashboardPageViewModel; all commands/collections are under Devices.
-->
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- ── CAN tile ─────────────────────────────────────────────────────── -->
<Border Grid.Row="0" Style="{StaticResource KpiTile}" Margin="0,0,0,4">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Tile header -->
<DockPanel Grid.Row="0" Margin="0,0,0,8">
<ui:SymbolIcon DockPanel.Dock="Left" Symbol="PlugConnected24" FontSize="14"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Margin="0,0,6,0" VerticalAlignment="Center"/>
<TextBlock Text="{DynamicResource Dashboard.Devices.Can}"
Style="{StaticResource KpiHeaderText}" VerticalAlignment="Center"/>
<!-- Refresh button -->
<Button DockPanel.Dock="Right"
Command="{Binding Devices.RefreshCanDevicesCommand}"
Background="Transparent" BorderThickness="0"
Padding="4" Cursor="Hand"
ToolTip="{DynamicResource Dashboard.Devices.Refresh}">
<ui:SymbolIcon Symbol="ArrowClockwise24" FontSize="14"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"/>
</Button>
</DockPanel>
<!-- Device list or empty placeholder -->
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
<Grid>
<!-- Placeholder when no devices are found -->
<TextBlock>
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Visibility" Value="Collapsed"/>
<Setter Property="Text" Value="{DynamicResource Dashboard.Devices.None}"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="FontStyle" Value="Italic"/>
<Setter Property="Foreground" Value="{DynamicResource TextFillColorTertiaryBrush}"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Devices.CanDevices.Count}" Value="0">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<ItemsControl ItemsSource="{Binding Devices.CanDevices}">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type vm:DeviceItem}">
<Button Style="{StaticResource DeviceRow}"
Command="{Binding DataContext.Devices.ToggleDeviceCommand,
RelativeSource={RelativeSource AncestorType=UserControl}}"
CommandParameter="{Binding}"
IsEnabled="{Binding IsEnabled}">
<DockPanel>
<TextBlock Text="{Binding StateLabel}"
DockPanel.Dock="Right"
FontSize="11" FontWeight="SemiBold"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
VerticalAlignment="Center" Margin="6,0,0,0"/>
<Ellipse DockPanel.Dock="Left">
<Ellipse.Style>
<Style TargetType="Ellipse" BasedOn="{StaticResource StatusDot}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsConnected}" Value="True">
<Setter Property="Fill" Value="{DynamicResource SystemFillColorSuccessBrush}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Ellipse.Style>
</Ellipse>
<TextBlock Text="{Binding Name}"
FontSize="13"
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
TextTrimming="CharacterEllipsis"
VerticalAlignment="Center"/>
</DockPanel>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</ScrollViewer>
</Grid>
</Border>
<!-- ── K-Line tile ──────────────────────────────────────────────────── -->
<Border Grid.Row="1" Style="{StaticResource KpiTile}" Margin="0,4,0,4">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Tile header -->
<DockPanel Grid.Row="0" Margin="0,0,0,8">
<ui:SymbolIcon DockPanel.Dock="Left" Symbol="UsbPlug24" FontSize="14"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Margin="0,0,6,0" VerticalAlignment="Center"/>
<TextBlock Text="{DynamicResource Dashboard.Devices.Kline}"
Style="{StaticResource KpiHeaderText}" VerticalAlignment="Center"/>
<Button DockPanel.Dock="Right"
Command="{Binding Devices.RefreshKLineDevicesCommand}"
Background="Transparent" BorderThickness="0"
Padding="4" Cursor="Hand"
ToolTip="{DynamicResource Dashboard.Devices.Refresh}">
<ui:SymbolIcon Symbol="ArrowClockwise24" FontSize="14"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"/>
</Button>
</DockPanel>
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
<Grid>
<TextBlock>
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Visibility" Value="Collapsed"/>
<Setter Property="Text" Value="{DynamicResource Dashboard.Devices.None}"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="FontStyle" Value="Italic"/>
<Setter Property="Foreground" Value="{DynamicResource TextFillColorTertiaryBrush}"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Devices.KLineDevices.Count}" Value="0">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<ItemsControl ItemsSource="{Binding Devices.KLineDevices}">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type vm:DeviceItem}">
<Button Style="{StaticResource DeviceRow}"
Command="{Binding DataContext.Devices.ToggleDeviceCommand,
RelativeSource={RelativeSource AncestorType=UserControl}}"
CommandParameter="{Binding}"
IsEnabled="{Binding IsEnabled}">
<DockPanel>
<TextBlock Text="{Binding StateLabel}"
DockPanel.Dock="Right"
FontSize="11" FontWeight="SemiBold"
VerticalAlignment="Center" Margin="6,0,0,0">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="{DynamicResource TextFillColorSecondaryBrush}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsConnected}" Value="True">
<Setter Property="Foreground" Value="{DynamicResource SystemFillColorSuccessBrush}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<Ellipse DockPanel.Dock="Left">
<Ellipse.Style>
<Style TargetType="Ellipse" BasedOn="{StaticResource StatusDot}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsConnected}" Value="True">
<Setter Property="Fill" Value="{DynamicResource SystemFillColorSuccessBrush}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Ellipse.Style>
</Ellipse>
<TextBlock Text="{Binding Name}"
FontSize="13"
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
TextTrimming="CharacterEllipsis"
VerticalAlignment="Center"/>
</DockPanel>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</ScrollViewer>
</Grid>
</Border>
<!-- ── Bench tile ───────────────────────────────────────────────────── -->
<Border Grid.Row="2" Style="{StaticResource KpiTile}" Margin="0,4,0,0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Tile header (no refresh button — nothing to enumerate) -->
<DockPanel Grid.Row="0" Margin="0,0,0,8">
<ui:SymbolIcon DockPanel.Dock="Left" Symbol="DesktopPulse24" FontSize="14"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Margin="0,0,6,0" VerticalAlignment="Center"/>
<TextBlock Text="{DynamicResource Dashboard.Devices.Bench}"
Style="{StaticResource KpiHeaderText}" VerticalAlignment="Center"/>
</DockPanel>
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
<ItemsControl ItemsSource="{Binding Devices.BenchDevices}">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type vm:DeviceItem}">
<!-- IsEnabled=false disables hover; Bench rows are not clickable -->
<Button Style="{StaticResource DeviceRow}"
IsEnabled="{Binding IsEnabled}">
<DockPanel>
<TextBlock Text="{Binding StateLabel}"
DockPanel.Dock="Right"
FontSize="11" FontWeight="SemiBold"
VerticalAlignment="Center" Margin="6,0,0,0">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="{DynamicResource TextFillColorSecondaryBrush}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsConnected}" Value="True">
<Setter Property="Foreground" Value="{DynamicResource SystemFillColorSuccessBrush}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<Ellipse DockPanel.Dock="Left">
<Ellipse.Style>
<Style TargetType="Ellipse" BasedOn="{StaticResource StatusDot}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsConnected}" Value="True">
<Setter Property="Fill" Value="{DynamicResource SystemFillColorSuccessBrush}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Ellipse.Style>
</Ellipse>
<TextBlock Text="{Binding Name}"
FontSize="13"
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
TextTrimming="CharacterEllipsis"
VerticalAlignment="Center"/>
</DockPanel>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>
</Border>
</Grid>
</UserControl>

View File

@@ -0,0 +1,16 @@
using System.Windows.Controls;
namespace HC_APTBS.Views.UserControls
{
/// <summary>
/// Devices column for the Dashboard page — CAN, K-Line, and Bench device tiles.
/// DataContext is expected to be a <see cref="HC_APTBS.ViewModels.Pages.DashboardPageViewModel"/>.
/// </summary>
public partial class DashboardDevicesView : UserControl
{
public DashboardDevicesView()
{
InitializeComponent();
}
}
}

View File

@@ -1,103 +1,142 @@
<UserControl x:Class="HC_APTBS.Views.UserControls.DashboardReadingsView"
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"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="320">
d:DesignHeight="340" d:DesignWidth="900">
<!--
Dashboard-only compact LCD panel.
Dashboard KPI readings grid — 6 Fluent tiles in a 2-row × 3-column uniform grid.
DataContext is DashboardPageViewModel; binds via Root.X to MainViewModel live readings.
Read-first: no controls, no popups.
-->
<StackPanel>
<UniformGrid Rows="2" Columns="3">
<!-- RPM: oversized single-line read -->
<Border Style="{StaticResource LcdBlue}" Margin="0,0,0,4" Padding="10,6">
<Grid Height="76">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Root.BenchRpm, StringFormat=F0}"
FontSize="60" FontWeight="UltraBold" Foreground="#EBEBFF"
HorizontalAlignment="Right" VerticalAlignment="Center"
FontFamily="Consolas"/>
<TextBlock Grid.Column="1" Text="{DynamicResource Bench.Rpm}"
FontSize="18" Foreground="#FFFFEB6E"
VerticalAlignment="Center" Margin="6,0,0,0"/>
</Grid>
</Border>
<!-- Temperatures + Pressures side by side -->
<Grid Margin="0,0,0,4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- Pressures -->
<Border Grid.Column="0" Style="{StaticResource LcdBlue}" Margin="0,0,2,0" Padding="8,4">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60"/>
<ColumnDefinition/>
<ColumnDefinition Width="30"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock Text="{DynamicResource Bench.P1}" Grid.Row="0" VerticalAlignment="Center" Foreground="#EBEBFF" FontSize="13"/>
<TextBlock Text="{DynamicResource Bench.P2}" Grid.Row="1" VerticalAlignment="Center" Foreground="#EBEBFF" FontSize="13"/>
<TextBlock Text="{Binding Root.Pressure, StringFormat=F1}" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Center" Foreground="#EBEBFF" FontSize="20" FontFamily="Consolas"/>
<TextBlock Text="{Binding Root.Pressure2, StringFormat=F1}" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Center" Foreground="#EBEBFF" FontSize="20" FontFamily="Consolas"/>
<TextBlock Text="bar" Grid.Row="0" Grid.Column="2" Foreground="#EBEBFF" FontSize="13" VerticalAlignment="Center" Margin="4,0"/>
<TextBlock Text="bar" Grid.Row="1" Grid.Column="2" Foreground="#EBEBFF" FontSize="13" VerticalAlignment="Center" Margin="4,0"/>
</Grid>
</Border>
<!-- Temperatures -->
<Border Grid.Column="1" Style="{StaticResource LcdBlue}" Margin="2,0,0,0" Padding="8,4">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60"/>
<ColumnDefinition/>
<ColumnDefinition Width="30"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock Text="{DynamicResource Bench.TempIn}" Grid.Row="0" VerticalAlignment="Center" Foreground="#EBEBFF" FontSize="13"/>
<TextBlock Text="{DynamicResource Bench.TempOut}" Grid.Row="1" VerticalAlignment="Center" Foreground="#EBEBFF" FontSize="13"/>
<TextBlock Text="{DynamicResource Bench.TempTank}" Grid.Row="2" VerticalAlignment="Center" Foreground="#EBEBFF" FontSize="13"/>
<TextBlock Text="{Binding Root.TempIn, StringFormat=F1}" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Right" Foreground="#EBEBFF" FontSize="20" FontFamily="Consolas"/>
<TextBlock Text="{Binding Root.TempOut, StringFormat=F1}" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right" Foreground="#EBEBFF" FontSize="20" FontFamily="Consolas"/>
<TextBlock Text="{Binding Root.BenchTemp, StringFormat=F1}" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Right" Foreground="#EBEBFF" FontSize="20" FontFamily="Consolas"/>
<TextBlock Text="°C" Grid.Row="0" Grid.Column="2" Foreground="#EBEBFF" FontSize="13" VerticalAlignment="Center" Margin="4,0"/>
<TextBlock Text="°C" Grid.Row="1" Grid.Column="2" Foreground="#EBEBFF" FontSize="13" VerticalAlignment="Center" Margin="4,0"/>
<TextBlock Text="°C" Grid.Row="2" Grid.Column="2" Foreground="#EBEBFF" FontSize="13" VerticalAlignment="Center" Margin="4,0"/>
</Grid>
</Border>
</Grid>
<!-- Flow: Q-Delivery -->
<Border Style="{StaticResource LcdBlue}" Padding="8,4">
<!-- Tile 1: RPM -->
<Border Style="{StaticResource KpiTile}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="90"/>
<ColumnDefinition/>
<ColumnDefinition Width="46"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{DynamicResource Bench.QDelivery}" VerticalAlignment="Center" Foreground="#EBEBFF" FontSize="13"/>
<TextBlock Text="{Binding Root.QDelivery, StringFormat=F1}"
Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Center"
Foreground="#EBEBFF" FontSize="22" FontFamily="Consolas"/>
<TextBlock Text="cc/s" Grid.Column="2" Foreground="#EBEBFF" FontSize="13" VerticalAlignment="Center" Margin="4,0"/>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<ui:SymbolIcon Symbol="Gauge24" FontSize="14"
Foreground="{DynamicResource TextFillColorSecondaryBrush}" Margin="0,0,6,0"
VerticalAlignment="Center"/>
<TextBlock Text="{DynamicResource Dashboard.Kpi.Rpm}" Style="{StaticResource KpiHeaderText}"
VerticalAlignment="Center"/>
</StackPanel>
<StackPanel Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Bottom">
<TextBlock Text="{Binding Root.BenchRpm, StringFormat=F0}" Style="{StaticResource KpiValueText}"/>
<TextBlock Text="{DynamicResource Dashboard.Kpi.Unit.Rpm}" Style="{StaticResource KpiUnitText}"/>
</StackPanel>
</Grid>
</Border>
</StackPanel>
<!-- Tile 2: Q-Delivery -->
<Border Style="{StaticResource KpiTile}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<ui:SymbolIcon Symbol="Drop24" FontSize="14"
Foreground="{DynamicResource TextFillColorSecondaryBrush}" Margin="0,0,6,0"
VerticalAlignment="Center"/>
<TextBlock Text="{DynamicResource Dashboard.Kpi.Qdelivery}" Style="{StaticResource KpiHeaderText}"
VerticalAlignment="Center"/>
</StackPanel>
<StackPanel Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Bottom">
<TextBlock Text="{Binding Root.QDelivery, StringFormat=F1}" Style="{StaticResource KpiValueText}"/>
<TextBlock Text="{DynamicResource Dashboard.Kpi.Unit.CcS}" Style="{StaticResource KpiUnitText}"/>
</StackPanel>
</Grid>
</Border>
<!-- Tile 3: Pressure P1 -->
<Border Style="{StaticResource KpiTile}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<ui:SymbolIcon Symbol="ArrowTrendingLines24" FontSize="14"
Foreground="{DynamicResource TextFillColorSecondaryBrush}" Margin="0,0,6,0"
VerticalAlignment="Center"/>
<TextBlock Text="{DynamicResource Dashboard.Kpi.P1}" Style="{StaticResource KpiHeaderText}"
VerticalAlignment="Center"/>
</StackPanel>
<StackPanel Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Bottom">
<TextBlock Text="{Binding Root.Pressure, StringFormat=F1}" Style="{StaticResource KpiValueText}"/>
<TextBlock Text="{DynamicResource Dashboard.Kpi.Unit.Bar}" Style="{StaticResource KpiUnitText}"/>
</StackPanel>
</Grid>
</Border>
<!-- Tile 4: Pressure P2 -->
<Border Style="{StaticResource KpiTile}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<ui:SymbolIcon Symbol="ArrowTrendingLines24" FontSize="14"
Foreground="{DynamicResource TextFillColorSecondaryBrush}" Margin="0,0,6,0"
VerticalAlignment="Center"/>
<TextBlock Text="{DynamicResource Dashboard.Kpi.P2}" Style="{StaticResource KpiHeaderText}"
VerticalAlignment="Center"/>
</StackPanel>
<StackPanel Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Bottom">
<TextBlock Text="{Binding Root.Pressure2, StringFormat=F1}" Style="{StaticResource KpiValueText}"/>
<TextBlock Text="{DynamicResource Dashboard.Kpi.Unit.Bar}" Style="{StaticResource KpiUnitText}"/>
</StackPanel>
</Grid>
</Border>
<!-- Tile 5: Oil inlet temperature -->
<Border Style="{StaticResource KpiTile}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<ui:SymbolIcon Symbol="Temperature24" FontSize="14"
Foreground="{DynamicResource TextFillColorSecondaryBrush}" Margin="0,0,6,0"
VerticalAlignment="Center"/>
<TextBlock Text="{DynamicResource Dashboard.Kpi.Tin}" Style="{StaticResource KpiHeaderText}"
VerticalAlignment="Center"/>
</StackPanel>
<StackPanel Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Bottom">
<TextBlock Text="{Binding Root.TempIn, StringFormat=F1}" Style="{StaticResource KpiValueText}"/>
<TextBlock Text="{DynamicResource Dashboard.Kpi.Unit.Celsius}" Style="{StaticResource KpiUnitText}"/>
</StackPanel>
</Grid>
</Border>
<!-- Tile 6: Oil outlet temperature -->
<Border Style="{StaticResource KpiTile}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<ui:SymbolIcon Symbol="ArrowUpload24" FontSize="14"
Foreground="{DynamicResource TextFillColorSecondaryBrush}" Margin="0,0,6,0"
VerticalAlignment="Center"/>
<TextBlock Text="{DynamicResource Dashboard.Kpi.Tout}" Style="{StaticResource KpiHeaderText}"
VerticalAlignment="Center"/>
</StackPanel>
<StackPanel Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Bottom">
<TextBlock Text="{Binding Root.TempOut, StringFormat=F1}" Style="{StaticResource KpiValueText}"/>
<TextBlock Text="{DynamicResource Dashboard.Kpi.Unit.Celsius}" Style="{StaticResource KpiUnitText}"/>
</StackPanel>
</Grid>
</Border>
</UniformGrid>
</UserControl>

View File

@@ -10,13 +10,13 @@
DataContext = RelayBankViewModel.
-->
<UserControl.Resources>
<Style x:Key="RelayToggle" TargetType="ToggleButton">
<Style x:Key="RelayToggle" TargetType="ToggleButton"
BasedOn="{StaticResource FluentStateToggle}">
<Setter Property="Height" Value="28"/>
<Setter Property="FontSize" Value="11"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Margin" Value="0,2,0,0"/>
<Setter Property="Content" Value="{DynamicResource Bench.RelayOff}"/>
<Setter Property="Background" Value="LightGray"/>
<Style.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Content" Value="{DynamicResource Bench.RelayOn}"/>

View File

@@ -50,9 +50,8 @@
<TextBlock Text="{DynamicResource Bench.DepositHeater}" FontSize="10" Foreground="DimGray" Margin="0,10,0,2"/>
<ToggleButton IsChecked="{Binding IsHeaterOn}" Height="28" FontSize="11" FontWeight="SemiBold">
<ToggleButton.Style>
<Style TargetType="ToggleButton">
<Style TargetType="ToggleButton" BasedOn="{StaticResource FluentStateToggle}">
<Setter Property="Content" Value="{DynamicResource Bench.RelayOff}"/>
<Setter Property="Background" Value="LightGray"/>
<Style.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Content" Value="{DynamicResource Bench.RelayOn}"/>
@@ -67,9 +66,8 @@
<TextBlock Text="{DynamicResource Bench.DepositCooler}" FontSize="10" Foreground="DimGray" Margin="0,6,0,2"/>
<ToggleButton IsChecked="{Binding IsDepositCoolerOn}" Height="28" FontSize="11" FontWeight="SemiBold">
<ToggleButton.Style>
<Style TargetType="ToggleButton">
<Style TargetType="ToggleButton" BasedOn="{StaticResource FluentStateToggle}">
<Setter Property="Content" Value="{DynamicResource Bench.RelayOff}"/>
<Setter Property="Background" Value="LightGray"/>
<Style.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Content" Value="{DynamicResource Bench.RelayOn}"/>
@@ -84,9 +82,8 @@
<TextBlock Text="{DynamicResource Bench.TinCooler}" FontSize="10" Foreground="DimGray" Margin="0,6,0,2"/>
<ToggleButton IsChecked="{Binding IsTinCoolerOn}" Height="28" FontSize="11" FontWeight="SemiBold">
<ToggleButton.Style>
<Style TargetType="ToggleButton">
<Style TargetType="ToggleButton" BasedOn="{StaticResource FluentStateToggle}">
<Setter Property="Content" Value="{DynamicResource Bench.RelayOff}"/>
<Setter Property="Background" Value="LightGray"/>
<Style.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Content" Value="{DynamicResource Bench.RelayOn}"/>