diff --git a/GBM/Forms/frmMain.vb b/GBM/Forms/frmMain.vb index 703b50a..35af90f 100644 --- a/GBM/Forms/frmMain.vb +++ b/GBM/Forms/frmMain.vb @@ -353,7 +353,7 @@ Public Class frmMain If oSettings.DisableConfirmation Then bDoBackup = True Else - If mgrCommon.ShowMessage(frmMain_ConfirmBackup, oProcess.GameInfo.Name, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then + If mgrCommon.ShowPriorityMessage(frmMain_ConfirmBackup, oProcess.GameInfo.Name, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then bDoBackup = True Else bDoBackup = False diff --git a/GBM/Managers/mgrCommon.vb b/GBM/Managers/mgrCommon.vb index 77760f0..42fceaa 100644 --- a/GBM/Managers/mgrCommon.vb +++ b/GBM/Managers/mgrCommon.vb @@ -530,6 +530,31 @@ Public Class mgrCommon Return oResult End Function + 'Handles no extra parameters + Public Shared Function ShowPriorityMessage(ByVal sMsg As String, ByVal oType As MsgBoxStyle) As MsgBoxResult + Dim frmFake As Form + + 'Create a fake mostly invisible form to get top focus + frmFake = New Form + frmFake.FormBorderStyle = FormBorderStyle.None + frmFake.ShowInTaskbar = False + frmFake.Size = New Size(0, 0) + frmFake.StartPosition = FormStartPosition.CenterScreen + frmFake.Show() + frmFake.Focus() + frmFake.BringToFront() + frmFake.TopMost = True + frmFake.Visible = False + + Dim oResult As MsgBoxResult + oResult = ShowMessage(sMsg, oType) + + frmFake.TopMost = False + frmFake.Dispose() + + Return oResult + End Function + 'Handles single parameter stings Public Shared Function ShowMessage(ByVal sMsg As String, ByVal sParam As String, ByVal oType As MsgBoxStyle) As MsgBoxResult Dim oResult As MsgBoxResult @@ -537,6 +562,31 @@ Public Class mgrCommon Return oResult End Function + 'Handles single parameter stings + Public Shared Function ShowPriorityMessage(ByVal sMsg As String, ByVal sParam As String, ByVal oType As MsgBoxStyle) As MsgBoxResult + Dim frmFake As Form + + 'Create a fake mostly invisible form to get top focus + frmFake = New Form + frmFake.FormBorderStyle = FormBorderStyle.None + frmFake.ShowInTaskbar = False + frmFake.Size = New Size(0, 0) + frmFake.StartPosition = FormStartPosition.CenterScreen + frmFake.Show() + frmFake.Focus() + frmFake.BringToFront() + frmFake.TopMost = True + frmFake.Visible = False + + Dim oResult As MsgBoxResult + oResult = ShowMessage(sMsg, sParam, oType) + + frmFake.TopMost = False + frmFake.Dispose() + + Return oResult + End Function + 'Handles multi-parameter strings Public Shared Function ShowMessage(ByVal sMsg As String, ByVal sParams As String(), ByVal oType As MsgBoxStyle) As MsgBoxResult Dim oResult As MsgBoxResult @@ -544,6 +594,31 @@ Public Class mgrCommon Return oResult End Function + 'Handles multi-parameter strings + Public Shared Function ShowPriorityMessage(ByVal sMsg As String, ByVal sParams As String(), ByVal oType As MsgBoxStyle) As MsgBoxResult + Dim frmFake As Form + + 'Create a fake mostly invisible form to get top focus + frmFake = New Form + frmFake.FormBorderStyle = FormBorderStyle.None + frmFake.ShowInTaskbar = False + frmFake.Size = New Size(0, 0) + frmFake.StartPosition = FormStartPosition.CenterScreen + frmFake.Show() + frmFake.Focus() + frmFake.BringToFront() + frmFake.TopMost = True + frmFake.Visible = False + + Dim oResult As MsgBoxResult + oResult = ShowMessage(sMsg, sParams, oType) + + frmFake.TopMost = False + frmFake.Dispose() + + Return oResult + End Function + 'Handles no extra parameters Public Shared Function FormatString(ByVal sString As String) As String sString = sString.Replace("[BR]", vbCrLf) diff --git a/GBM/Managers/mgrPath.vb b/GBM/Managers/mgrPath.vb index f3a4647..fb33617 100644 --- a/GBM/Managers/mgrPath.vb +++ b/GBM/Managers/mgrPath.vb @@ -587,8 +587,8 @@ Public Class mgrPath If bNoAuto Then sMessage = mgrCommon.FormatString(mgrPath_ConfirmManualPath, sSearchReason) - If mgrCommon.ShowMessage(sMessage, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then - sFolder = SetManualgamePath() + If mgrCommon.ShowPriorityMessage(sMessage, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then + sFolder = SetManualGamePath() End If Return sFolder @@ -596,8 +596,9 @@ Public Class mgrPath sMessage = mgrCommon.FormatString(mgrPath_ConfirmAutoPath, sSearchReason) - If mgrCommon.ShowMessage(sMessage, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then + If mgrCommon.ShowPriorityMessage(sMessage, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then frmFind.ShowDialog() + frmFind.BringToFront() If frmFind.FoundItem <> String.Empty Then Return frmFind.FoundItem @@ -612,7 +613,7 @@ Public Class mgrPath End If If mgrCommon.ShowMessage(sMessage, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then - sFolder = SetManualgamePath() + sFolder = SetManualGamePath() End If frmFind.Dispose()