diff --git a/mRemoteNG/Language/Language.Designer.cs b/mRemoteNG/Language/Language.Designer.cs
index cf65e550..e817c231 100644
--- a/mRemoteNG/Language/Language.Designer.cs
+++ b/mRemoteNG/Language/Language.Designer.cs
@@ -1041,6 +1041,15 @@ namespace mRemoteNG.Resources.Language {
}
}
+ ///
+ /// Looks up a localized string similar to Are you sure you want to disconnect "{0}"?.
+ ///
+ internal static string ConfirmDisconnectConnection {
+ get {
+ return ResourceManager.GetString("ConfirmDisconnectConnection", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Are you sure you want to delete the credential record, {0}?.
///
diff --git a/mRemoteNG/Language/Language.resx b/mRemoteNG/Language/Language.resx
index 9fd31960..c76d522b 100644
--- a/mRemoteNG/Language/Language.resx
+++ b/mRemoteNG/Language/Language.resx
@@ -348,6 +348,9 @@
Are you sure you want to close the panel, "{0}"? Any connections that it contains will also be closed.
+
+ Are you sure you want to disconnect "{0}"?
+
Are you sure you want to delete the external tool, "{0}"?
diff --git a/mRemoteNG/UI/Controls/ConnectionContextMenu.cs b/mRemoteNG/UI/Controls/ConnectionContextMenu.cs
index 2bbbda36..a2e5357c 100644
--- a/mRemoteNG/UI/Controls/ConnectionContextMenu.cs
+++ b/mRemoteNG/UI/Controls/ConnectionContextMenu.cs
@@ -3,9 +3,12 @@ using System.ComponentModel;
using System.Linq;
using System.Windows.Forms;
using mRemoteNG.App;
+using mRemoteNG.App.Info;
+using mRemoteNG.Config;
using mRemoteNG.Connection;
using mRemoteNG.Connection.Protocol;
using mRemoteNG.Container;
+using mRemoteNG.Properties;
using mRemoteNG.Tools;
using mRemoteNG.Tools.Clipboard;
using mRemoteNG.Tree;
@@ -13,6 +16,7 @@ using mRemoteNG.Tree.Root;
using mRemoteNG.Resources.Language;
using System.Runtime.Versioning;
using mRemoteNG.Security;
+using mRemoteNG.UI.TaskDialog;
// ReSharper disable UnusedParameter.Local
@@ -794,6 +798,27 @@ namespace mRemoteNG.UI.Controls
try
{
if (connectionInfo == null) return;
+
+ // Check if confirmation is needed based on settings
+ if (Settings.Default.ConfirmCloseConnection == (int)ConfirmCloseEnum.All)
+ {
+ string confirmMessage = string.Format(Language.ConfirmDisconnectConnection, connectionInfo.Name);
+ DialogResult result = CTaskDialog.MessageBox(this, GeneralAppInfo.ProductName,
+ confirmMessage, "", "", "",
+ Language.CheckboxDoNotShowThisMessageAgain,
+ ETaskDialogButtons.YesNo, ESysIcons.Question,
+ ESysIcons.Question);
+ if (CTaskDialog.VerificationChecked)
+ {
+ Settings.Default.ConfirmCloseConnection--;
+ }
+
+ if (result == DialogResult.No)
+ {
+ return; // User cancelled the disconnect
+ }
+ }
+
ContainerInfo nodeAsContainer = connectionInfo as ContainerInfo;
if (nodeAsContainer != null)
{