using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; namespace HC_APTBS.ViewModels.Dialogs { /// /// ViewModel for the oil pump confirmation dialog shown before activating /// the oil pump relay. The operator must confirm that oil level and /// connections have been checked. /// Equivalent to the old WAcceptOilTurnOn dialog. /// public sealed partial class OilPumpConfirmViewModel : ObservableObject { // ── Dialog result ───────────────────────────────────────────────────────── /// True if the operator confirmed and accepted. public bool Accepted { get; private set; } // ── Checkbox ────────────────────────────────────────────────────────────── /// True when the "I have checked for leaks" checkbox is ticked. [ObservableProperty] [NotifyCanExecuteChangedFor(nameof(AcceptCommand))] private bool _leaksChecked; // ── Commands ────────────────────────────────────────────────────────────── /// Confirms the oil pump activation and closes the dialog. [RelayCommand(CanExecute = nameof(CanAccept))] private void Accept() { Accepted = true; RequestClose?.Invoke(); } private bool CanAccept() => LeaksChecked; /// Cancels the oil pump activation and closes the dialog. [RelayCommand] private void Cancel() { Accepted = false; RequestClose?.Invoke(); } // ── Events ──────────────────────────────────────────────────────────────── /// Raised when the dialog should close itself. public event System.Action? RequestClose; } }