From ef6997a2abf49a00feec256b0e04bf48ef9e3c5b Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Wed, 28 Jun 2017 11:50:50 -0600 Subject: [PATCH] Fixed prevent shutdown while minimized bug with issue #77 --- GBM/Forms/frmMain.vb | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/GBM/Forms/frmMain.vb b/GBM/Forms/frmMain.vb index bdbfd2a..ac7df0e 100644 --- a/GBM/Forms/frmMain.vb +++ b/GBM/Forms/frmMain.vb @@ -1649,16 +1649,21 @@ Public Class frmMain ShutdownApp() End If - 'Intercept Exit - If bShutdown = False Then - e.Cancel = True - If Not mgrCommon.IsUnix Then - bShowToggle = False - wState = Me.WindowState - Me.WindowState = FormWindowState.Minimized - Me.ShowInTaskbar = False - End If - End If + Select Case e.CloseReason + Case CloseReason.UserClosing + If bShutdown = False Then + e.Cancel = True + If Not mgrCommon.IsUnix Then + bShowToggle = False + wState = Me.WindowState + Me.WindowState = FormWindowState.Minimized + Me.ShowInTaskbar = False + End If + End If + Case CloseReason.TaskManagerClosing, CloseReason.WindowsShutDown + 'Do nothing and let the app close without warning + End Select + End Sub Private Sub AutoRestoreEventProcessor(myObject As Object, ByVal myEventArgs As EventArgs) Handles tmRestoreCheck.Elapsed