Changed exit confirmation from MsgBox to TaskDialog.

This commit is contained in:
Riley McArdle
2010-01-30 03:43:55 -06:00
parent a5ac1284a2
commit 61b3644a03
9 changed files with 64 additions and 32 deletions

View File

@@ -2,6 +2,7 @@ Imports mRemote.App.Runtime
Imports System.Reflection
Imports Crownwood
Imports mRemote.App.Native
Imports PSTaskDialog
Public Class frmMain
Public prevWindowsState As FormWindowState
@@ -106,7 +107,11 @@ Public Class frmMain
Private Sub frmMain_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
If My.Settings.ConfirmExit And wL.Count > 0 Then
If MsgBox(Language.Base.UnclosedConnectionPanels, MsgBoxStyle.YesNo Or MsgBoxStyle.Question) = MsgBoxResult.No Then
Dim Result As DialogResult = cTaskDialog.MessageBox(Me, My.Application.Info.AssemblyName, My.Resources.strConfirmExitMainInstruction, "", "", "", My.Resources.strDoNotShowThisMessageAgain, eTaskDialogButtons.YesNo, eSysIcons.Question, Nothing)
If cTaskDialog.VerificationChecked Then
My.Settings.ConfirmExit = False
End If
If Result = DialogResult.No Then
e.Cancel = True
Exit Sub
End If
@@ -122,6 +127,7 @@ Public Class frmMain
End Sub
#End Region
#Region "Timer"
Private tmrRuns As Integer = 0
Private Sub tmrShowUpdate_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrShowUpdate.Tick
If tmrRuns = 5 Then
@@ -145,7 +151,7 @@ Public Class frmMain
mC.AddMessage(Messages.MessageClass.InformationMsg, "Doing AutoSave", True)
App.Runtime.SaveConnections()
End Sub
#End Region
#Region "Ext Apps Toolbar"
Private Sub cMenToolbarShowText_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cMenToolbarShowText.Click
@@ -558,6 +564,7 @@ Public Class frmMain
End Sub
#End Region
#Region "Window Overrides and DockPanel Stuff"
Private Sub frmMain_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
If Me.WindowState = FormWindowState.Minimized Then
If My.Settings.MinimizeToTray Then
@@ -571,7 +578,6 @@ Public Class frmMain
End If
End Sub
#Region "Window Overrides and DockPanel Stuff"
Private bWmGetTextFlag As Boolean = False
Private bWmWindowPosChangedFlag As Boolean = False
@@ -579,32 +585,31 @@ Public Class frmMain
Try
'Debug.Print(m.Msg)
If m.Msg = WM_GETTEXT Then
bWmGetTextFlag = True
ElseIf m.Msg = WM_WINDOWPOSCHANGED Then
If bWmGetTextFlag Then
ActivateConnection()
End If
bWmGetTextFlag = False
bWmWindowPosChangedFlag = True
ElseIf m.Msg = WM_ACTIVATEAPP Then
If bWmWindowPosChangedFlag Then
ActivateConnection()
End If
Else
bWmGetTextFlag = False
bWmWindowPosChangedFlag = False
End If
If m.Msg = Tools.SystemMenu.Flags.WM_SYSCOMMAND Then
For i As Integer = 0 To SysMenSubItems.Length - 1
If SysMenSubItems(i) = m.WParam Then
Screens.SendFormToScreen(Screen.AllScreens(i))
Exit For
Select m.Msg
Case WM_GETTEXT
bWmGetTextFlag = True
Case WM_WINDOWPOSCHANGED
If bWmGetTextFlag Then
ActivateConnection()
End If
Next
End If
bWmGetTextFlag = False
bWmWindowPosChangedFlag = True
Case WM_ACTIVATEAPP
If bWmWindowPosChangedFlag Then
ActivateConnection()
End If
Case WM_SYSCOMMAND
For i As Integer = 0 To SysMenSubItems.Length - 1
If SysMenSubItems(i) = m.WParam Then
Screens.SendFormToScreen(Screen.AllScreens(i))
Exit For
End If
Next
Case Else
bWmGetTextFlag = False
bWmWindowPosChangedFlag = False
End Select
Catch ex As Exception
End Try

View File

@@ -340,7 +340,6 @@
Public Const SendTo As String = "Send to..."
Public Const Screen As String = "Screen"
Public Const UnclosedConnectionPanels As String = "There are unclosed connection panels, are you sure you want to quit?"
Public Const SaveConnectionsFileBeforeOpeningAnother As String = "Do you want to save the current connections file before loading another?"
Public Const NewPanel As String = "New Panel"
Public Const PanelName As String = "Panel name"

View File

@@ -771,6 +771,15 @@ Namespace My.Resources
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Do you want to close all open connections?.
'''</summary>
Friend ReadOnly Property strConfirmExitMainInstruction() As String
Get
Return ResourceManager.GetString("strConfirmExitMainInstruction", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Are you sure you want to reset the panels to their default layout?.
'''</summary>
@@ -780,6 +789,15 @@ Namespace My.Resources
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Do not show this message again..
'''</summary>
Friend ReadOnly Property strDoNotShowThisMessageAgain() As String
Get
Return ResourceManager.GetString("strDoNotShowThisMessageAgain", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Includes icons by [FAMFAMFAM].
'''</summary>

View File

@@ -481,4 +481,10 @@
<data name="strConfirmResetLayout" xml:space="preserve">
<value>Are you sure you want to reset the panels to their default layout?</value>
</data>
<data name="strConfirmExitMainInstruction" xml:space="preserve">
<value>Do you want to close all open connections?</value>
</data>
<data name="strDoNotShowThisMessageAgain" xml:space="preserve">
<value>Do not show this message again.</value>
</data>
</root>

View File

@@ -239,7 +239,7 @@ Namespace My
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Configuration.SettingsProviderAttribute(GetType(mRemote.Config.Settings.Providers.ChooseProvider)), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("False")> _
Global.System.Configuration.DefaultSettingValueAttribute("True")> _
Public Property ConfirmExit() As Boolean
Get
Return CType(Me("ConfirmExit"),Boolean)

View File

@@ -45,7 +45,7 @@
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="ConfirmExit" Provider="mRemote.Config.Settings.Providers.ChooseProvider" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="CheckForUpdatesOnStartup" Provider="mRemote.Config.Settings.Providers.ChooseProvider" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>

Binary file not shown.

View File

@@ -103,7 +103,7 @@
<value>True</value>
</setting>
<setting name="ConfirmExit" serializeAs="String">
<value>False</value>
<value>True</value>
</setting>
<setting name="CheckForUpdatesOnStartup" serializeAs="String">
<value>True</value>

View File

@@ -125,6 +125,10 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>References\Org.Mentalis.Security.dll</HintPath>
</Reference>
<Reference Include="PSTaskDialog, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>References\PSTaskDialog.dll</HintPath>
</Reference>
<Reference Include="Skybound.Gecko, Version=1.8.1.4, Culture=neutral, PublicKeyToken=3209ac31600d1857, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>References\Skybound.Gecko.dll</HintPath>