From c3c214dfed7e71eb69307b288c29e97b24481e93 Mon Sep 17 00:00:00 2001 From: OlgunR Date: Mon, 13 Apr 2026 16:34:00 +0200 Subject: [PATCH] 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. --- ToolCollection/frmStart.vb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ToolCollection/frmStart.vb b/ToolCollection/frmStart.vb index 4137f0e..22a1690 100644 --- a/ToolCollection/frmStart.vb +++ b/ToolCollection/frmStart.vb @@ -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