Properly logout windream session on form close
Added System.ComponentModel import. Enhanced frmStart's FormClosing handler to log out of any active windream session with appropriate logging and error handling, ensuring clean session termination on application exit.
This commit is contained in:
@@ -5,6 +5,7 @@ Imports DigitalData.Modules.Logging
|
||||
Imports System.IO
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports System.ComponentModel
|
||||
|
||||
Public Class frmStart
|
||||
Private _MyLogger As LogConfig
|
||||
@@ -127,6 +128,18 @@ Public Class frmStart
|
||||
Dim result As MsgBoxResult = MsgBox("Sind Sie sicher, dass sie " & Application.ProductName & " wirklich schließen wollen?" & vbNewLine & "Alle Vorgänge/Module werden gestoppt und nicht mehr ausgeführt!", MsgBoxStyle.YesNo, "Bestätigung erforderlich:")
|
||||
If result = MsgBoxResult.No Then
|
||||
e.Cancel = True
|
||||
Return ' ← wichtig: hier sofort raus, kein Logout
|
||||
End If
|
||||
|
||||
If Not IsNothing(CURRENToWMSession) Then
|
||||
_Logger.Debug("Closing frmStart - Now logging out of windream session...")
|
||||
Try
|
||||
CURRENToWMSession.Logout()
|
||||
_Logger.Debug("windream session logged out successfully.")
|
||||
Catch ex As Exception
|
||||
_Logger.Warn("Error while logging out windream session: " & ex.Message)
|
||||
_Logger.Error(ex)
|
||||
End Try
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
Reference in New Issue
Block a user