Fixed confirm closing connection tabs to also ask when closing a panel.

This commit is contained in:
Riley McArdle
2011-05-31 12:13:30 -05:00
parent 635ae405bd
commit aae96c112a
4 changed files with 35 additions and 1 deletions

View File

@@ -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

View File

@@ -1,7 +1,7 @@
'------------------------------------------------------------------------------
' <auto-generated>
' 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
'''<summary>
''' Looks up a localized string similar to Are you sure you want to close the panel, &quot;{0}&quot;? Any connections that it contains will also be closed..
'''</summary>
Friend ReadOnly Property strConfirmCloseConnectionPanelMainInstruction() As String
Get
Return ResourceManager.GetString("strConfirmCloseConnectionPanelMainInstruction", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Are you sure you want to delete the external tool, &quot;{0}&quot;?.
'''</summary>

View File

@@ -2325,4 +2325,7 @@ Error Description: {1}</value>
<data name="strConfirmCloseConnectionMainInstruction" xml:space="preserve">
<value>Do you want to close the connection, "{0}"?</value>
</data>
<data name="strConfirmCloseConnectionPanelMainInstruction" xml:space="preserve">
<value>Are you sure you want to close the panel, "{0}"? Any connections that it contains will also be closed.</value>
</data>
</root>

View File

@@ -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