Files
HC_APTBS/Resources/Styles.xaml
LucianoDev 827b811b39 feat: developer tools page, auto-test orchestrator, BIP display, tests redesign
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>
2026-05-07 13:59:50 +02:00

420 lines
24 KiB
XML

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:conv="clr-namespace:HC_APTBS.Converters">
<!-- Boolean → Visibility converter (shared across views) -->
<BooleanToVisibilityConverter x:Key="BoolToVis"/>
<!-- Null → Collapsed, non-null → Visible -->
<conv:NullToVisibilityConverter x:Key="NullToVis"/>
<!-- LCD blue gradient border -->
<Style x:Key="LcdBlue" TargetType="Border">
<Setter Property="BorderBrush" Value="Black"/>
<Setter Property="BorderThickness" Value="4"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush StartPoint="0.3,0" EndPoint="0.5,1.3">
<GradientStop Color="#0040ff" Offset="0"/>
<GradientStop Color="#0031c2" Offset="1"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Style>
<!-- LCD amber gradient border -->
<Style x:Key="LcdAmber" TargetType="Border">
<Setter Property="BorderBrush" Value="Black"/>
<Setter Property="BorderThickness" Value="3"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush StartPoint="0.3,0" EndPoint="0.5,1.3">
<GradientStop Color="#ffae00" Offset="0"/>
<GradientStop Color="#91670a" Offset="2"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Style>
<!-- Connection indicator style (green/gray) -->
<Style x:Key="ConnIndicator" TargetType="Border">
<Setter Property="Background" Value="Gray"/>
<Setter Property="BorderBrush" Value="Black"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Margin" Value="2,4"/>
</Style>
<!-- Relay toggle button style — inherits WPF-UI Button appearance -->
<Style x:Key="RelayButton" TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Padding" Value="6,3"/>
<Setter Property="Margin" Value="3,2"/>
<Setter Property="FontSize" Value="11"/>
</Style>
<!--
Base style for state-indicating toggle buttons (on/off with colour feedback).
Uses a custom ControlTemplate so that TemplateBinding Background is honoured
in ALL states — including IsChecked=True. Derived styles add IsChecked triggers
with a custom Background colour (green, amber, blue, etc.) and those colours are
guaranteed to propagate, unlike WPF-UI's own ToggleButton template which has an
internal IsChecked trigger that would override a simple BasedOn + Background setter.
Hover/pressed feedback is applied via a transparent overlay so it works on any
background colour without conflicting with the checked state.
-->
<Style x:Key="FluentStateToggle" TargetType="ToggleButton">
<Setter Property="OverridesDefaultStyle" Value="True"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}"/>
<Setter Property="Padding" Value="8,4"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Background" Value="{DynamicResource ControlFillColorDefaultBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ControlStrokeColorDefaultBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Grid>
<Border x:Name="Root"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4"
SnapsToDevicePixels="True"/>
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Margin="{TemplateBinding Padding}"
TextElement.Foreground="{TemplateBinding Foreground}"/>
<!-- Transparent overlay — darkens on hover/pressed over any background colour -->
<Border x:Name="HoverOverlay" CornerRadius="4" Background="Transparent"
IsHitTestVisible="False"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="Root" Property="Background" Value="{DynamicResource AccentFillColorDefaultBrush}"/>
<Setter TargetName="Root" Property="BorderBrush" Value="{DynamicResource AccentFillColorDefaultBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource TextOnAccentFillColorPrimaryBrush}"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="HoverOverlay" Property="Background" Value="#18000000"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="HoverOverlay" Property="Background" Value="#30000000"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.4"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ── Dashboard KPI tile styles ─────────────────────────────────────── -->
<Style x:Key="KpiTile" TargetType="Border">
<Setter Property="Background" Value="{DynamicResource CardBackgroundFillColorDefaultBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource CardStrokeColorDefaultBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="CornerRadius" Value="8"/>
<Setter Property="Padding" Value="16"/>
<Setter Property="Margin" Value="4"/>
<Setter Property="MinHeight" Value="140"/>
</Style>
<Style x:Key="KpiHeaderText" TargetType="TextBlock">
<Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="Foreground" Value="{DynamicResource TextFillColorSecondaryBrush}"/>
<Setter Property="Margin" Value="0,0,0,4"/>
</Style>
<Style x:Key="KpiValueText" TargetType="TextBlock">
<Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}"/>
<Setter Property="FontSize" Value="52"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}"/>
<Setter Property="TextAlignment" Value="Left"/>
<Setter Property="TextTrimming" Value="CharacterEllipsis"/>
</Style>
<Style x:Key="KpiUnitText" TargetType="TextBlock">
<Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="Foreground" Value="{DynamicResource TextFillColorTertiaryBrush}"/>
<Setter Property="VerticalAlignment" Value="Bottom"/>
<Setter Property="Margin" Value="6,0,0,6"/>
</Style>
<!-- Connection strip chip -->
<Style x:Key="ConnChip" TargetType="Border">
<Setter Property="Background" Value="{DynamicResource ControlFillColorSecondaryBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ControlStrokeColorDefaultBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="CornerRadius" Value="14"/>
<Setter Property="Padding" Value="14,6"/>
<Setter Property="Margin" Value="0,0,8,0"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
</Style>
<!-- Status dot (10 px ellipse; Fill overridden by DataTrigger for state colour) -->
<Style x:Key="StatusDot" TargetType="Ellipse">
<Setter Property="Width" Value="10"/>
<Setter Property="Height" Value="10"/>
<Setter Property="Fill" Value="{DynamicResource SystemFillColorNeutralBrush}"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Margin" Value="6,0,4,0"/>
</Style>
<!-- ── Pump page card chrome (same Fluent look as Dashboard inline cards) ── -->
<Style x:Key="PumpCard" TargetType="Border">
<Setter Property="Background" Value="{DynamicResource CardBackgroundFillColorDefaultBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource CardStrokeColorDefaultBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="CornerRadius" Value="8"/>
<Setter Property="Padding" Value="16"/>
<Setter Property="Margin" Value="4"/>
</Style>
<Style x:Key="PumpCardHeader" TargetType="TextBlock">
<Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}"/>
<Setter Property="Margin" Value="0,0,0,10"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<!-- Small label beneath a pump slider (parameter name, unit, range limit) -->
<Style x:Key="PumpCommandLabel" TargetType="TextBlock">
<Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}"/>
<Setter Property="FontSize" Value="11"/>
<Setter Property="Foreground" Value="{DynamicResource TextFillColorSecondaryBrush}"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="TextAlignment" Value="Center"/>
</Style>
<!-- Current-value readout beneath a pump slider -->
<Style x:Key="PumpCommandValue" TargetType="TextBox">
<Setter Property="FontFamily" Value="Consolas"/>
<Setter Property="FontSize" Value="15"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Foreground" Value="{DynamicResource AccentTextFillColorPrimaryBrush}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="TextAlignment" Value="Center"/>
<Setter Property="Padding" Value="4,2"/>
<Setter Property="Width" Value="70"/>
<Setter Property="Height" Value="30"/>
</Style>
<!-- ── Tests page: meta pill (Tacond / Tmeas / M·s⁻¹ chips in section header) ── -->
<Style x:Key="TestMetaPill" TargetType="Border">
<Setter Property="Background" Value="{DynamicResource ControlFillColorSecondaryBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ControlStrokeColorDefaultBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="CornerRadius" Value="9"/>
<Setter Property="Padding" Value="7,2"/>
<Setter Property="Margin" Value="0,0,4,0"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
</Style>
<Style x:Key="TestMetaPillText" TargetType="TextBlock">
<Setter Property="FontSize" Value="10"/>
<Setter Property="Foreground" Value="{DynamicResource TextFillColorSecondaryBrush}"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<!-- ── Tests page: phase tile (compact card inside a TestSectionCard) ── -->
<Style x:Key="PhaseTile" TargetType="Border">
<Setter Property="Background" Value="{DynamicResource ControlFillColorDefaultBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ControlStrokeColorDefaultBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="CornerRadius" Value="6"/>
<Setter Property="Padding" Value="6"/>
<Setter Property="Margin" Value="3"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
</Style>
<!-- Snackbar bottom-overlay shell -->
<Style x:Key="SnackbarShell" TargetType="Border">
<Setter Property="Background" Value="{DynamicResource CardBackgroundFillColorDefaultBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource CardStrokeColorDefaultBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="CornerRadius" Value="10"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect Color="#000000" Opacity="0.18" BlurRadius="20" ShadowDepth="4"/>
</Setter.Value>
</Setter>
</Style>
<!-- ── Device row button — hover tint indicates intent (connect=blue, disconnect=red) -->
<Style x:Key="DeviceRow" TargetType="Button">
<Setter Property="Background" Value="{DynamicResource ControlFillColorSecondaryBrush}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Padding" Value="10,6"/>
<Setter Property="Margin" Value="0,0,0,4"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="Bd"
Background="{TemplateBinding Background}"
Padding="{TemplateBinding Padding}"
CornerRadius="6">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<!-- Hover + disconnected → accent blue (will connect) -->
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsMouseOver}" Value="True"/>
<Condition Binding="{Binding IsConnected}" Value="False"/>
</MultiDataTrigger.Conditions>
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource AccentFillColorSecondaryBrush}"/>
</MultiDataTrigger>
<!-- Hover + connected → critical red (will disconnect) -->
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsMouseOver}" Value="True"/>
<Condition Binding="{Binding IsConnected}" Value="True"/>
</MultiDataTrigger.Conditions>
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource SystemFillColorCriticalBackgroundBrush}"/>
</MultiDataTrigger>
<!-- Disabled → muted (bench placeholder) -->
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Bd" Property="Opacity" Value="0.5"/>
<Setter Property="Cursor" Value="Arrow"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--
Fluent-style vertical slider with a thick pill-shaped track.
- Track background fills the entire slider width (Width set on the Slider element).
- Lower (decrease) portion is filled with the accent brush; upper portion is the
unfilled rail in ControlStrongFillColorDefaultBrush.
- Thumb is a horizontal Fluent-style pill with subtle border.
Designed for Orientation="Vertical" only.
-->
<Style x:Key="FluentThickVerticalSlider" TargetType="Slider">
<Setter Property="Focusable" Value="False"/>
<!-- Intentionally NOT setting IsMoveToPointEnabled. The built-in implementation
marks the preview event handled, which would suppress the code-behind
handler that drives our click-anywhere-and-drag gesture. -->
<Setter Property="MinWidth" Value="20"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Slider">
<!-- Background="Transparent" makes the Slider itself the click target,
so the code-behind's PreviewMouseLeftButtonDown can capture and drive
the value. Track repeat buttons are hit-test invisible to prevent
ButtonBase's class handler from stealing mouse capture. -->
<Grid HorizontalAlignment="Stretch" Background="Transparent" ClipToBounds="False">
<!-- Unfilled rail. Pinned to a fixed cross-axis width and centered
so the Slider can be widened to host an overhanging Thumb
without growing the visible track. -->
<Border CornerRadius="6"
Background="{DynamicResource ControlStrongFillColorDefaultBrush}"
Opacity="0.35"
Width="32"
HorizontalAlignment="Center"
IsHitTestVisible="False"
SnapsToDevicePixels="True"/>
<!-- Track + thumb. Orientation/direction must mirror the templated
Slider so Track.ValueFromPoint computes against the vertical axis. -->
<Track x:Name="PART_Track"
Orientation="{TemplateBinding Orientation}"
IsDirectionReversed="{TemplateBinding IsDirectionReversed}">
<Track.DecreaseRepeatButton>
<RepeatButton Command="Slider.DecreaseLarge"
IsTabStop="False" Focusable="False"
IsHitTestVisible="False">
<RepeatButton.Template>
<ControlTemplate TargetType="RepeatButton">
<!-- Filled portion pinned to the rail width so it
stays inside the visible track regardless of how
wide the Slider/Thumb are set. -->
<Border CornerRadius="0,0,6,6"
Background="{DynamicResource AccentFillColorDefaultBrush}"
Width="32"
HorizontalAlignment="Center"
SnapsToDevicePixels="True"/>
</ControlTemplate>
</RepeatButton.Template>
</RepeatButton>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Command="Slider.IncreaseLarge"
IsTabStop="False" Focusable="False"
IsHitTestVisible="False">
<RepeatButton.Template>
<ControlTemplate TargetType="RepeatButton">
<Border Background="Transparent"/>
</ControlTemplate>
</RepeatButton.Template>
</RepeatButton>
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb x:Name="ThumbPill" ClipToBounds="False">
<Thumb.Template>
<ControlTemplate TargetType="Thumb">
<Grid ClipToBounds="False">
<!-- Outer pill: white fill with subtle gray border.
Width is fixed and centered so the pill can
overhang the rail without being clipped. -->
<Border x:Name="ThumbOuter"
Height="20"
Width="52"
CornerRadius="8"
Background="{DynamicResource ControlSolidFillColorDefaultBrush}"
BorderBrush="{DynamicResource ControlStrokeColorDefaultBrush}"
BorderThickness="1"
HorizontalAlignment="Center"
SnapsToDevicePixels="True"/>
<!-- Inner accent dot -->
<Border x:Name="ThumbInner"
Width="44" Height="12"
CornerRadius="8"
Background="{DynamicResource AccentFillColorDefaultBrush}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
SnapsToDevicePixels="True"/>
</Grid>
<ControlTemplate.Triggers>
<!-- Press-color feedback only; thumb size stays constant. -->
<Trigger Property="IsDragging" Value="True">
<Setter TargetName="ThumbInner" Property="Background"
Value="{DynamicResource AccentFillColorSecondaryBrush}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Thumb.Template>
</Thumb>
</Track.Thumb>
</Track>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.4"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>