feat: page-based navigation shell + Tests page wizard
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>
This commit is contained in:
@@ -105,6 +105,19 @@ namespace HC_APTBS.Models
|
||||
/// </summary>
|
||||
public double Alpha { get; set; } = 1.0;
|
||||
|
||||
// ── Runtime-warning plumbing ──────────────────────────────────────────────
|
||||
|
||||
/// <summary>
|
||||
/// Static logging hook invoked when <see cref="GetTransformResult"/> encounters
|
||||
/// a zero denominator. Wired at app startup to <c>IAppLogger.Warning</c>.
|
||||
/// Left null keeps the Models layer DI-free and testable.
|
||||
/// Signature: (source, message).
|
||||
/// </summary>
|
||||
public static Action<string, string>? WarningLogger { get; set; }
|
||||
|
||||
/// <summary>Set once per instance after the first zero-denominator warning, to prevent hot-loop log spam.</summary>
|
||||
private bool _warnedDenomZero;
|
||||
|
||||
// ── Convenience alias kept for cross-file compatibility ───────────────────
|
||||
|
||||
/// <summary>Alias for <see cref="MessageId"/> — used by legacy call sites.</summary>
|
||||
@@ -144,16 +157,40 @@ namespace HC_APTBS.Models
|
||||
/// <summary>
|
||||
/// Applies the P1–P6 rational transfer function to <see cref="Value"/>.
|
||||
/// Used only by pump params (<see cref="UseLegacyTransform"/> = true).
|
||||
/// Returns 0 and warns once if the denominator is zero.
|
||||
/// </summary>
|
||||
public double GetTransformResult()
|
||||
{
|
||||
if (IsReceive)
|
||||
{
|
||||
return (-P2 - P3 * P5 - P4 * P6 + P4 * Value)
|
||||
/ (P1 + P3 * P5 + P3 * P6 - P3 * Value);
|
||||
double denom = P1 + P3 * P5 + P3 * P6 - P3 * Value;
|
||||
if (denom == 0.0)
|
||||
{
|
||||
if (!_warnedDenomZero)
|
||||
{
|
||||
WarningLogger?.Invoke(nameof(CanBusParameter),
|
||||
$"Zero denominator for '{Name}' (receive). Returning 0.");
|
||||
_warnedDenomZero = true;
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
return (-P2 - P3 * P5 - P4 * P6 + P4 * Value) / denom;
|
||||
}
|
||||
|
||||
return ((P1 * Value + P2) / (P3 * Value + P4)) + P5 + P6;
|
||||
{
|
||||
double denom = P3 * Value + P4;
|
||||
if (denom == 0.0)
|
||||
{
|
||||
if (!_warnedDenomZero)
|
||||
{
|
||||
WarningLogger?.Invoke(nameof(CanBusParameter),
|
||||
$"Zero denominator for '{Name}' (transmit). Returning 0.");
|
||||
_warnedDenomZero = true;
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
return ((P1 * Value + P2) / denom) + P5 + P6;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -185,13 +222,22 @@ namespace HC_APTBS.Models
|
||||
/// </summary>
|
||||
public static CanBusParameter FromXml(XElement xe)
|
||||
{
|
||||
string name = xe.Name.LocalName;
|
||||
ushort byteh = ushort.Parse(xe.Attribute("byteh")?.Value ?? "0");
|
||||
ushort bytel = ushort.Parse(xe.Attribute("bytel")?.Value ?? "0");
|
||||
if (byteh > 7 || bytel > 7)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(xe),
|
||||
$"Param '{name}': byteh={byteh} bytel={bytel} out of 0-7.");
|
||||
}
|
||||
|
||||
var p = new CanBusParameter
|
||||
{
|
||||
Name = xe.Name.LocalName,
|
||||
Name = name,
|
||||
MessageId = uint.Parse(xe.Attribute("busid")?.Value ?? "0",
|
||||
NumberStyles.HexNumber),
|
||||
ByteH = ushort.Parse(xe.Attribute("byteh")?.Value ?? "0"),
|
||||
ByteL = ushort.Parse(xe.Attribute("bytel")?.Value ?? "0"),
|
||||
ByteH = byteh,
|
||||
ByteL = bytel,
|
||||
Type = int.Parse(xe.Attribute("type")?.Value ?? "0"),
|
||||
IsReceive = !string.Equals(xe.Attribute("send")?.Value, "true",
|
||||
StringComparison.OrdinalIgnoreCase),
|
||||
|
||||
Reference in New Issue
Block a user