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

231 lines
14 KiB
XML

<UserControl x:Class="HC_APTBS.Views.UserControls.PumpCommandsCard"
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="490" d:DesignWidth="260"
IsEnabled="{Binding IsEnabled}">
<!-- DataContext = PumpControlViewModel (via {Binding PumpControl}) -->
<UserControl.Resources>
<Style x:Key="SettingsTextBox" TargetType="TextBox">
<Setter Property="Width" Value="44"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="FontSize" Value="13"/>
</Style>
<Style x:Key="SettingsLabel" TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Bottom"/>
<Setter Property="FontSize" Value="11"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="Margin" Value="0,2,0,0"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
</Style>
</UserControl.Resources>
<Border Style="{StaticResource PumpCard}">
<DockPanel LastChildFill="True">
<!-- ── Card header ───────────────────────────────────────────── -->
<DockPanel DockPanel.Dock="Top" Margin="0,0,0,12">
<ui:SymbolIcon DockPanel.Dock="Left" Symbol="ArrowTrendingLines24" FontSize="16"
Foreground="{DynamicResource AccentTextFillColorPrimaryBrush}"
Margin="0,0,8,0" VerticalAlignment="Center"/>
<TextBlock Text="{DynamicResource Pump.Commands.Title}"
Style="{StaticResource PumpCardHeader}" Margin="0"/>
</DockPanel>
<!-- ── Slider columns ────────────────────────────────────────── -->
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<!-- PreIn: collapses when not applicable -->
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- ── FBKW ────────────────────────────────────────────── -->
<StackPanel Grid.Column="0" HorizontalAlignment="Center">
<!-- Settings toggle -->
<ToggleButton x:Name="FbkwToggle"
Width="28" Height="22"
HorizontalAlignment="Center"
Background="Transparent" BorderBrush="Transparent"
Content="..." FontWeight="Bold" FontSize="13"
ToolTip="{DynamicResource PumpCtrl.MinStepMax}"/>
<!-- Max label -->
<TextBlock Text="{Binding FbkwMax, StringFormat=F1}"
Style="{StaticResource PumpCommandLabel}"
Margin="0,4,0,2"/>
<!-- Vertical slider -->
<Slider Style="{StaticResource FluentThickVerticalSlider}"
Orientation="Vertical"
Minimum="{Binding FbkwMin}" Maximum="{Binding FbkwMax}"
Value="{Binding FbkwValue}"
TickFrequency="{Binding FbkwStep}"
IsSnapToTickEnabled="True"
AutoToolTipPrecision="2"
Height="360" Width="52"
HorizontalAlignment="Center"
Loaded="Slider_Loaded"/>
<!-- Min label -->
<TextBlock Text="{Binding FbkwMin, StringFormat=F1}"
Style="{StaticResource PumpCommandLabel}"
Margin="0,2,0,6"/>
<!-- Parameter name (above current value) -->
<TextBlock Text="{DynamicResource Pump.Commands.Fbkw}"
Style="{StaticResource PumpCommandLabel}"
Margin="0,0,0,2"/>
<!-- Editable value box -->
<TextBox Text="{Binding FbkwValue, UpdateSourceTrigger=PropertyChanged, StringFormat=F2}"
Style="{StaticResource PumpCommandValue}"/>
<!-- Settings popup -->
<Popup IsOpen="{Binding IsChecked, ElementName=FbkwToggle}"
StaysOpen="False" Placement="Bottom" AllowsTransparency="True">
<Border Background="#BB000000" Padding="8,6" CornerRadius="3">
<UniformGrid Columns="3" Width="180">
<StackPanel HorizontalAlignment="Center">
<TextBox Text="{Binding FbkwMin, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource SettingsTextBox}"/>
<TextBlock Text="{DynamicResource PumpCtrl.Min}" Style="{StaticResource SettingsLabel}"/>
</StackPanel>
<StackPanel HorizontalAlignment="Center">
<TextBox Text="{Binding FbkwStep, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource SettingsTextBox}"/>
<TextBlock Text="{DynamicResource PumpCtrl.Step}" Style="{StaticResource SettingsLabel}"/>
</StackPanel>
<StackPanel HorizontalAlignment="Center">
<TextBox Text="{Binding FbkwMax, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource SettingsTextBox}"/>
<TextBlock Text="{DynamicResource PumpCtrl.Max}" Style="{StaticResource SettingsLabel}"/>
</StackPanel>
</UniformGrid>
</Border>
</Popup>
</StackPanel>
<!-- ── ME ──────────────────────────────────────────────── -->
<StackPanel Grid.Column="1" HorizontalAlignment="Center">
<ToggleButton x:Name="MeToggle"
Width="28" Height="22"
HorizontalAlignment="Center"
Background="Transparent" BorderBrush="Transparent"
Content="..." FontWeight="Bold" FontSize="13"
ToolTip="{DynamicResource PumpCtrl.MinStepMax}"/>
<TextBlock Text="{Binding MeMax, StringFormat=F1}"
Style="{StaticResource PumpCommandLabel}"
Margin="0,4,0,2"/>
<Slider Style="{StaticResource FluentThickVerticalSlider}"
Orientation="Vertical"
Minimum="{Binding MeMin}" Maximum="{Binding MeMax}"
Value="{Binding MeValue}"
TickFrequency="{Binding MeStep}"
IsSnapToTickEnabled="False"
AutoToolTipPrecision="2"
Height="360" Width="52"
HorizontalAlignment="Center"
Loaded="Slider_Loaded"/>
<TextBlock Text="{Binding MeMin, StringFormat=F1}"
Style="{StaticResource PumpCommandLabel}"
Margin="0,2,0,6"/>
<TextBlock Text="{DynamicResource Pump.Commands.Me}"
Style="{StaticResource PumpCommandLabel}"
Margin="0,0,0,2"/>
<TextBox Text="{Binding MeValue, UpdateSourceTrigger=PropertyChanged, StringFormat=F2}"
Style="{StaticResource PumpCommandValue}"/>
<Popup IsOpen="{Binding IsChecked, ElementName=MeToggle}"
StaysOpen="False" Placement="Bottom" AllowsTransparency="True">
<Border Background="#BB000000" Padding="8,6" CornerRadius="3">
<UniformGrid Columns="3" Width="180">
<StackPanel HorizontalAlignment="Center">
<TextBox Text="{Binding MeMin, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource SettingsTextBox}"/>
<TextBlock Text="{DynamicResource PumpCtrl.Min}" Style="{StaticResource SettingsLabel}"/>
</StackPanel>
<StackPanel HorizontalAlignment="Center">
<TextBox Text="{Binding MeStep, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource SettingsTextBox}"/>
<TextBlock Text="{DynamicResource PumpCtrl.Step}" Style="{StaticResource SettingsLabel}"/>
</StackPanel>
<StackPanel HorizontalAlignment="Center">
<TextBox Text="{Binding MeMax, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource SettingsTextBox}"/>
<TextBlock Text="{DynamicResource PumpCtrl.Max}" Style="{StaticResource SettingsLabel}"/>
</StackPanel>
</UniformGrid>
</Border>
</Popup>
</StackPanel>
<!-- ── PreIn (always visible; disabled when pump lacks pre-injection) ── -->
<StackPanel Grid.Column="2" HorizontalAlignment="Center"
IsEnabled="{Binding IsPreInAvailable}">
<ToggleButton x:Name="PreInToggle"
Width="28" Height="22"
HorizontalAlignment="Center"
Background="Transparent" BorderBrush="Transparent"
Content="..." FontWeight="Bold" FontSize="13"
ToolTip="{DynamicResource PumpCtrl.MinStepMax}"/>
<TextBlock Text="{Binding PreInMax, StringFormat=F1}"
Style="{StaticResource PumpCommandLabel}"
Margin="0,4,0,2"/>
<Slider Style="{StaticResource FluentThickVerticalSlider}"
Orientation="Vertical"
Minimum="{Binding PreInMin}" Maximum="{Binding PreInMax}"
Value="{Binding PreInValue}"
TickFrequency="{Binding PreInStep}"
IsSnapToTickEnabled="True"
AutoToolTipPrecision="2"
Height="360" Width="52"
HorizontalAlignment="Center"
Loaded="Slider_Loaded"/>
<TextBlock Text="{Binding PreInMin, StringFormat=F1}"
Style="{StaticResource PumpCommandLabel}"
Margin="0,2,0,6"/>
<TextBlock Text="{DynamicResource Pump.Commands.PreIn}"
Style="{StaticResource PumpCommandLabel}"
Margin="0,0,0,2"/>
<TextBox Text="{Binding PreInValue, UpdateSourceTrigger=PropertyChanged, StringFormat=F2}"
Style="{StaticResource PumpCommandValue}"/>
<Popup IsOpen="{Binding IsChecked, ElementName=PreInToggle}"
StaysOpen="False" Placement="Bottom" AllowsTransparency="True">
<Border Background="#BB000000" Padding="8,6" CornerRadius="3">
<UniformGrid Columns="3" Width="180">
<StackPanel HorizontalAlignment="Center">
<TextBox Text="{Binding PreInMin, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource SettingsTextBox}"/>
<TextBlock Text="{DynamicResource PumpCtrl.Min}" Style="{StaticResource SettingsLabel}"/>
</StackPanel>
<StackPanel HorizontalAlignment="Center">
<TextBox Text="{Binding PreInStep, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource SettingsTextBox}"/>
<TextBlock Text="{DynamicResource PumpCtrl.Step}" Style="{StaticResource SettingsLabel}"/>
</StackPanel>
<StackPanel HorizontalAlignment="Center">
<TextBox Text="{Binding PreInMax, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource SettingsTextBox}"/>
<TextBlock Text="{DynamicResource PumpCtrl.Max}" Style="{StaticResource SettingsLabel}"/>
</StackPanel>
</UniformGrid>
</Border>
</Popup>
</StackPanel>
</Grid>
</DockPanel>
</Border>
</UserControl>