From a942e6142a00eded3617430a366358a078a1ef57 Mon Sep 17 00:00:00 2001 From: Deterous <138427222+Deterous@users.noreply.github.com> Date: Thu, 22 May 2025 23:46:53 +0900 Subject: [PATCH] Minor Check UI improvements (#851) * Minor Check UI improvements * Move Check warning below status box * Hover text on status message * Full status in tooltip * Add ellipsis to status text * null ref assignment * OneWay * trigger StatusFirstLine property changed * Better status property block * wrong op --- CHANGELIST.md | 1 + MPF.Frontend/ViewModels/CheckDumpViewModel.cs | 27 ++++++++++++++----- MPF.UI/Windows/CheckDumpWindow.xaml | 15 ++++++----- MPF.UI/Windows/CheckDumpWindow.xaml.cs | 2 ++ 4 files changed, 31 insertions(+), 14 deletions(-) diff --git a/CHANGELIST.md b/CHANGELIST.md index 6e7a4b2b..52beeb58 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -61,6 +61,7 @@ - Use null for 0 speed internally - Don't hash bad SS - Add and use status label for Check window +- Minor Check UI improvements ### 3.3.0 (2025-01-03) diff --git a/MPF.Frontend/ViewModels/CheckDumpViewModel.cs b/MPF.Frontend/ViewModels/CheckDumpViewModel.cs index 37da9d9f..0731e7ef 100644 --- a/MPF.Frontend/ViewModels/CheckDumpViewModel.cs +++ b/MPF.Frontend/ViewModels/CheckDumpViewModel.cs @@ -174,10 +174,29 @@ namespace MPF.Frontend.ViewModels { _status = value; TriggerPropertyChanged(nameof(Status)); + TriggerPropertyChanged(nameof(StatusFirstLine)); } } private string _status; + /// + /// Currently displayed status trimmed to one line + /// + public string StatusFirstLine + { + get + { + if (string.IsNullOrEmpty(Status)) + return string.Empty; + + var statusLines = Status.Split('\n'); + if (statusLines.Length > 1) + return statusLines[0] + " (...)"; + + return statusLines[0]; + } + } + /// /// Indicates the status of the check dump button /// @@ -506,13 +525,7 @@ namespace MPF.Frontend.ViewModels /// private void ProgressUpdated(object? sender, ResultEventArgs value) { - var message = value?.Message; - - // Update the label with only the first line of output - if (message != null && message.Contains("\n")) - Status = message.Split('\n')[0] + " (...)"; - else - Status = message ?? string.Empty; + Status = value?.Message ?? string.Empty; } /// diff --git a/MPF.UI/Windows/CheckDumpWindow.xaml b/MPF.UI/Windows/CheckDumpWindow.xaml index d6745b8f..5606d2af 100644 --- a/MPF.UI/Windows/CheckDumpWindow.xaml +++ b/MPF.UI/Windows/CheckDumpWindow.xaml @@ -110,6 +110,14 @@ + + + + + + @@ -128,13 +136,6 @@ - - - - - - diff --git a/MPF.UI/Windows/CheckDumpWindow.xaml.cs b/MPF.UI/Windows/CheckDumpWindow.xaml.cs index 0029396e..7c87d6f6 100644 --- a/MPF.UI/Windows/CheckDumpWindow.xaml.cs +++ b/MPF.UI/Windows/CheckDumpWindow.xaml.cs @@ -166,6 +166,8 @@ namespace MPF.UI.Windows bool? checkAgain = DisplayUserMessage("Check Complete", "The dump has been processed successfully! Would you like to check another dump?", 2, false); if (checkAgain == false) Close(); + else + CheckDumpViewModel.Status = string.Empty; } else {