From dfc0647fb0f33b860add8145b2998422f3eb37a1 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Tue, 1 Nov 2022 12:26:31 +0100 Subject: [PATCH] Bugfix: Subscribers of app events must be reset when restarting --- I18N Commander/UI WinForms/AppEvents.cs | 10 +++++++++- I18N Commander/UI WinForms/Components/Main.cs | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/I18N Commander/UI WinForms/AppEvents.cs b/I18N Commander/UI WinForms/AppEvents.cs index 0e63300..1145e8e 100644 --- a/I18N Commander/UI WinForms/AppEvents.cs +++ b/I18N Commander/UI WinForms/AppEvents.cs @@ -4,7 +4,15 @@ namespace UI_WinForms; internal static class AppEvents { - #region Event: Settings were + internal static void ResetAllSubscriptions() + { + WhenSettingsChanged = null; + WhenSectionChanged = null; + WhenTextElementChanged = null; + WhenTranslationChanged = null; + } + + #region Event: Settings were internal static event EventHandler? WhenSettingsChanged; diff --git a/I18N Commander/UI WinForms/Components/Main.cs b/I18N Commander/UI WinForms/Components/Main.cs index af58cec..b4e1950 100644 --- a/I18N Commander/UI WinForms/Components/Main.cs +++ b/I18N Commander/UI WinForms/Components/Main.cs @@ -16,6 +16,7 @@ public partial class Main : UserControl if(result == DialogResult.Yes) { Program.RestartMainApp = true; + AppEvents.ResetAllSubscriptions(); this.ParentForm!.Close(); } }