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

@@ -2,6 +2,7 @@ using System.Collections.ObjectModel;
using System.Linq;
using CommunityToolkit.Mvvm.ComponentModel;
using HC_APTBS.Models;
using HC_APTBS.Services;
namespace HC_APTBS.ViewModels
{
@@ -11,6 +12,11 @@ namespace HC_APTBS.ViewModels
/// </summary>
public sealed partial class TestSectionViewModel : ObservableObject
{
private readonly ILocalizationService _loc;
/// <summary>Initialises a new test section with a localization service.</summary>
public TestSectionViewModel(ILocalizationService loc) => _loc = loc;
// ── Suppress cascade guard ────────────────────────────────────────────────
private bool _suppressCascade;
@@ -105,12 +111,13 @@ namespace HC_APTBS.ViewModels
/// </summary>
/// <param name="test">Source test definition.</param>
/// <param name="showValues">Initial show-operation-values state.</param>
public static TestSectionViewModel FromDefinition(TestDefinition test, bool showValues)
/// <param name="loc">Localization service for user-facing strings.</param>
public static TestSectionViewModel FromDefinition(TestDefinition test, bool showValues, ILocalizationService loc)
{
var section = new TestSectionViewModel
var section = new TestSectionViewModel(loc)
{
TestName = test.Name,
Description = MapDescription(test.Name),
Description = loc.GetString(MapDescriptionKey(test.Name)),
ConditioningTimeSec = test.ConditioningTimeSec,
MeasurementTimeSec = test.MeasurementTimeSec,
MeasurementsPerSecond = test.MeasurementsPerSecond,
@@ -119,12 +126,12 @@ namespace HC_APTBS.ViewModels
foreach (var phaseDef in test.Phases)
{
var card = new PhaseCardViewModel
var card = new PhaseCardViewModel(loc)
{
Name = phaseDef.Name,
IsCritical = phaseDef.IsCritical,
IsEnabled = phaseDef.Enabled,
ResultText = phaseDef.Enabled ? "\u2013" : "disabled",
ResultText = phaseDef.Enabled ? "\u2013" : loc.GetString("Common.Disabled"),
ShowOperationValues = showValues,
Source = phaseDef,
EnabledChanged = section.OnChildEnabledChanged
@@ -157,16 +164,17 @@ namespace HC_APTBS.ViewModels
}
/// <summary>
/// Maps a test type identifier to a human-readable description.
/// Maps a test type identifier to a localization resource key.
/// Returns the test name itself for unknown types (fail-visible).
/// </summary>
private static string MapDescription(string testName) => testName switch
private static string MapDescriptionKey(string testName) => testName switch
{
TestType.Wl => "Warm-up",
TestType.Dfi => "Adjustment",
TestType.F => "Flow",
TestType.Svme => "Servo valve",
TestType.Up => "Upstroke",
TestType.Pfp => "Pre-injection",
TestType.Wl => "TestType.Warmup",
TestType.Dfi => "TestType.Adjustment",
TestType.F => "TestType.Flow",
TestType.Svme => "TestType.ServoValve",
TestType.Up => "TestType.Upstroke",
TestType.Pfp => "TestType.PreInjection",
_ => testName
};
}