feat: redesign Pump page with Fluent card layout, bottom snackbar, and RPM chart

- Replace sub-nav + HiddenTabsTabControl with 3-column Fluent card layout:
  PumpCommandsCard (vertical ME/FBKW/PreIn sliders) + DfiCalibrationCard /
  PumpLiveDataCard (KPI tiles + RPM rolling chart + redesigned status bytes) /
  PumpIdentificationCard + DtcCard
- Add PumpTopStripView: pump selector, model badge, CAN + K-Line chips
- Move immobilizer unlock to MainWindow bottom snackbar (UnlockSnackbarView):
  auto-close on success after 3 s, persist on failure with manual Dismiss
- Redesign StatusDisplayView to 2×8 rounded 28px tiles with bit index + tooltip
- Add NullToVisibilityConverter; add SnackbarShell, PumpCard, and related styles
- Delete obsolete views: UnlockProgressDialog, UnlockPanelView,
  PumpIdentificationPanelView, PumpLiveDataView, DfiManageView,
  DtcListView, PumpControlView
- PumpPageViewModel: remove PumpSubPage enum, add RpmChart wired to Root.PumpRpm

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-20 14:03:47 +02:00
parent 197e9d1775
commit 70be693116
37 changed files with 1356 additions and 1317 deletions

View File

@@ -1,33 +1,19 @@
using System.ComponentModel;
using System.Windows;
using CommunityToolkit.Mvvm.ComponentModel;
using HC_APTBS.Models;
using HC_APTBS.ViewModels.Dialogs;
using SkiaSharp;
namespace HC_APTBS.ViewModels.Pages
{
/// <summary>Identifies the sub-section shown inside the Pump navigation page.</summary>
public enum PumpSubPage
{
/// <summary>§3.a — Pump selection and K-Line ECU read.</summary>
Identification = 0,
/// <summary>§3.b — Diagnostic Trouble Codes.</summary>
Dtcs = 1,
/// <summary>§3.c — Live pump CAN readings and status words.</summary>
LiveData = 2,
/// <summary>§3.d — DFI calibration and ME/FBKW/PreIn manual control (auth-gated).</summary>
Adaptation = 3,
/// <summary>§3.e — Ford VP44 immobilizer unlock (visible only when required).</summary>
Unlock = 4
}
/// <summary>
/// ViewModel for the Pump navigation page.
///
/// <para>Thin façade that groups the pump-related child ViewModels owned by
/// <see cref="MainViewModel"/> and adds sub-page navigation, banner flags,
/// and the Adaptation auth gate. Holds a <see cref="Root"/> reference so
/// page XAML can bind to MainViewModel-owned properties (PumpRpm, PumpTemp,
/// KLineState, …) via <c>{Binding Root.X}</c>.</para>
/// <see cref="MainViewModel"/> and adds banner flags. Holds a <see cref="Root"/>
/// reference so page XAML can bind to MainViewModel-owned properties (PumpRpm,
/// PumpTemp, KLineState, …) via <c>{Binding Root.X}</c>.</para>
/// </summary>
public sealed partial class PumpPageViewModel : ObservableObject
{
@@ -36,31 +22,29 @@ namespace HC_APTBS.ViewModels.Pages
// ── Child VM façades ──────────────────────────────────────────────────────
/// <summary>Pump selector and K-Line read (§3.a).</summary>
/// <summary>Pump selector and K-Line read.</summary>
public PumpIdentificationViewModel Identification => Root.PumpIdentification;
/// <summary>Diagnostic Trouble Code list (§3.b).</summary>
/// <summary>Diagnostic Trouble Code list.</summary>
public DtcListViewModel DtcList { get; }
/// <summary>DFI management (§3.d).</summary>
/// <summary>DFI management.</summary>
public DfiManageViewModel DfiViewModel => Root.DfiViewModel;
/// <summary>Manual pump control sliders (§3.d).</summary>
/// <summary>Manual pump control sliders.</summary>
public PumpControlViewModel PumpControl => Root.PumpControl;
/// <summary>First pump status display — Status word (§3.c).</summary>
/// <summary>First pump status display — Status word.</summary>
public StatusDisplayViewModel StatusDisplay1 => Root.StatusDisplay1;
/// <summary>Second pump status display — Empf3 word (§3.c).</summary>
/// <summary>Second pump status display — Empf3 word.</summary>
public StatusDisplayViewModel StatusDisplay2 => Root.StatusDisplay2;
/// <summary>Current immobilizer unlock VM (§3.e). Null when no unlock is in progress for this pump.</summary>
/// <summary>Current immobilizer unlock VM. Null when no unlock is in progress.</summary>
public UnlockProgressViewModel? UnlockVm => Root.CurrentUnlockVm;
// ── Navigation state ──────────────────────────────────────────────────────
/// <summary>Currently selected Pump sub-section.</summary>
[ObservableProperty] private PumpSubPage _selectedSubPage = PumpSubPage.Identification;
/// <summary>Real-time RPM chart (120-sample rolling window).</summary>
public SingleFlowChartViewModel RpmChart { get; }
// ── Banner flags (derived from Root state) ────────────────────────────────
@@ -81,13 +65,12 @@ namespace HC_APTBS.ViewModels.Pages
MainViewModel root,
DtcListViewModel dtcList)
{
Root = root;
Root = root;
DtcList = dtcList;
RpmChart = new SingleFlowChartViewModel("RPM", new SKColor(0x21, 0x96, 0xF3), maxSamples: 120);
// Initialise derived flags from the current Root state.
RefreshDerivedFlags();
// Keep the derived flags in sync with Root changes.
Root.PropertyChanged += OnRootPropertyChanged;
Root.PumpIdentification.PumpChanged += _ => RefreshDerivedFlags();
}
@@ -104,19 +87,23 @@ namespace HC_APTBS.ViewModels.Pages
case nameof(MainViewModel.CurrentUnlockVm):
OnPropertyChanged(nameof(UnlockVm));
break;
case nameof(MainViewModel.PumpRpm):
Application.Current.Dispatcher.Invoke(() => RpmChart.AddValue(Root.PumpRpm));
break;
}
}
private void RefreshDerivedFlags()
{
IsPumpSelected = Root.CurrentPump != null;
IsKLineSessionOpen = Root.KLineState == KLineConnectionState.Connected;
IsKLineSessionFailed = Root.KLineState == KLineConnectionState.Failed;
IsUnlockApplicable = Root.CurrentPump != null && Root.CurrentPump.UnlockType != 0;
IsPumpSelected = Root.CurrentPump != null;
IsKLineSessionOpen = Root.KLineState == KLineConnectionState.Connected;
IsKLineSessionFailed = Root.KLineState == KLineConnectionState.Failed;
IsUnlockApplicable = Root.CurrentPump != null && Root.CurrentPump.UnlockType != 0;
OnPropertyChanged(nameof(UnlockVm));
// Drop any stale DTCs from the previous pump.
DtcList.Reset();
RpmChart.Clear();
}
}
}