SND Atilla EXG

This commit is contained in:
2025-01-22 13:31:21 +01:00
parent 0cf3ccd1fb
commit d94c7676b6
9 changed files with 184 additions and 63 deletions

View File

@@ -165,29 +165,36 @@ Public Class frmHauptfenster
Private Sub StartPipeListener()
listenerThread = New System.Threading.Thread(Sub()
Dim pipeName As String = $"AVISO_{Process.GetCurrentProcess().Id}"
Dim pipeSecurity As New PipeSecurity()
pipeSecurity.AddAccessRule(New PipeAccessRule(Environment.UserName, PipeAccessRights.FullControl, AccessControlType.Allow))
Try
Console.WriteLine($"Waiting for messages on pipe {pipeName}...")
Dim pipeName As String = $"AVISO_{Process.GetCurrentProcess().Id}"
Dim pipeSecurity As New PipeSecurity()
pipeSecurity.AddAccessRule(New PipeAccessRule(Environment.UserName, PipeAccessRights.FullControl, AccessControlType.Allow))
While True
Using server = New NamedPipeServerStream(pipeName, PipeDirection.In, 1, PipeTransmissionMode.Byte, PipeOptions.None, 0, 0, pipeSecurity)
Try
server.WaitForConnection()
Console.WriteLine($"Waiting for messages on pipe {pipeName}...")
Using reader = New StreamReader(server, Encoding.UTF8)
Dim message = reader.ReadLine()
While True
Using server = New NamedPipeServerStream(pipeName, PipeDirection.In, 1, PipeTransmissionMode.Byte, PipeOptions.None, 0, 0, pipeSecurity)
Try
server.WaitForConnection()
ProcessMessage(message)
End Using
Using reader = New StreamReader(server, Encoding.UTF8)
Dim message = reader.ReadLine()
server.Disconnect()
Catch ex As Exception
Console.WriteLine("Fehler im Listener: " & ex.Message)
End Try
End Using
End While
ProcessMessage(message)
End Using
server.Disconnect()
Catch ex As Exception
Console.WriteLine("Fehler im Listener: " & ex.Message)
End Try
End Using
End While
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
End Sub)
listenerThread.IsBackground = True
listenerThread.Start()
@@ -206,7 +213,14 @@ Public Class frmHauptfenster
Protected Overrides Sub OnFormClosed(e As FormClosedEventArgs)
MyBase.OnFormClosed(e)
listenerThread.Abort()
Try
If listenerThread IsNot Nothing Then
listenerThread.Abort()
End If
Catch ex As Exception
End Try
End Sub
'----------------------------------------------------------------------------------------------------------------------
@@ -1325,8 +1339,7 @@ Public Class frmHauptfenster
Exit Sub
End If
Catch ex As Exception
MsgBox(ex.Message & ex.StackTrace)
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
btnMitarbeiterKonto.Image = My.Resources.mitarbeiter_s
@@ -2543,7 +2556,7 @@ Public Class frmHauptfenster
zoll.Show()
Me.Cursor = Cursors.Default
Catch ex As Exception
MsgBox(ex.Message)
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
End Sub
@@ -3340,7 +3353,7 @@ Public Class frmHauptfenster
'MsgBox(MIC.ImportShipmentMessage.ImportShipment.Shipment.company)
Catch ex As Exception
MsgBox(ex.Message & ex.StackTrace)
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
@@ -4030,8 +4043,8 @@ Public Class frmHauptfenster
' Iteriere über jedes Fenster in der Liste
For Each frm As Form In openForms
' Prüfe, ob das Fenster nicht das aktuelle ist
If frm IsNot Me Then
' Prüfe, ob das Fenster nicht das aktuelle Fenster
If frm.GetType.ToString <> "AVISO.frmHauptfenster" And frm.GetType.ToString <> "AVISO.frmLogin" Then
' Schließe das Fenster, unabhängig davon, ob es modal oder nicht ist
frm.Close()
End If