Skip to content

Commit aa0ee15

Browse files
committed
Fix unable to exit with tray closing functionality
When Minimize and/or Close to tray is enabled, any calls to Application.Exit are cancelled and WinNUT instead simply hides its self as if it were being minimized/closed to the tray. The application now checks if the user meant to minimize/close it to the tray, otherwise it will exit normally.
1 parent 11998ca commit aa0ee15

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

WinNUT_V2/WinNUT-Client/WinNUT.vb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
'
88
' This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY
99

10+
Imports Windows.ApplicationModel.AppService
1011
Imports WinNUT_Client_Common
1112

1213
Public Class WinNUT
@@ -408,7 +409,9 @@ Public Class WinNUT
408409
End Sub
409410

410411
Private Sub WinNUT_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
411-
If Arr_Reg_Key.Item("CloseToTray") = True And Arr_Reg_Key.Item("MinimizeToTray") = True Then
412+
LogFile.LogTracing("Received FormClosing event. Reason: " + e.CloseReason.ToString(), LogLvl.LOG_NOTICE, Me)
413+
414+
If e.CloseReason = CloseReason.UserClosing AndAlso Arr_Reg_Key.Item("CloseToTray") = True And Arr_Reg_Key.Item("MinimizeToTray") = True Then
412415
LogFile.LogTracing("Update Icon", LogLvl.LOG_DEBUG, Me)
413416
UpdateIcon_NotifyIcon()
414417
LogFile.LogTracing("Minimize Main Gui To Notify Icon", LogLvl.LOG_DEBUG, Me)

0 commit comments

Comments
 (0)