diff --git a/mRemoteV1/Forms/frmMain.vb b/mRemoteV1/Forms/frmMain.vb index 7c12f2c06..c4bbf80ed 100644 --- a/mRemoteV1/Forms/frmMain.vb +++ b/mRemoteV1/Forms/frmMain.vb @@ -10,6 +10,15 @@ Public Class frmMain Public Shared Event clipboardchange() Private fpChainedWindowHandle As IntPtr +#Region "Properties" + Private _IsClosing As Boolean = False + Public ReadOnly Property IsClosing() As Boolean + Get + Return _IsClosing + End Get + End Property +#End Region + #Region "Startup & Shutdown" Private Sub frmMain_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 'insert enable edition code here @@ -155,6 +164,8 @@ Public Class frmMain End If End If + _IsClosing = True + For Each Window As UI.Window.Base In wL Window.Close() Next diff --git a/mRemoteV1/My Project/Resources.Designer.vb b/mRemoteV1/My Project/Resources.Designer.vb index c80ac2d60..cee38e50b 100644 --- a/mRemoteV1/My Project/Resources.Designer.vb +++ b/mRemoteV1/My Project/Resources.Designer.vb @@ -1,7 +1,7 @@ '------------------------------------------------------------------------------ ' ' This code was generated by a tool. -' Runtime Version:2.0.50727.5444 +' Runtime Version:2.0.50727.4959 ' ' Changes to this file may cause incorrect behavior and will be lost if ' the code is regenerated. @@ -1697,6 +1697,15 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to Are you sure you want to close the panel, "{0}"? Any connections that it contains will also be closed.. + ''' + Friend ReadOnly Property strConfirmCloseConnectionPanelMainInstruction() As String + Get + Return ResourceManager.GetString("strConfirmCloseConnectionPanelMainInstruction", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to Are you sure you want to delete the external tool, "{0}"?. ''' diff --git a/mRemoteV1/My Project/Resources.resx b/mRemoteV1/My Project/Resources.resx index d770c3102..9ae044cef 100644 --- a/mRemoteV1/My Project/Resources.resx +++ b/mRemoteV1/My Project/Resources.resx @@ -2325,4 +2325,7 @@ Error Description: {1} Do you want to close the connection, "{0}"? + + Are you sure you want to close the panel, "{0}"? Any connections that it contains will also be closed. + \ No newline at end of file diff --git a/mRemoteV1/UI/UI.Window.Connection.vb b/mRemoteV1/UI/UI.Window.Connection.vb index 47b0a8590..7b2115760 100644 --- a/mRemoteV1/UI/UI.Window.Connection.vb +++ b/mRemoteV1/UI/UI.Window.Connection.vb @@ -307,6 +307,17 @@ Namespace UI End Sub Private Sub Connection_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing + If Not frmMain.IsClosing And My.Settings.ConfirmCloseConnection And TabController.TabPages.Count > 0 Then + Dim Result As DialogResult = cTaskDialog.MessageBox(Me, My.Application.Info.ProductName, String.Format(My.Resources.strConfirmCloseConnectionPanelMainInstruction, Me.Text), "", "", "", My.Resources.strCheckboxDoNotShowThisMessageAgain, eTaskDialogButtons.YesNo, eSysIcons.Question, Nothing) + If cTaskDialog.VerificationChecked Then + My.Settings.ConfirmCloseConnection = False + End If + If Result = DialogResult.No Then + e.Cancel = True + Exit Sub + End If + End If + Try For Each tabP As Magic.Controls.TabPage In Me.TabController.TabPages If tabP.Tag IsNot Nothing Then