feat: move test buttons to right panel, add user auth dialog for reports
Move Start/Stop/Report buttons from the middle panel to the top of TestPanelView (automated tests section), matching the old application layout. Remove inline Operator/Client text fields — operator identity now comes from a UserCheckDialog (username/password) shown before the existing ReportDialog. Add credential storage to ConfigurationService. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -451,8 +451,6 @@
|
|||||||
<RowDefinition Height="Auto"/> <!-- Pump manual controls -->
|
<RowDefinition Height="Auto"/> <!-- Pump manual controls -->
|
||||||
<RowDefinition Height="Auto"/> <!-- Pump live data -->
|
<RowDefinition Height="Auto"/> <!-- Pump live data -->
|
||||||
<RowDefinition Height="Auto"/> <!-- Status displays -->
|
<RowDefinition Height="Auto"/> <!-- Status displays -->
|
||||||
<RowDefinition Height="Auto"/> <!-- Test controls -->
|
|
||||||
<RowDefinition Height="Auto"/> <!-- Operator / client -->
|
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<!-- Pump identification: selector + K-Line ECU info -->
|
<!-- Pump identification: selector + K-Line ECU info -->
|
||||||
@@ -509,42 +507,6 @@
|
|||||||
<uc:StatusDisplayView DataContext="{Binding StatusDisplay2}" Margin="0,4,0,0"/>
|
<uc:StatusDisplayView DataContext="{Binding StatusDisplay2}" Margin="0,4,0,0"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<!-- Test controls (Start / Stop) -->
|
|
||||||
<Border Grid.Row="6" Padding="6,8" BorderBrush="#999" BorderThickness="0,0,0,1">
|
|
||||||
<Grid>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition/>
|
|
||||||
<ColumnDefinition/>
|
|
||||||
<ColumnDefinition/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
|
|
||||||
<Button Content="▶ START TEST" FontSize="15" FontWeight="Bold"
|
|
||||||
Height="44" Margin="0,0,4,0"
|
|
||||||
Command="{Binding StartTestCommand}"
|
|
||||||
Foreground="DarkGreen"/>
|
|
||||||
<Button Grid.Column="1" Content="■ STOP" FontSize="15" FontWeight="Bold"
|
|
||||||
Height="44" Margin="4,0"
|
|
||||||
Command="{Binding StopTestCommand}"
|
|
||||||
Foreground="DarkRed"/>
|
|
||||||
<Button Grid.Column="2" Content="📄 Report" FontSize="13"
|
|
||||||
Height="44" Margin="4,0,0,0"
|
|
||||||
Command="{Binding GenerateReportCommand}"/>
|
|
||||||
</Grid>
|
|
||||||
</Border>
|
|
||||||
|
|
||||||
<!-- Operator / client entry -->
|
|
||||||
<StackPanel Grid.Row="7" Margin="6,8">
|
|
||||||
<StackPanel Orientation="Horizontal" Margin="0,4">
|
|
||||||
<TextBlock Text="Operator:" Width="65" VerticalAlignment="Center" FontSize="12"/>
|
|
||||||
<TextBox Text="{Binding OperatorName, UpdateSourceTrigger=PropertyChanged}"
|
|
||||||
Width="200" Height="22" FontSize="12"/>
|
|
||||||
</StackPanel>
|
|
||||||
<StackPanel Orientation="Horizontal" Margin="0,4">
|
|
||||||
<TextBlock Text="Client:" Width="65" VerticalAlignment="Center" FontSize="12"/>
|
|
||||||
<TextBox Text="{Binding ClientName, UpdateSourceTrigger=PropertyChanged}"
|
|
||||||
Width="200" Height="22" FontSize="12"/>
|
|
||||||
</StackPanel>
|
|
||||||
</StackPanel>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
|
|
||||||
|
|||||||
@@ -135,6 +135,12 @@ namespace HC_APTBS.Models
|
|||||||
/// <summary>Absolute path to the company logo image for the report.</summary>
|
/// <summary>Absolute path to the company logo image for the report.</summary>
|
||||||
public string ReportLogoPath { get; set; } = string.Empty;
|
public string ReportLogoPath { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Comma-separated <c>user:password</c> credential pairs for operator authentication
|
||||||
|
/// before report generation.
|
||||||
|
/// </summary>
|
||||||
|
public string Users { get; set; } = "admin:admin";
|
||||||
|
|
||||||
// ── K-Line port ───────────────────────────────────────────────────────
|
// ── K-Line port ───────────────────────────────────────────────────────
|
||||||
|
|
||||||
/// <summary>Serial port or FTDI device identifier for the K-Line interface.</summary>
|
/// <summary>Serial port or FTDI device identifier for the K-Line interface.</summary>
|
||||||
|
|||||||
@@ -62,5 +62,16 @@ namespace HC_APTBS.Services
|
|||||||
|
|
||||||
/// <summary>Saves updated sensor calibration data to <c>sensors.xml</c>.</summary>
|
/// <summary>Saves updated sensor calibration data to <c>sensors.xml</c>.</summary>
|
||||||
void SaveSensors();
|
void SaveSensors();
|
||||||
|
|
||||||
|
// ── Users ─────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
/// <summary>Validates a username/password pair against stored credentials.</summary>
|
||||||
|
bool ValidateUser(string username, string password);
|
||||||
|
|
||||||
|
/// <summary>Returns all stored user credentials as a dictionary.</summary>
|
||||||
|
IReadOnlyDictionary<string, string> GetUsers();
|
||||||
|
|
||||||
|
/// <summary>Replaces all stored user credentials and persists them.</summary>
|
||||||
|
void UpdateUsers(Dictionary<string, string> users);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,7 +94,8 @@ namespace HC_APTBS.Services.Impl
|
|||||||
new XElement("ReportLogoPath", Settings.ReportLogoPath),
|
new XElement("ReportLogoPath", Settings.ReportLogoPath),
|
||||||
new XElement("KLinePort", Settings.KLinePort),
|
new XElement("KLinePort", Settings.KLinePort),
|
||||||
new XElement("Language", Settings.Language),
|
new XElement("Language", Settings.Language),
|
||||||
new XElement("Relations", RpmVoltageRelation.Serialise(Settings.Relations))
|
new XElement("Relations", RpmVoltageRelation.Serialise(Settings.Relations)),
|
||||||
|
new XElement("Users", Settings.Users)
|
||||||
);
|
);
|
||||||
new XDocument(root).Save(ConfigXml);
|
new XDocument(root).Save(ConfigXml);
|
||||||
SaveSensors();
|
SaveSensors();
|
||||||
@@ -355,6 +356,7 @@ namespace HC_APTBS.Services.Impl
|
|||||||
TryString(r, "KLinePort", v => _settings.KLinePort = v);
|
TryString(r, "KLinePort", v => _settings.KLinePort = v);
|
||||||
TryString(r, "Language", v => _settings.Language = v);
|
TryString(r, "Language", v => _settings.Language = v);
|
||||||
TryString(r, "Relations", v => _settings.Relations = RpmVoltageRelation.Deserialise(v));
|
TryString(r, "Relations", v => _settings.Relations = RpmVoltageRelation.Deserialise(v));
|
||||||
|
TryString(r, "Users", v => _settings.Users = v);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -640,6 +642,46 @@ namespace HC_APTBS.Services.Impl
|
|||||||
try { var v = root.Element(name)?.Value; if (v != null) assign(v); }
|
try { var v = root.Element(name)?.Value; if (v != null) assign(v); }
|
||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ── Users ─────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public bool ValidateUser(string username, string password)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
string check = username + ":" + password;
|
||||||
|
foreach (string entry in Settings.Users.Split(','))
|
||||||
|
{
|
||||||
|
if (entry == check) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public IReadOnlyDictionary<string, string> GetUsers()
|
||||||
|
{
|
||||||
|
var dict = new Dictionary<string, string>();
|
||||||
|
foreach (string kv in Settings.Users.Split(','))
|
||||||
|
{
|
||||||
|
string[] parts = kv.Split(':');
|
||||||
|
if (parts.Length == 2 && parts[0].Length > 0)
|
||||||
|
dict[parts[0]] = parts[1];
|
||||||
|
}
|
||||||
|
return dict;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public void UpdateUsers(Dictionary<string, string> users)
|
||||||
|
{
|
||||||
|
var entries = new List<string>(users.Count);
|
||||||
|
foreach (var kv in users)
|
||||||
|
entries.Add(kv.Key + ":" + kv.Value);
|
||||||
|
|
||||||
|
Settings.Users = string.Join(",", entries);
|
||||||
|
SaveSettings();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── XPath extension shim ──────────────────────────────────────────────────────
|
// ── XPath extension shim ──────────────────────────────────────────────────────
|
||||||
|
|||||||
81
ViewModels/Dialogs/UserCheckViewModel.cs
Normal file
81
ViewModels/Dialogs/UserCheckViewModel.cs
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
using System.Windows;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
using HC_APTBS.Services;
|
||||||
|
|
||||||
|
namespace HC_APTBS.ViewModels.Dialogs
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// ViewModel for the user authentication dialog shown before report generation.
|
||||||
|
/// Validates operator credentials against the stored user list.
|
||||||
|
/// </summary>
|
||||||
|
public sealed partial class UserCheckViewModel : ObservableObject
|
||||||
|
{
|
||||||
|
private readonly IConfigurationService _config;
|
||||||
|
|
||||||
|
/// <summary>Initialises the dialog, optionally pre-filling the last used username.</summary>
|
||||||
|
public UserCheckViewModel(IConfigurationService config, string lastUsername = "")
|
||||||
|
{
|
||||||
|
_config = config;
|
||||||
|
_username = lastUsername;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Bindable properties ───────────────────────────────────────────────────
|
||||||
|
|
||||||
|
/// <summary>Username entered by the operator.</summary>
|
||||||
|
[ObservableProperty]
|
||||||
|
[NotifyCanExecuteChangedFor(nameof(AcceptCommand))]
|
||||||
|
private string _username = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>Password entered by the operator (set from code-behind PasswordChanged handler).</summary>
|
||||||
|
[ObservableProperty]
|
||||||
|
[NotifyCanExecuteChangedFor(nameof(AcceptCommand))]
|
||||||
|
private string _password = string.Empty;
|
||||||
|
|
||||||
|
// ── Dialog result ─────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
/// <summary>True if the user authenticated successfully.</summary>
|
||||||
|
public bool Accepted { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>The validated username, available after <see cref="Accepted"/> is true.</summary>
|
||||||
|
public string AuthenticatedUser { get; private set; } = string.Empty;
|
||||||
|
|
||||||
|
// ── Commands ──────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
/// <summary>Validates credentials and closes the dialog on success.</summary>
|
||||||
|
[RelayCommand(CanExecute = nameof(CanAccept))]
|
||||||
|
private void Accept()
|
||||||
|
{
|
||||||
|
if (_config.ValidateUser(Username, Password))
|
||||||
|
{
|
||||||
|
AuthenticatedUser = Username;
|
||||||
|
Accepted = true;
|
||||||
|
RequestClose?.Invoke();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show(
|
||||||
|
"Invalid username or password.\n(Both are case-sensitive.)",
|
||||||
|
"Authentication Error",
|
||||||
|
MessageBoxButton.OK,
|
||||||
|
MessageBoxImage.Stop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool CanAccept() => !string.IsNullOrWhiteSpace(Username)
|
||||||
|
&& !string.IsNullOrEmpty(Password);
|
||||||
|
|
||||||
|
/// <summary>Cancels authentication and closes the dialog.</summary>
|
||||||
|
[RelayCommand]
|
||||||
|
private void Cancel()
|
||||||
|
{
|
||||||
|
Accepted = false;
|
||||||
|
RequestClose?.Invoke();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Events ────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
/// <summary>Raised when the dialog should close itself.</summary>
|
||||||
|
public event System.Action? RequestClose;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,6 +9,8 @@ using CommunityToolkit.Mvvm.ComponentModel;
|
|||||||
using CommunityToolkit.Mvvm.Input;
|
using CommunityToolkit.Mvvm.Input;
|
||||||
using HC_APTBS.Models;
|
using HC_APTBS.Models;
|
||||||
using HC_APTBS.Services;
|
using HC_APTBS.Services;
|
||||||
|
using HC_APTBS.ViewModels.Dialogs;
|
||||||
|
using HC_APTBS.Views.Dialogs;
|
||||||
|
|
||||||
namespace HC_APTBS.ViewModels
|
namespace HC_APTBS.ViewModels
|
||||||
{
|
{
|
||||||
@@ -43,6 +45,9 @@ namespace HC_APTBS.ViewModels
|
|||||||
|
|
||||||
private CancellationTokenSource? _testCts;
|
private CancellationTokenSource? _testCts;
|
||||||
|
|
||||||
|
/// <summary>Remembers the last authenticated username to pre-fill the next auth dialog.</summary>
|
||||||
|
private string _lastAuthenticatedUser = string.Empty;
|
||||||
|
|
||||||
// ── Child ViewModels ──────────────────────────────────────────────────────
|
// ── Child ViewModels ──────────────────────────────────────────────────────
|
||||||
|
|
||||||
/// <summary>ViewModel for pump selection and K-Line ECU identification.</summary>
|
/// <summary>ViewModel for pump selection and K-Line ECU identification.</summary>
|
||||||
@@ -331,14 +336,6 @@ namespace HC_APTBS.ViewModels
|
|||||||
/// <summary>Verbose status message from bench/test operations.</summary>
|
/// <summary>Verbose status message from bench/test operations.</summary>
|
||||||
[ObservableProperty] private string _verboseStatus = string.Empty;
|
[ObservableProperty] private string _verboseStatus = string.Empty;
|
||||||
|
|
||||||
// ── Operator / client info ────────────────────────────────────────────────
|
|
||||||
|
|
||||||
/// <summary>Operator name for report generation.</summary>
|
|
||||||
[ObservableProperty] private string _operatorName = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>Client name for report generation.</summary>
|
|
||||||
[ObservableProperty] private string _clientName = string.Empty;
|
|
||||||
|
|
||||||
// ── Test saved state ──────────────────────────────────────────────────────
|
// ── Test saved state ──────────────────────────────────────────────────────
|
||||||
|
|
||||||
/// <summary>True when the current test results have been saved to a report.</summary>
|
/// <summary>True when the current test results have been saved to a report.</summary>
|
||||||
@@ -407,14 +404,28 @@ namespace HC_APTBS.ViewModels
|
|||||||
private void GenerateReport()
|
private void GenerateReport()
|
||||||
{
|
{
|
||||||
if (CurrentPump == null) return;
|
if (CurrentPump == null) return;
|
||||||
|
|
||||||
|
// Step 1: Authenticate operator.
|
||||||
|
var authVm = new UserCheckViewModel(_config, _lastAuthenticatedUser);
|
||||||
|
var authDlg = new UserCheckDialog(authVm) { Owner = Application.Current.MainWindow };
|
||||||
|
authDlg.ShowDialog();
|
||||||
|
if (!authVm.Accepted) return;
|
||||||
|
_lastAuthenticatedUser = authVm.AuthenticatedUser;
|
||||||
|
|
||||||
|
// Step 2: Collect report details (client, company, observations).
|
||||||
|
var reportVm = new ReportViewModel(_config) { OperatorName = authVm.AuthenticatedUser };
|
||||||
|
var reportDlg = new ReportDialog(reportVm) { Owner = Application.Current.MainWindow };
|
||||||
|
reportDlg.ShowDialog();
|
||||||
|
if (!reportVm.Accepted) return;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
|
string desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
|
||||||
string path = _pdf.GenerateReport(CurrentPump, OperatorName, ClientName, desktop);
|
string path = _pdf.GenerateReport(
|
||||||
|
CurrentPump, reportVm.OperatorName, reportVm.SelectedClientName, desktop);
|
||||||
_log.Info(LogId, $"Report saved: {path}");
|
_log.Info(LogId, $"Report saved: {path}");
|
||||||
IsTestSaved = true;
|
IsTestSaved = true;
|
||||||
|
|
||||||
// Open the generated PDF with the default viewer.
|
|
||||||
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(path)
|
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(path)
|
||||||
{ UseShellExecute = true });
|
{ UseShellExecute = true });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,7 +80,8 @@
|
|||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Label Content="Operator:" VerticalAlignment="Center" FontSize="13"/>
|
<Label Content="Operator:" VerticalAlignment="Center" FontSize="13"/>
|
||||||
<TextBox Grid.Column="1" Text="{Binding OperatorName, UpdateSourceTrigger=PropertyChanged}"
|
<TextBox Grid.Column="1" Text="{Binding OperatorName, UpdateSourceTrigger=PropertyChanged}"
|
||||||
VerticalAlignment="Center" FontSize="13" Margin="4,0" Height="24"/>
|
VerticalAlignment="Center" FontSize="13" Margin="4,0" Height="24"
|
||||||
|
IsReadOnly="True" Background="#F0F0F0"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- ── Company name ─────────────────────────────────────────────────── -->
|
<!-- ── Company name ─────────────────────────────────────────────────── -->
|
||||||
|
|||||||
43
Views/Dialogs/UserCheckDialog.xaml
Normal file
43
Views/Dialogs/UserCheckDialog.xaml
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<Window x:Class="HC_APTBS.Views.Dialogs.UserCheckDialog"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="User Authentication"
|
||||||
|
Height="170" Width="420"
|
||||||
|
ResizeMode="NoResize"
|
||||||
|
WindowStartupLocation="CenterOwner">
|
||||||
|
|
||||||
|
<Grid Margin="16,12">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="90"/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<!-- Username -->
|
||||||
|
<Label Content="Username:" VerticalAlignment="Center" HorizontalAlignment="Right"/>
|
||||||
|
<TextBox Grid.Column="1" Margin="8,4" Height="26" VerticalContentAlignment="Center"
|
||||||
|
Text="{Binding Username, UpdateSourceTrigger=PropertyChanged}"/>
|
||||||
|
|
||||||
|
<!-- Password -->
|
||||||
|
<Label Grid.Row="1" Content="Password:" VerticalAlignment="Center" HorizontalAlignment="Right"/>
|
||||||
|
<PasswordBox x:Name="PBPassword" Grid.Row="1" Grid.Column="1"
|
||||||
|
Margin="8,4" Height="26" VerticalContentAlignment="Center"
|
||||||
|
PasswordChanged="OnPasswordChanged"/>
|
||||||
|
|
||||||
|
<!-- Buttons -->
|
||||||
|
<StackPanel Grid.Row="2" Grid.Column="1"
|
||||||
|
Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,12,0,0">
|
||||||
|
<Button Content="Accept" Width="80" Height="26" Margin="0,0,8,0"
|
||||||
|
Command="{Binding AcceptCommand}" IsDefault="True"/>
|
||||||
|
<Button Content="Cancel" Width="80" Height="26"
|
||||||
|
Command="{Binding CancelCommand}" IsCancel="True"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
30
Views/Dialogs/UserCheckDialog.xaml.cs
Normal file
30
Views/Dialogs/UserCheckDialog.xaml.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using HC_APTBS.ViewModels.Dialogs;
|
||||||
|
|
||||||
|
namespace HC_APTBS.Views.Dialogs
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Authentication dialog that collects username and password before report generation.
|
||||||
|
/// </summary>
|
||||||
|
public partial class UserCheckDialog : Window
|
||||||
|
{
|
||||||
|
/// <summary>Creates the dialog and wires the ViewModel.</summary>
|
||||||
|
public UserCheckDialog(UserCheckViewModel vm)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
DataContext = vm;
|
||||||
|
vm.RequestClose += Close;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Forwards the PasswordBox value to the ViewModel.
|
||||||
|
/// WPF intentionally does not expose Password as a DependencyProperty.
|
||||||
|
/// </summary>
|
||||||
|
private void OnPasswordChanged(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (DataContext is UserCheckViewModel vm)
|
||||||
|
vm.Password = ((PasswordBox)sender).Password;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -308,13 +308,40 @@
|
|||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/> <!-- Test controls -->
|
||||||
<RowDefinition Height="Auto"/> <!-- Toolbar -->
|
<RowDefinition Height="Auto"/> <!-- Toolbar -->
|
||||||
<RowDefinition Height="Auto"/> <!-- Status bar -->
|
<RowDefinition Height="Auto"/> <!-- Status bar -->
|
||||||
<RowDefinition/> <!-- Test sections -->
|
<RowDefinition/> <!-- Test sections -->
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- ── Test controls (Start / Stop / Report) ──────────────────────── -->
|
||||||
|
<Border Padding="6,8" BorderBrush="#999" BorderThickness="0,0,0,1">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<Button Content="▶ START TEST" FontSize="15" FontWeight="Bold"
|
||||||
|
Height="44" Margin="0,0,4,0"
|
||||||
|
Command="{Binding DataContext.StartTestCommand,
|
||||||
|
RelativeSource={RelativeSource AncestorType=Window}}"
|
||||||
|
Foreground="DarkGreen"/>
|
||||||
|
<Button Grid.Column="1" Content="■ STOP" FontSize="15" FontWeight="Bold"
|
||||||
|
Height="44" Margin="4,0"
|
||||||
|
Command="{Binding DataContext.StopTestCommand,
|
||||||
|
RelativeSource={RelativeSource AncestorType=Window}}"
|
||||||
|
Foreground="DarkRed"/>
|
||||||
|
<Button Grid.Column="2" Content="📄 Report" FontSize="13"
|
||||||
|
Height="44" Margin="4,0,0,0"
|
||||||
|
Command="{Binding DataContext.GenerateReportCommand,
|
||||||
|
RelativeSource={RelativeSource AncestorType=Window}}"/>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
<!-- ── Toolbar ─────────────────────────────────────────────────────── -->
|
<!-- ── Toolbar ─────────────────────────────────────────────────────── -->
|
||||||
<Border BorderBrush="Gray" BorderThickness="0,0,0,1" Padding="8,4">
|
<Border Grid.Row="1" BorderBrush="Gray" BorderThickness="0,0,0,1" Padding="8,4">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="Auto"/>
|
||||||
@@ -347,14 +374,14 @@
|
|||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<!-- ── Status line ─────────────────────────────────────────────────── -->
|
<!-- ── Status line ─────────────────────────────────────────────────── -->
|
||||||
<TextBlock Grid.Row="1"
|
<TextBlock Grid.Row="2"
|
||||||
Text="{Binding StatusText}"
|
Text="{Binding StatusText}"
|
||||||
FontSize="12" FontStyle="Italic"
|
FontSize="12" FontStyle="Italic"
|
||||||
Foreground="Gray" Margin="8,2"
|
Foreground="Gray" Margin="8,2"
|
||||||
Visibility="{Binding IsRunning, Converter={StaticResource BoolToVis}}"/>
|
Visibility="{Binding IsRunning, Converter={StaticResource BoolToVis}}"/>
|
||||||
|
|
||||||
<!-- ── Test sections ───────────────────────────────────────────────── -->
|
<!-- ── Test sections ───────────────────────────────────────────────── -->
|
||||||
<ScrollViewer Grid.Row="2" VerticalScrollBarVisibility="Auto">
|
<ScrollViewer Grid.Row="3" VerticalScrollBarVisibility="Auto">
|
||||||
<ItemsControl ItemsSource="{Binding Tests}"
|
<ItemsControl ItemsSource="{Binding Tests}"
|
||||||
ItemTemplate="{StaticResource TestSectionTemplate}"
|
ItemTemplate="{StaticResource TestSectionTemplate}"
|
||||||
Margin="4"/>
|
Margin="4"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user