Replace the monolithic MainWindow with a SelectedPage-driven shell (Dashboard / Pump / Bench / Tests / Results / Settings). The Tests page gets the Plan -> Preconditions -> Running -> Done wizard from ui-structure.md \u00a74, backed by a 7-item precondition gate and shared sub-views (PhaseCardView / TestSectionView / GraphicIndicatorView) extracted from the now-deleted monolithic TestPanelView. New VMs / views: - Tests wizard: TestPreconditions, PhaseCard, GraphicIndicator, TestSection, TestPlan, TestRunning, TestDone - Dashboard panels: DashboardConnection, DashboardReadings, DashboardAlarms, InterlockBanner, ResultHistory - Pump / bench panels: PumpIdentificationPanel, PumpLiveData, UnlockPanel, BenchDriveControl, BenchReadings, RelayBank, TemperatureControl, DtcList, AuthGate - Dialogs: generic ConfirmDialog, UserManageDialog, UserPromptDialog Supporting changes: - IsOilPumpOn exposed on MainViewModel for precondition evaluation - RequiresAuth added to TestDefinition (XML round-trip) - BipStatusDefinition + CompletedTestRun models - ~35 new Test.* localization keys (en + es) - Settings moved from modal dialog to full page - Pause / Retry / Skip stubs in TestRunningView; full spec in docs/gap-test-running-controls.md for follow-up implementation - docs/ui-structure.md captures the wizard design Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
67 lines
3.0 KiB
C#
67 lines
3.0 KiB
C#
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using CommunityToolkit.Mvvm.Input;
|
|
using HC_APTBS.Services;
|
|
|
|
namespace HC_APTBS.ViewModels
|
|
{
|
|
/// <summary>
|
|
/// A single row in the Tests-page preconditions checklist.
|
|
/// <para>Labels and remediation hints are localised strings resolved by the parent
|
|
/// <see cref="TestPreconditionsViewModel"/> and refreshed whenever
|
|
/// <see cref="ILocalizationService.LanguageChanged"/> fires. The item itself only
|
|
/// carries the currently-resolved text plus a navigation hook so the view can offer
|
|
/// a "fix-it" link when the check fails.</para>
|
|
/// </summary>
|
|
public sealed partial class PreconditionItemViewModel : ObservableObject
|
|
{
|
|
/// <summary>Stable identifier used by the parent VM to look items up when refreshing.</summary>
|
|
public string Id { get; }
|
|
|
|
/// <summary>Localised human-readable check label (e.g. "Oil pump ON").</summary>
|
|
[ObservableProperty] private string _label = string.Empty;
|
|
|
|
/// <summary>True when the associated runtime check currently passes.</summary>
|
|
[ObservableProperty] private bool _isSatisfied;
|
|
|
|
/// <summary>When false, this check is advisory only and does not block Start.</summary>
|
|
[ObservableProperty] private bool _isRequired = true;
|
|
|
|
/// <summary>Localised fix-it hint shown when the check fails (e.g. "Go to Bench → start oil pump").</summary>
|
|
[ObservableProperty] private string _remediationText = string.Empty;
|
|
|
|
/// <summary>When non-null, the remediation button navigates to this page.</summary>
|
|
public AppPage? RemediationTargetPage { get; }
|
|
|
|
/// <summary>True when the remediation action should be offered (failing + has a target page).</summary>
|
|
public bool HasRemediation => !IsSatisfied && RemediationTargetPage.HasValue;
|
|
|
|
private readonly MainViewModel _root;
|
|
|
|
/// <param name="id">Stable identifier (used by the parent VM to patch state).</param>
|
|
/// <param name="root">Root view-model used to drive page navigation.</param>
|
|
/// <param name="remediationTargetPage">Destination page when the fix-it link is clicked, or null when no page applies.</param>
|
|
/// <param name="isRequired">When false this item is advisory only.</param>
|
|
public PreconditionItemViewModel(
|
|
string id,
|
|
MainViewModel root,
|
|
AppPage? remediationTargetPage = null,
|
|
bool isRequired = true)
|
|
{
|
|
Id = id;
|
|
_root = root;
|
|
RemediationTargetPage = remediationTargetPage;
|
|
_isRequired = isRequired;
|
|
}
|
|
|
|
/// <summary>Navigates the shell to the remediation target page.</summary>
|
|
[RelayCommand]
|
|
private void NavigateToFix()
|
|
{
|
|
if (RemediationTargetPage.HasValue)
|
|
_root.SelectedPage = RemediationTargetPage.Value;
|
|
}
|
|
|
|
partial void OnIsSatisfiedChanged(bool value) => OnPropertyChanged(nameof(HasRemediation));
|
|
}
|
|
}
|