Files
HC_APTBS/Views/UserControls/DtcCard.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

103 lines
6.2 KiB
XML

<UserControl x:Class="HC_APTBS.Views.UserControls.DtcCard"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
mc:Ignorable="d"
d:DesignHeight="280" d:DesignWidth="320">
<!-- DataContext = DtcListViewModel (via {Binding DtcList}) -->
<UserControl.Resources>
<BooleanToVisibilityConverter x:Key="BoolToVis"/>
</UserControl.Resources>
<Border Style="{StaticResource PumpCard}">
<DockPanel LastChildFill="True">
<!-- ── Card header ───────────────────────────────────────────── -->
<DockPanel DockPanel.Dock="Top" Margin="0,0,0,10">
<ui:SymbolIcon DockPanel.Dock="Left" Symbol="Warning24" FontSize="16"
Foreground="{DynamicResource SystemFillColorCautionBrush}"
Margin="0,0,8,0" VerticalAlignment="Center"/>
<TextBlock Text="{DynamicResource Pump.Dtcs.Title}"
Style="{StaticResource PumpCardHeader}" Margin="0"/>
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal"
VerticalAlignment="Center" HorizontalAlignment="Right">
<ui:Button Content="{DynamicResource Dtc.Read}"
Command="{Binding ReadCommand}"
Appearance="Secondary"
Height="32" Margin="0,0,6,0"/>
<ui:Button Content="{DynamicResource Dtc.Clear}"
Command="{Binding ClearCommand}"
Appearance="Secondary"
Height="32"/>
</StackPanel>
</DockPanel>
<!-- ── Busy indicator ─────────────────────────────────────────── -->
<ProgressBar DockPanel.Dock="Top"
IsIndeterminate="True" Height="3" Margin="0,0,0,6"
Visibility="{Binding IsBusy, Converter={StaticResource BoolToVis}}"/>
<!-- ── Status text ─────────────────────────────────────────────── -->
<TextBlock DockPanel.Dock="Top"
Text="{Binding StatusText}"
FontSize="11"
Foreground="{DynamicResource TextFillColorTertiaryBrush}"
Margin="0,0,0,6"/>
<!-- ── "No faults" success pill ───────────────────────────────── -->
<Border DockPanel.Dock="Top"
Background="{DynamicResource SystemFillColorSuccessBackgroundBrush}"
BorderBrush="{DynamicResource SystemFillColorSuccessBrush}"
BorderThickness="1" CornerRadius="6" Padding="10,6"
HorizontalAlignment="Left" Margin="0,0,0,4"
Visibility="{Binding IsClear, Converter={StaticResource BoolToVis}}">
<StackPanel Orientation="Horizontal">
<ui:SymbolIcon Symbol="CheckmarkCircle24" FontSize="14"
Foreground="{DynamicResource SystemFillColorSuccessBrush}"
Margin="0,0,6,0" VerticalAlignment="Center"/>
<TextBlock Text="{DynamicResource Dtc.NoFaults}"
FontSize="12" FontWeight="SemiBold"
Foreground="{DynamicResource SystemFillColorSuccessBrush}"
VerticalAlignment="Center"/>
</StackPanel>
</Border>
<!-- ── DTC rows ───────────────────────────────────────────────── -->
<ScrollViewer VerticalScrollBarVisibility="Auto">
<ItemsControl ItemsSource="{Binding Codes}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border Background="{DynamicResource SystemFillColorCautionBackgroundBrush}"
BorderBrush="{DynamicResource SystemFillColorCautionBrush}"
BorderThickness="0,0,0,1" CornerRadius="4"
Padding="8,6" Margin="0,2">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="90"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Code}"
FontFamily="Consolas" FontWeight="Bold"
FontSize="12"
Foreground="{DynamicResource SystemFillColorCriticalBrush}"
VerticalAlignment="Center"/>
<TextBlock Grid.Column="1"
Text="{Binding Description}"
FontSize="12"
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
TextWrapping="Wrap"
VerticalAlignment="Center"/>
</Grid>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</DockPanel>
</Border>
</UserControl>