Fake form for priority messages was not hidden in Mono #181

This commit is contained in:
Michael J. Seiferling
2019-03-09 10:20:51 -06:00
parent 9d67c82d83
commit 1fb726c9d0
+17 -27
View File
@@ -523,6 +523,20 @@ Public Class mgrCommon
End Try End Try
End Sub End Sub
'Configure a fake form to trigger focus for priority messages
Private Shared Sub ConfigureFakeForm(ByRef frm As Form)
frm.FormBorderStyle = FormBorderStyle.None
frm.ShowInTaskbar = False
frm.Size = New Size(0, 0)
'We need to display it off-screen to hide it, setting the visiblity to false doesn't work in Mono.
frm.StartPosition = FormStartPosition.Manual
frm.Location = New Point(-100, -100)
frm.Show()
frm.Focus()
frm.BringToFront()
frm.TopMost = True
End Sub
'Handles no extra parameters 'Handles no extra parameters
Public Shared Function ShowMessage(ByVal sMsg As String, ByVal oType As MsgBoxStyle) As MsgBoxResult Public Shared Function ShowMessage(ByVal sMsg As String, ByVal oType As MsgBoxStyle) As MsgBoxResult
Dim oResult As MsgBoxResult Dim oResult As MsgBoxResult
@@ -536,15 +550,7 @@ Public Class mgrCommon
'Create a fake mostly invisible form to get top focus 'Create a fake mostly invisible form to get top focus
frmFake = New Form frmFake = New Form
frmFake.FormBorderStyle = FormBorderStyle.None ConfigureFakeForm(frmFake)
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 Dim oResult As MsgBoxResult
oResult = ShowMessage(sMsg, oType) oResult = ShowMessage(sMsg, oType)
@@ -568,15 +574,7 @@ Public Class mgrCommon
'Create a fake mostly invisible form to get top focus 'Create a fake mostly invisible form to get top focus
frmFake = New Form frmFake = New Form
frmFake.FormBorderStyle = FormBorderStyle.None ConfigureFakeForm(frmFake)
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 Dim oResult As MsgBoxResult
oResult = ShowMessage(sMsg, sParam, oType) oResult = ShowMessage(sMsg, sParam, oType)
@@ -600,15 +598,7 @@ Public Class mgrCommon
'Create a fake mostly invisible form to get top focus 'Create a fake mostly invisible form to get top focus
frmFake = New Form frmFake = New Form
frmFake.FormBorderStyle = FormBorderStyle.None ConfigureFakeForm(frmFake)
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 Dim oResult As MsgBoxResult
oResult = ShowMessage(sMsg, sParams, oType) oResult = ShowMessage(sMsg, sParams, oType)