From ab731a63af14ced777d6d1dbee42bb8db0ecbde2 Mon Sep 17 00:00:00 2001 From: Michael Bucari-Tovo Date: Fri, 22 Jul 2022 19:20:47 -0600 Subject: [PATCH] Tweak MessageBox --- Source/LibationWinForms/AvaloniaUI/MessageBox.cs | 4 ++-- .../AvaloniaUI/ViewModels/ProcessBookViewModel.cs | 4 ++-- .../AvaloniaUI/ViewModels/ProcessQueueViewModel.cs | 2 +- .../AvaloniaUI/ViewModels/ProductsDisplayViewModel.cs | 2 +- .../AvaloniaUI/Views/Dialogs/AccountsDialog.axaml.cs | 5 ++--- .../Views/Dialogs/MessageBoxAlertAdminDialog.axaml | 1 + .../Views/Dialogs/MessageBoxAlertAdminDialog.axaml.cs | 2 +- .../AvaloniaUI/Views/Dialogs/SettingsDialog.axaml.cs | 4 ++-- .../AvaloniaUI/Views/MainWindow/MainWindow.Settings.axaml.cs | 2 +- .../AvaloniaUI/Views/MainWindow/MainWindow.axaml.cs | 2 +- 10 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Source/LibationWinForms/AvaloniaUI/MessageBox.cs b/Source/LibationWinForms/AvaloniaUI/MessageBox.cs index 0a974636..300fd16e 100644 --- a/Source/LibationWinForms/AvaloniaUI/MessageBox.cs +++ b/Source/LibationWinForms/AvaloniaUI/MessageBox.cs @@ -183,7 +183,7 @@ namespace LibationWinForms.AvaloniaUI => ShowCoreAsync(owner, text, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1); - public static async Task VerboseLoggingWarning_ShowIfTrue() + public static void VerboseLoggingWarning_ShowIfTrue() { // when turning on debug (and especially Verbose) to share logs, some privacy settings may not be obscured if (Serilog.Log.Logger.IsVerboseEnabled()) @@ -230,7 +230,7 @@ Libation. /// The text to display in the message box. /// The text to display in the title bar of the message box. /// Exception to log. - public static async Task ShowAdminAlert(Window owner, string text, string caption, Exception exception) + public static void ShowAdminAlert(Window owner, string text, string caption, Exception exception) { // for development and debugging, show me what broke! if (System.Diagnostics.Debugger.IsAttached) diff --git a/Source/LibationWinForms/AvaloniaUI/ViewModels/ProcessBookViewModel.cs b/Source/LibationWinForms/AvaloniaUI/ViewModels/ProcessBookViewModel.cs index f9b7d997..569da78c 100644 --- a/Source/LibationWinForms/AvaloniaUI/ViewModels/ProcessBookViewModel.cs +++ b/Source/LibationWinForms/AvaloniaUI/ViewModels/ProcessBookViewModel.cs @@ -152,7 +152,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels finally { if (Result == ProcessBookResult.None) - Result = await showRetry(LibraryBook); + Result = showRetry(LibraryBook); Status = Result switch { @@ -313,7 +313,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels #region Failure Handler - private async Task showRetry(LibraryBook libraryBook) + private ProcessBookResult showRetry(LibraryBook libraryBook) { Logger.Error("ERROR. All books have not been processed. Most recent book: processing failed"); diff --git a/Source/LibationWinForms/AvaloniaUI/ViewModels/ProcessQueueViewModel.cs b/Source/LibationWinForms/AvaloniaUI/ViewModels/ProcessQueueViewModel.cs index 15521a96..4fd67472 100644 --- a/Source/LibationWinForms/AvaloniaUI/ViewModels/ProcessQueueViewModel.cs +++ b/Source/LibationWinForms/AvaloniaUI/ViewModels/ProcessQueueViewModel.cs @@ -191,7 +191,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels } } - private void CounterTimer_Tick(object? state) + private void CounterTimer_Tick(object state) { string timeToStr(TimeSpan time) { diff --git a/Source/LibationWinForms/AvaloniaUI/ViewModels/ProductsDisplayViewModel.cs b/Source/LibationWinForms/AvaloniaUI/ViewModels/ProductsDisplayViewModel.cs index 6097a722..c243c77a 100644 --- a/Source/LibationWinForms/AvaloniaUI/ViewModels/ProductsDisplayViewModel.cs +++ b/Source/LibationWinForms/AvaloniaUI/ViewModels/ProductsDisplayViewModel.cs @@ -316,7 +316,7 @@ namespace LibationWinForms.AvaloniaUI.ViewModels } catch (Exception ex) { - await MessageBox.ShowAdminAlert( + MessageBox.ShowAdminAlert( null, "Error scanning library. You may still manually select books to remove from Libation's library.", "Error scanning library", diff --git a/Source/LibationWinForms/AvaloniaUI/Views/Dialogs/AccountsDialog.axaml.cs b/Source/LibationWinForms/AvaloniaUI/Views/Dialogs/AccountsDialog.axaml.cs index 0a11da76..4bd0301d 100644 --- a/Source/LibationWinForms/AvaloniaUI/Views/Dialogs/AccountsDialog.axaml.cs +++ b/Source/LibationWinForms/AvaloniaUI/Views/Dialogs/AccountsDialog.axaml.cs @@ -160,9 +160,8 @@ namespace LibationWinForms.AvaloniaUI.Views.Dialogs Export(acc); } - protected override async Task SaveAndCloseAsync() + protected override void SaveAndClose() { - try { if (!inputIsValid()) @@ -179,7 +178,7 @@ namespace LibationWinForms.AvaloniaUI.Views.Dialogs } catch (Exception ex) { - await MessageBox.ShowAdminAlert(this, "Error attempting to save accounts", "Error saving accounts", ex); + MessageBox.ShowAdminAlert(this, "Error attempting to save accounts", "Error saving accounts", ex); } } diff --git a/Source/LibationWinForms/AvaloniaUI/Views/Dialogs/MessageBoxAlertAdminDialog.axaml b/Source/LibationWinForms/AvaloniaUI/Views/Dialogs/MessageBoxAlertAdminDialog.axaml index 00ed3a2a..52f94d48 100644 --- a/Source/LibationWinForms/AvaloniaUI/Views/Dialogs/MessageBoxAlertAdminDialog.axaml +++ b/Source/LibationWinForms/AvaloniaUI/Views/Dialogs/MessageBoxAlertAdminDialog.axaml @@ -29,6 +29,7 @@ Grid.Row="1" Margin="10,10,10,0" IsReadOnly="True" + TextWrapping="Wrap" Text="{Binding ExceptionMessage}" /> await new Dialogs.SettingsDialog().ShowDialog(this); - public async void aboutToolStripMenuItem_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e) + public void aboutToolStripMenuItem_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e) => MessageBox.Show($"Running Libation version {AppScaffolding.LibationScaffolding.BuildVersion}", $"Libation v{AppScaffolding.LibationScaffolding.BuildVersion}"); } } diff --git a/Source/LibationWinForms/AvaloniaUI/Views/MainWindow/MainWindow.axaml.cs b/Source/LibationWinForms/AvaloniaUI/Views/MainWindow/MainWindow.axaml.cs index 5861b190..9f6bd583 100644 --- a/Source/LibationWinForms/AvaloniaUI/Views/MainWindow/MainWindow.axaml.cs +++ b/Source/LibationWinForms/AvaloniaUI/Views/MainWindow/MainWindow.axaml.cs @@ -65,7 +65,7 @@ namespace LibationWinForms.AvaloniaUI.Views productsDisplay?.CloseImageDisplay(); } - private async void MainWindow_Opened(object sender, EventArgs e) + private void MainWindow_Opened(object sender, EventArgs e) { }