ErrorMeldung -> Screenshot und SystemEnviroment wird mitgeschickt.

This commit is contained in:
2023-11-23 15:40:46 +01:00
parent 59add26515
commit a6f262304e
4 changed files with 204 additions and 24 deletions

View File

@@ -1,15 +1,30 @@
Imports System.Net.Mail
Imports System.Drawing
Imports System.Drawing.Imaging
Imports System.Net.Mail
Imports System.Windows.Forms
Public Class cErrorHandler
Public Shared Sub ERR(message As String, stack As String, functionName As String, Optional OP As String = "", Optional title As String = "", Optional mailadess As String = "al@verag.ag", Optional recieverMailAdress As String = "", Optional zusatz As String = "", Optional errCode As String = Nothing)
If OP = "" Then OP = VERAG_PROG_ALLGEMEIN.cAllgemein.ERR_OP_GLOBAL ' GLobal gesetzes Errorhandling! (Standart=SHOW)
'If Form.ActiveForm IsNot Nothing Then
' Dim bm As New Bitmap(Form.ActiveForm.Width, Form.ActiveForm.Height)
' Dim g As Graphics = Graphics.FromImage(bm)
' g.CopyFromScreen(Form.ActiveForm.Location, New Point(0, 0), New Size(Form.ActiveForm.Width, Form.ActiveForm.Height))
' bm.Save("C:\formgrab.bmp", Drawing.Imaging.ImageFormat.Bmp)
'End If
Select Case OP
Case ERROR_OP.MAIL
sendERRORperMail(title & " | " & My.Application.Info.AssemblyName, message, stack, mailadess, zusatz, functionName)
Case ERROR_OP.SHOW
Dim f As New frmErrorMeldung(If(functionName <> "", "Fehler in der Funktion '" & functionName & "'" & vbNewLine & vbNewLine, "") & message & vbNewLine & zusatz, stack, title)
Dim c As New cProgramFunctions
Dim url = c.MakeScreenshot()
Dim f As New frmErrorMeldung(If(functionName <> "", "Fehler in der Funktion '" & functionName & "'" & vbNewLine & vbNewLine, "") & message & vbNewLine & zusatz, stack, title, url)
f.ShowDialog()
Case ERROR_OP.SHOW_MSGBOX
MsgBox(If(functionName <> "", "Fehler in der Funktion '" & functionName & "'" & vbNewLine & vbNewLine, "") & message & vbNewLine & stack & vbNewLine & zusatz, MsgBoxStyle.OkOnly, If(title <> "", title, "Fehler"))