feat: add Ford VP44 unlock progress dialog, K-Line fast unlock, localization, safety dialogs, and settings

Unlock progress UI:
- UnlockProgressDialog with dark-themed progress ring, phase indicator, elapsed
  time, and cancel/close buttons (non-modal, draggable borderless window)
- UnlockProgressViewModel with event-driven progress tracking via IUnlockService
- Triggers on pump selection (manual or K-Line auto-detect), not test start

UnlockService rewrite:
- Persistent CAN senders that outlive the unlock sequence (StopSenders on pump change)
- Concurrent K-Line fast unlock: awaits session Connected, sends RAM timer shortcut
  ({02 88 02 03 A8 01 00}), verifies via CAN TestUnlock before skipping wait
- Fix Type 1 verification (Value == 0 means unlocked, was inverted)

K-Line fast unlock support:
- IKwpService.TryFastUnlockAsync / KwpService implementation

Additional features:
- ILocalizationService with ES/EN resource dictionaries and runtime switching
- Safety dialogs: VoltageWarning, OilPumpConfirm, RpmSafetyWarning
- SettingsDialog for app configuration
- BenchService enhancements, ConfigurationService improvements, PDF report updates
- All UI strings localized via DynamicResource

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-16 13:22:48 +02:00
parent c617854c09
commit 37d099cdbd
55 changed files with 3207 additions and 379 deletions

View File

@@ -7,7 +7,7 @@
xmlns:uc="clr-namespace:HC_APTBS.Views.UserControls"
xmlns:models="clr-namespace:HC_APTBS.Models"
mc:Ignorable="d"
Title="HC_APTBS — Herlic Test Bench"
Title="{DynamicResource App.Title}"
Height="1080" Width="1920"
WindowState="Maximized"
WindowStartupLocation="CenterScreen"
@@ -68,7 +68,8 @@
<!-- ── Menu bar ──────────────────────────────────────────────────── -->
<Menu DockPanel.Dock="Top" Background="#FFEDEDED">
<MenuItem Header="Settings" Command="{Binding SaveSettingsCommand}"/>
<MenuItem Header="{DynamicResource Menu.Settings}" Command="{Binding OpenSettingsCommand}"/>
<MenuItem Header="{DynamicResource App.LanguageLabel}" Command="{Binding ToggleLanguageCommand}"/>
</Menu>
<!-- ── Status bar ─────────────────────────────────────────────────── -->
@@ -105,7 +106,7 @@
<!-- ══════════════════════════════════════════════════════════════
LEFT PANEL — bench status and controls
══════════════════════════════════════════════════════════════ -->
<Expander Header="Bench" IsExpanded="True" Margin="0,2,0,0">
<Expander Header="{DynamicResource Bench.Header}" IsExpanded="True" Margin="0,2,0,0">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<Grid Margin="5">
<Grid.RowDefinitions>
@@ -126,7 +127,7 @@
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Text="Status:" VerticalAlignment="Center"
<TextBlock Text="{DynamicResource Status.Label}" VerticalAlignment="Center"
FontSize="10" Margin="0,0,6,0"/>
<Border Grid.Column="1">
@@ -139,7 +140,7 @@
</Style.Triggers>
</Style>
</Border.Style>
<TextBlock Text="CAN" HorizontalAlignment="Center"
<TextBlock Text="{DynamicResource Status.Can}" HorizontalAlignment="Center"
FontSize="10" Padding="2"/>
</Border>
@@ -153,7 +154,7 @@
</Style.Triggers>
</Style>
</Border.Style>
<TextBlock Text="Bench" HorizontalAlignment="Center"
<TextBlock Text="{DynamicResource Status.Bench}" HorizontalAlignment="Center"
FontSize="10" Padding="2"/>
</Border>
@@ -167,7 +168,7 @@
</Style.Triggers>
</Style>
</Border.Style>
<TextBlock Text="Pump" HorizontalAlignment="Center"
<TextBlock Text="{DynamicResource Status.Pump}" HorizontalAlignment="Center"
FontSize="10" Padding="2"/>
</Border>
@@ -184,7 +185,7 @@
</Style.Triggers>
</Style>
</Border.Style>
<TextBlock Text="K-Line" HorizontalAlignment="Center"
<TextBlock Text="{DynamicResource Status.KLine}" HorizontalAlignment="Center"
FontSize="10" Padding="2"/>
</Border>
</Grid>
@@ -192,9 +193,9 @@
<!-- ── Row 1: CAN connect / disconnect ─────────────────── -->
<StackPanel Grid.Row="1" Orientation="Horizontal" Margin="0,4">
<Button Content="Connect CAN" Width="110" Margin="0,0,6,0"
<Button Content="{DynamicResource Bench.ConnectCan}" Width="110" Margin="0,0,6,0"
Command="{Binding ConnectCanCommand}"/>
<Button Content="Disconnect CAN" Width="120"
<Button Content="{DynamicResource Bench.DisconnectCan}" Width="120"
Command="{Binding DisconnectCanCommand}"
IsEnabled="{Binding IsCanConnected}"/>
</StackPanel>
@@ -222,14 +223,14 @@
HorizontalAlignment="Right" VerticalAlignment="Center"
FontFamily="Consolas"/>
<StackPanel Grid.Column="1" VerticalAlignment="Center" Margin="6,0,0,0">
<TextBlock Text="rpm" FontSize="18" Foreground="#FFFFEB6E"/>
<TextBlock Text="{DynamicResource Bench.Rpm}" FontSize="18" Foreground="#FFFFEB6E"/>
</StackPanel>
</Grid>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<TextBlock Text="Target:" Foreground="#EBEBFF" FontSize="11" Margin="0,0,4,0"/>
<TextBlock Text="{DynamicResource Bench.Target}" Foreground="#EBEBFF" FontSize="11" Margin="0,0,4,0"/>
<TextBlock Text="{Binding BenchControl.TargetRpm, StringFormat=F0}"
Foreground="#FFFFEB6E" FontSize="11" FontFamily="Consolas" Margin="0,0,8,0"/>
<TextBlock Text="V:" Foreground="#EBEBFF" FontSize="11" Margin="0,0,4,0"/>
<TextBlock Text="{DynamicResource Bench.Voltage}" Foreground="#EBEBFF" FontSize="11" Margin="0,0,4,0"/>
<TextBlock Text="{Binding BenchControl.CommandVoltage, StringFormat=F3}"
Foreground="#FFFFEB6E" FontSize="11" FontFamily="Consolas"/>
</StackPanel>
@@ -253,12 +254,12 @@
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock Text="T. In:" Grid.Row="0" VerticalAlignment="Center" Foreground="#EBEBFF" FontSize="13"/>
<TextBlock Text="T. Out:" Grid.Row="1" VerticalAlignment="Center" Foreground="#EBEBFF" FontSize="13"/>
<TextBlock Text="T. 4:" Grid.Row="2" VerticalAlignment="Center" Foreground="#EBEBFF" FontSize="13"/>
<TextBlock Text="T. Tank:" Grid.Row="3" VerticalAlignment="Center" Foreground="#EBEBFF" FontSize="13"/>
<TextBlock Text="P1:" Grid.Row="4" VerticalAlignment="Center" Foreground="#EBEBFF" FontSize="13"/>
<TextBlock Text="P2:" Grid.Row="5" VerticalAlignment="Center" Foreground="#EBEBFF" FontSize="13"/>
<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.Temp4}" Grid.Row="2" VerticalAlignment="Center" Foreground="#EBEBFF" FontSize="13"/>
<TextBlock Text="{DynamicResource Bench.TempTank}" Grid.Row="3" VerticalAlignment="Center" Foreground="#EBEBFF" FontSize="13"/>
<TextBlock Text="{DynamicResource Bench.P1}" Grid.Row="4" VerticalAlignment="Center" Foreground="#EBEBFF" FontSize="13"/>
<TextBlock Text="{DynamicResource Bench.P2}" Grid.Row="5" VerticalAlignment="Center" Foreground="#EBEBFF" FontSize="13"/>
<TextBlock Text="{Binding TempIn, StringFormat=F1}" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Right" Foreground="#EBEBFF" FontSize="20" FontFamily="Consolas"/>
<TextBlock Text="{Binding TempOut, StringFormat=F1}" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right" Foreground="#EBEBFF" FontSize="20" FontFamily="Consolas"/>
@@ -288,12 +289,12 @@
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock Text="Q-Del.:" VerticalAlignment="Center" Foreground="#FFFFEB6E" FontSize="13"/>
<TextBlock Text="Q-Over:" Grid.Row="1" VerticalAlignment="Center" Foreground="#FFFFEB6E" FontSize="13"/>
<TextBlock Text="{DynamicResource Bench.QDelivery}" VerticalAlignment="Center" Foreground="#FFFFEB6E" FontSize="13"/>
<TextBlock Text="{DynamicResource Bench.QOver}" Grid.Row="1" VerticalAlignment="Center" Foreground="#FFFFEB6E" FontSize="13"/>
<TextBlock Text="{Binding QDelivery, StringFormat=F3}" Grid.Column="1" HorizontalAlignment="Right" Foreground="#FFFFEB6E" FontSize="22" FontFamily="Consolas"/>
<TextBlock Text="{Binding QOver, StringFormat=F3}" Grid.Column="1" Grid.Row="1" HorizontalAlignment="Right" Foreground="#FFFFEB6E" FontSize="22" FontFamily="Consolas"/>
<TextBlock Text="cc/stroke" Grid.Column="2" VerticalAlignment="Center" Foreground="#FFFFEB6E" FontSize="11" Margin="4,0"/>
<TextBlock Text="cc/stroke" Grid.Column="2" Grid.Row="1" VerticalAlignment="Center" Foreground="#FFFFEB6E" FontSize="11" Margin="4,0"/>
<TextBlock Text="{DynamicResource Bench.CcStroke}" Grid.Column="2" VerticalAlignment="Center" Foreground="#FFFFEB6E" FontSize="11" Margin="4,0"/>
<TextBlock Text="{DynamicResource Bench.CcStroke}" Grid.Column="2" Grid.Row="1" VerticalAlignment="Center" Foreground="#FFFFEB6E" FontSize="11" Margin="4,0"/>
</Grid>
</Border>
@@ -310,10 +311,10 @@
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock Text="P-RPM:" VerticalAlignment="Center" FontSize="12" Foreground="DimGray"/>
<TextBlock Text="P-Temp:" Grid.Row="1" VerticalAlignment="Center" FontSize="12" Foreground="DimGray"/>
<TextBlock Text="P-ME:" Grid.Row="2" VerticalAlignment="Center" FontSize="12" Foreground="DimGray"/>
<TextBlock Text="P-FBkW:" Grid.Row="3" VerticalAlignment="Center" FontSize="12" Foreground="DimGray"/>
<TextBlock Text="{DynamicResource Bench.PumpRpm}" VerticalAlignment="Center" FontSize="12" Foreground="DimGray"/>
<TextBlock Text="{DynamicResource Bench.PumpTemp}" Grid.Row="1" VerticalAlignment="Center" FontSize="12" Foreground="DimGray"/>
<TextBlock Text="{DynamicResource Bench.PumpMe}" Grid.Row="2" VerticalAlignment="Center" FontSize="12" Foreground="DimGray"/>
<TextBlock Text="{DynamicResource Bench.PumpFbkw}" Grid.Row="3" VerticalAlignment="Center" FontSize="12" Foreground="DimGray"/>
<TextBlock Text="{Binding PumpRpm, StringFormat=F0}" Grid.Column="1" HorizontalAlignment="Right" FontSize="16" FontFamily="Consolas"/>
<TextBlock Text="{Binding PumpTemp, StringFormat=F1}" Grid.Column="1" Grid.Row="1" HorizontalAlignment="Right" FontSize="16" FontFamily="Consolas"/>
<TextBlock Text="{Binding PumpMe, StringFormat=F2}" Grid.Column="1" Grid.Row="2" HorizontalAlignment="Right" FontSize="16" FontFamily="Consolas"/>
@@ -323,7 +324,7 @@
<!-- PSG encoder value -->
<StackPanel Orientation="Horizontal" Margin="0,4" Visibility="Collapsed">
<TextBlock Text="PSG Encoder:" VerticalAlignment="Center" FontSize="12" Margin="0,0,8,0"/>
<TextBlock Text="{DynamicResource Bench.PsgEncoder}" VerticalAlignment="Center" FontSize="12" Margin="0,0,8,0"/>
<TextBlock Text="{Binding PsgEncoderValue, StringFormat=F2}"
FontSize="16" FontFamily="Consolas" VerticalAlignment="Center"/>
</StackPanel>
@@ -334,15 +335,15 @@
<StackPanel Grid.Column="1" Width="160" Margin="6,0,0,0">
<!-- Direction toggle -->
<TextBlock Text="Direction" FontSize="10" Foreground="DimGray" Margin="0,4,0,2"/>
<TextBlock Text="{DynamicResource Bench.Direction}" FontSize="10" Foreground="DimGray" Margin="0,4,0,2"/>
<ToggleButton IsChecked="{Binding BenchControl.IsDirectionRight}"
Height="32" FontSize="12" FontWeight="SemiBold">
<ToggleButton.Style>
<Style TargetType="ToggleButton">
<Setter Property="Content" Value="LEFT"/>
<Setter Property="Content" Value="{DynamicResource Bench.Left}"/>
<Style.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Content" Value="RIGHT"/>
<Setter Property="Content" Value="{DynamicResource Bench.Right}"/>
</Trigger>
</Style.Triggers>
</Style>
@@ -350,18 +351,18 @@
</ToggleButton>
<!-- Start / Stop bench -->
<TextBlock Text="Bench Motor" FontSize="10" Foreground="DimGray" Margin="0,8,0,2"/>
<Button Content="START" FontSize="13" FontWeight="Bold" Height="36"
<TextBlock Text="{DynamicResource Bench.Motor}" FontSize="10" Foreground="DimGray" Margin="0,8,0,2"/>
<Button Content="{DynamicResource Bench.Start}" FontSize="13" FontWeight="Bold" Height="36"
Foreground="DarkGreen" Margin="0,0,0,4"
Command="{Binding BenchControl.OpenRpmPopupCommand}"/>
<Popup StaysOpen="False" Placement="Left"
IsOpen="{Binding BenchControl.IsRpmPopupOpen, Mode=TwoWay}">
<Border Background="White" BorderBrush="Black" BorderThickness="1" Padding="8">
<StackPanel Width="200">
<TextBlock Text="Set RPM:" FontSize="12" Margin="0,0,0,4"/>
<TextBlock Text="{DynamicResource Bench.SetRpm}" FontSize="12" Margin="0,0,0,4"/>
<TextBox Text="{Binding BenchControl.RpmInputText, UpdateSourceTrigger=PropertyChanged}"
FontSize="16" FontFamily="Consolas" Height="28" Margin="0,0,0,6"/>
<Button Content="GO" FontSize="13" FontWeight="Bold" Height="30"
<Button Content="{DynamicResource Bench.Go}" FontSize="13" FontWeight="Bold" Height="30"
Foreground="DarkGreen" Margin="0,0,0,6"
Command="{Binding BenchControl.StartBenchCommand}"/>
<UniformGrid Columns="5">
@@ -384,21 +385,21 @@
</StackPanel>
</Border>
</Popup>
<Button Content="STOP" FontSize="13" FontWeight="Bold" Height="36"
<Button Content="{DynamicResource Bench.Stop}" FontSize="13" FontWeight="Bold" Height="36"
Foreground="DarkRed"
Command="{Binding BenchControl.StopBenchCommand}"/>
<!-- Oil pump toggle -->
<TextBlock Text="Oil Pump" FontSize="10" Foreground="DimGray" Margin="0,8,0,2"/>
<TextBlock Text="{DynamicResource Bench.OilPump}" FontSize="10" Foreground="DimGray" Margin="0,8,0,2"/>
<ToggleButton IsChecked="{Binding BenchControl.IsOilPumpOn}"
Height="32" FontSize="12" FontWeight="SemiBold">
<ToggleButton.Style>
<Style TargetType="ToggleButton">
<Setter Property="Content" Value="OIL OFF"/>
<Setter Property="Content" Value="{DynamicResource Bench.OilOff}"/>
<Setter Property="Background" Value="LightGray"/>
<Style.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Content" Value="OIL ON"/>
<Setter Property="Content" Value="{DynamicResource Bench.OilOn}"/>
<Setter Property="Background" Value="#80FF80"/>
</Trigger>
</Style.Triggers>
@@ -407,18 +408,18 @@
</ToggleButton>
<!-- Turn counter -->
<TextBlock Text="Counter" FontSize="10" Foreground="DimGray" Margin="0,8,0,2"/>
<ToggleButton Content="Counter"
<TextBlock Text="{DynamicResource Bench.Counter}" FontSize="10" Foreground="DimGray" Margin="0,8,0,2"/>
<ToggleButton Content="{DynamicResource Bench.Counter}"
IsChecked="{Binding BenchControl.IsCounterPopupOpen}"
Height="28" FontSize="11"/>
<Popup StaysOpen="False" Placement="Left"
IsOpen="{Binding BenchControl.IsCounterPopupOpen, Mode=TwoWay}">
<Border Background="White" BorderBrush="Black" BorderThickness="1" Padding="8">
<StackPanel Width="160">
<TextBlock Text="Turns:" FontSize="12" Margin="0,0,0,4"/>
<TextBlock Text="{DynamicResource Bench.Turns}" FontSize="12" Margin="0,0,0,4"/>
<TextBox Text="{Binding BenchControl.CounterInputText, UpdateSourceTrigger=PropertyChanged}"
FontSize="16" FontFamily="Consolas" Height="28" Margin="0,0,0,4"/>
<Button Content="Send" FontSize="12" Height="28"
<Button Content="{DynamicResource Bench.Send}" FontSize="12" Height="28"
Command="{Binding BenchControl.SendCounterCommand}"/>
</StackPanel>
</Border>
@@ -427,11 +428,11 @@
Text="{Binding BenchControl.BenchCounterValue, StringFormat=00000000}"/>
<!-- Relay toggles -->
<TextBlock Text="Relays" FontSize="10" Foreground="DimGray" Margin="0,8,0,2"/>
<TextBlock Text="{DynamicResource Bench.Relays}" FontSize="10" Foreground="DimGray" Margin="0,8,0,2"/>
<StackPanel>
<Button Content="Electronic" Style="{StaticResource RelayButton}" Command="{Binding ToggleElectronicCommand}"/>
<Button Content="Deposit Cooler" Style="{StaticResource RelayButton}" Command="{Binding ToggleDepositCoolerCommand}"/>
<Button Content="Deposit Heater" Style="{StaticResource RelayButton}" Command="{Binding ToggleDepositHeaterCommand}"/>
<Button Content="{DynamicResource Bench.Electronic}" Style="{StaticResource RelayButton}" Command="{Binding ToggleElectronicCommand}"/>
<Button Content="{DynamicResource Bench.DepositCooler}" Style="{StaticResource RelayButton}" Command="{Binding ToggleDepositCoolerCommand}"/>
<Button Content="{DynamicResource Bench.DepositHeater}" Style="{StaticResource RelayButton}" Command="{Binding ToggleDepositHeaterCommand}"/>
</StackPanel>
</StackPanel>
@@ -493,9 +494,9 @@
<RowDefinition Height="1.2*"/>
</Grid.RowDefinitions>
<TextBlock Text="T-hyb" VerticalAlignment="Center" Foreground="#EBEBFF" FontSize="13"/>
<TextBlock Text="RPM" Grid.Row="1" VerticalAlignment="Center" Foreground="#EBEBFF" FontSize="13"/>
<TextBlock Text="T-ein" Grid.Row="2" VerticalAlignment="Center" Foreground="#EBEBFF" FontSize="13"/>
<TextBlock Text="{DynamicResource Pump.THyb}" VerticalAlignment="Center" Foreground="#EBEBFF" FontSize="13"/>
<TextBlock Text="{DynamicResource Pump.Rpm}" Grid.Row="1" VerticalAlignment="Center" Foreground="#EBEBFF" FontSize="13"/>
<TextBlock Text="{DynamicResource Pump.TEin}" Grid.Row="2" VerticalAlignment="Center" Foreground="#EBEBFF" FontSize="13"/>
<TextBlock Text="{Binding PumpTemp, StringFormat=F2}" Grid.Column="1"
HorizontalAlignment="Right" VerticalAlignment="Center"
@@ -508,7 +509,7 @@
Foreground="#EBEBFF" FontSize="20" FontWeight="Bold" FontFamily="Consolas"/>
<TextBlock Text="°C" Grid.Column="2" VerticalAlignment="Center" Foreground="#EBEBFF" FontSize="12" Margin="4,0"/>
<TextBlock Text="1/min" Grid.Column="2" Grid.Row="1" VerticalAlignment="Center" Foreground="#EBEBFF" FontSize="12" Margin="4,0"/>
<TextBlock Text="{DynamicResource Pump.UnitRpm}" Grid.Column="2" Grid.Row="1" VerticalAlignment="Center" Foreground="#EBEBFF" FontSize="12" Margin="4,0"/>
<TextBlock Text="µs" Grid.Column="2" Grid.Row="2" VerticalAlignment="Center" Foreground="#EBEBFF" FontSize="12" Margin="4,0"/>
</Grid>
</Border>