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:
59
Views/Dialogs/UserPromptDialog.xaml.cs
Normal file
59
Views/Dialogs/UserPromptDialog.xaml.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace HC_APTBS.Views.Dialogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Small input dialog that prompts for a username and password, or a password only.
|
||||
/// Used by <see cref="Views.Dialogs.UserManageDialog"/> when adding a new user or
|
||||
/// changing an existing user's password. Kept as a code-behind dialog (not MVVM)
|
||||
/// because it is a transient prompt with no shared state.
|
||||
/// </summary>
|
||||
public partial class UserPromptDialog : Window
|
||||
{
|
||||
/// <summary>Username entered by the operator. Empty when <see cref="UsernameVisible"/> is false.</summary>
|
||||
public string EnteredUsername { get; private set; } = string.Empty;
|
||||
|
||||
/// <summary>Password entered by the operator.</summary>
|
||||
public string EnteredPassword { get; private set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Creates the dialog.
|
||||
/// </summary>
|
||||
/// <param name="title">Window title (already-localised string).</param>
|
||||
/// <param name="usernameVisible">
|
||||
/// True to show the username field (Add user flow); false to hide it (Change password flow).
|
||||
/// </param>
|
||||
/// <param name="prefillUsername">
|
||||
/// Pre-filled, read-only username shown as a label when <paramref name="usernameVisible"/> is false.
|
||||
/// Ignored otherwise.
|
||||
/// </param>
|
||||
public UserPromptDialog(string title, bool usernameVisible, string prefillUsername = "")
|
||||
{
|
||||
InitializeComponent();
|
||||
Title = title;
|
||||
|
||||
if (usernameVisible)
|
||||
{
|
||||
EnteredUsername = string.Empty;
|
||||
TbUsername.Focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Hide username row; reserve width so layout doesn't shift.
|
||||
LblUsername.Visibility = Visibility.Collapsed;
|
||||
TbUsername.Visibility = Visibility.Collapsed;
|
||||
EnteredUsername = prefillUsername;
|
||||
PbPassword.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnAccept(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (TbUsername.Visibility == Visibility.Visible)
|
||||
EnteredUsername = TbUsername.Text;
|
||||
EnteredPassword = PbPassword.Password;
|
||||
DialogResult = true;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user