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:
72
ViewModels/Dialogs/RpmSafetyWarningViewModel.cs
Normal file
72
ViewModels/Dialogs/RpmSafetyWarningViewModel.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
|
||||
namespace HC_APTBS.ViewModels.Dialogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Result of the RPM safety warning dialog.
|
||||
/// </summary>
|
||||
public enum RpmSafetyResult
|
||||
{
|
||||
/// <summary>User cancelled — do not start the motor.</summary>
|
||||
Cancel,
|
||||
|
||||
/// <summary>Turn on oil pump first, then start the motor.</summary>
|
||||
ProceedWithOil,
|
||||
|
||||
/// <summary>Proceed without oil pump (operator acknowledges risk).</summary>
|
||||
ProceedWithoutOil
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ViewModel for the RPM safety warning dialog shown when the operator
|
||||
/// starts the bench motor while the oil pump is OFF.
|
||||
/// Equivalent to the old <c>WCareOnRpmOn</c> dialog.
|
||||
/// </summary>
|
||||
public sealed partial class RpmSafetyWarningViewModel : ObservableObject
|
||||
{
|
||||
// ── Dialog result ─────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>The operator's chosen action.</summary>
|
||||
public RpmSafetyResult Result { get; private set; } = RpmSafetyResult.Cancel;
|
||||
|
||||
// ── Radio button selection ────────────────────────────────────────────────
|
||||
|
||||
/// <summary>True when the "turn on oil pump and proceed" option is selected.</summary>
|
||||
[ObservableProperty]
|
||||
[NotifyCanExecuteChangedFor(nameof(AcceptCommand))]
|
||||
private bool _isOilAndProceedSelected;
|
||||
|
||||
/// <summary>True when the "proceed without oil" option is selected.</summary>
|
||||
[ObservableProperty]
|
||||
[NotifyCanExecuteChangedFor(nameof(AcceptCommand))]
|
||||
private bool _isProceedWithoutOilSelected;
|
||||
|
||||
// ── Commands ──────────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>Accepts the selected option and closes the dialog.</summary>
|
||||
[RelayCommand(CanExecute = nameof(CanAccept))]
|
||||
private void Accept()
|
||||
{
|
||||
Result = IsOilAndProceedSelected
|
||||
? RpmSafetyResult.ProceedWithOil
|
||||
: RpmSafetyResult.ProceedWithoutOil;
|
||||
RequestClose?.Invoke();
|
||||
}
|
||||
|
||||
private bool CanAccept() => IsOilAndProceedSelected || IsProceedWithoutOilSelected;
|
||||
|
||||
/// <summary>Cancels and closes the dialog.</summary>
|
||||
[RelayCommand]
|
||||
private void Cancel()
|
||||
{
|
||||
Result = RpmSafetyResult.Cancel;
|
||||
RequestClose?.Invoke();
|
||||
}
|
||||
|
||||
// ── Events ────────────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>Raised when the dialog should close itself.</summary>
|
||||
public event System.Action? RequestClose;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user