From f183b587b8935e01802563a323a7a04ea294708f Mon Sep 17 00:00:00 2001 From: Michael Bucari-Tovo Date: Wed, 19 Mar 2025 16:38:58 -0600 Subject: [PATCH] Revert all changes if window is closed by user. --- .../Dialogs/ThemePickerDialog.axaml.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Source/LibationAvalonia/Dialogs/ThemePickerDialog.axaml.cs b/Source/LibationAvalonia/Dialogs/ThemePickerDialog.axaml.cs index 5f45ef85..6efd1fc4 100644 --- a/Source/LibationAvalonia/Dialogs/ThemePickerDialog.axaml.cs +++ b/Source/LibationAvalonia/Dialogs/ThemePickerDialog.axaml.cs @@ -24,6 +24,16 @@ public partial class ThemePickerDialog : DialogWindow ThemeColors = new(EnumerateThemeItemColors(workingTheme, ActualThemeVariant)); DataContext = this; + Closing += ThemePickerDialog_Closing; + } + + private void ThemePickerDialog_Closing(object? sender, Avalonia.Controls.WindowClosingEventArgs e) + { + if (!e.IsProgrammatic) + { + CancelAndClose(); + e.Cancel = true; + } } protected override void CancelAndClose()