From 01e22740cececd4e0d13ad0c6987c2741ceccb37 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 16 Oct 2025 19:51:02 +0000 Subject: [PATCH] Fix Options page not showing correct ConfirmCloseConnection value - Add VisibleChanged event handler to ConnectionsPage to reload settings when page becomes visible - Save settings immediately when user checks "Don't show this message again" checkbox during connection close - Ensures Options dialog always displays current setting value, even if changed outside the dialog Co-authored-by: Kvarkas <3611964+Kvarkas@users.noreply.github.com> --- mRemoteNG/UI/Forms/OptionsPages/ConnectionsPage.cs | 11 +++++++++++ mRemoteNG/UI/Tabs/ConnectionTab.cs | 1 + mRemoteNG/UI/Window/ConnectionWindow.cs | 2 ++ 3 files changed, 14 insertions(+) diff --git a/mRemoteNG/UI/Forms/OptionsPages/ConnectionsPage.cs b/mRemoteNG/UI/Forms/OptionsPages/ConnectionsPage.cs index 6b9c7ef6d..f185c1fb5 100644 --- a/mRemoteNG/UI/Forms/OptionsPages/ConnectionsPage.cs +++ b/mRemoteNG/UI/Forms/OptionsPages/ConnectionsPage.cs @@ -29,6 +29,17 @@ namespace mRemoteNG.UI.Forms.OptionsPages * 1) chkSaveConnectionsAfterEveryEdit: never used */ chkSaveConnectionsAfterEveryEdit.Visible = false; // Temporary hide control, never used, added: Jun 15, 2024 + + // Reload settings when page becomes visible to reflect any changes made outside the Options dialog + VisibleChanged += ConnectionsPage_VisibleChanged; + } + + private void ConnectionsPage_VisibleChanged(object sender, EventArgs e) + { + if (Visible) + { + LoadSettings(); + } } public override string PageName diff --git a/mRemoteNG/UI/Tabs/ConnectionTab.cs b/mRemoteNG/UI/Tabs/ConnectionTab.cs index a6c1fbddf..3d4f2c53c 100644 --- a/mRemoteNG/UI/Tabs/ConnectionTab.cs +++ b/mRemoteNG/UI/Tabs/ConnectionTab.cs @@ -56,6 +56,7 @@ namespace mRemoteNG.UI.Tabs if (CTaskDialog.VerificationChecked) { Settings.Default.ConfirmCloseConnection = (int)ConfirmCloseEnum.Never; + Settings.Default.Save(); } if (result == DialogResult.No) diff --git a/mRemoteNG/UI/Window/ConnectionWindow.cs b/mRemoteNG/UI/Window/ConnectionWindow.cs index f2c9485d9..eb726aab1 100644 --- a/mRemoteNG/UI/Window/ConnectionWindow.cs +++ b/mRemoteNG/UI/Window/ConnectionWindow.cs @@ -298,6 +298,7 @@ namespace mRemoteNG.UI.Window if (CTaskDialog.VerificationChecked) { Settings.Default.ConfirmCloseConnection = (int)ConfirmCloseEnum.Never; + Settings.Default.Save(); } if (result == DialogResult.No) @@ -663,6 +664,7 @@ namespace mRemoteNG.UI.Window if (CTaskDialog.VerificationChecked) { Settings.Default.ConfirmCloseConnection = (int)ConfirmCloseEnum.Never; + Settings.Default.Save(); } if (result == DialogResult.No)