ErrorMeldung -> Screenshot und SystemEnviroment wird mitgeschickt.
This commit is contained in:
@@ -1,4 +1,13 @@
|
||||
Imports Microsoft.Office.Interop.Outlook
|
||||
Imports System.Drawing
|
||||
Imports System.Drawing.Imaging
|
||||
Imports System.IO
|
||||
Imports System.Reflection
|
||||
Imports System.Text
|
||||
Imports System.Windows.Forms
|
||||
Imports System.Management
|
||||
Imports iTextSharp.xmp.impl.xpath
|
||||
Imports Microsoft.Office.Interop
|
||||
Imports Microsoft.Office.Interop.Outlook
|
||||
|
||||
Public Class frmErrorMeldung
|
||||
|
||||
@@ -6,7 +15,8 @@ Public Class frmErrorMeldung
|
||||
Dim err_stack
|
||||
Dim err_zp As DateTime = Now
|
||||
Dim err_title
|
||||
Sub New(err_meldung, err_stack, Optional err_title = "")
|
||||
Dim screenshotUrl
|
||||
Sub New(err_meldung As String, err_stack As String, Optional err_title As String = "", Optional screenshotUrl As String = "")
|
||||
|
||||
' Dieser Aufruf ist für den Designer erforderlich.
|
||||
InitializeComponent()
|
||||
@@ -14,6 +24,7 @@ Public Class frmErrorMeldung
|
||||
Me.err_meldung = err_meldung
|
||||
Me.err_stack = err_stack
|
||||
Me.err_title = err_title
|
||||
Me.screenshotUrl = screenshotUrl
|
||||
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
|
||||
|
||||
End Sub
|
||||
@@ -23,6 +34,9 @@ Public Class frmErrorMeldung
|
||||
End Sub
|
||||
|
||||
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
|
||||
|
||||
Cursor = Cursors.WaitCursor
|
||||
|
||||
lblErr_Nachricht.Visible = False
|
||||
|
||||
If txtNachricht.Text.Trim = "" Then
|
||||
@@ -54,17 +68,110 @@ Public Class frmErrorMeldung
|
||||
Mail_Text &= "<br>" & "<u>User-Nachricht:</u>" & "<br>" & txtNachricht.Text.Trim & "<br>"
|
||||
Mail_Text &= "<br>" & "<u>Error:</u>" & "<br>" & TextBox2.Text.Trim
|
||||
|
||||
If VERAG_PROG_ALLGEMEIN.cProgramFunctions.sendMail(Mail_To, ("ERROR-TICKET " & err_title).trim, Mail_Text) Then
|
||||
Me.Close()
|
||||
Dim outl As New Outlook.Application
|
||||
Dim Mail As Microsoft.Office.Interop.Outlook.MailItem
|
||||
Mail = outl.CreateItem(0)
|
||||
Mail.Subject = ("ERROR-TICKET " & err_title).trim
|
||||
Mail.HTMLBody = Mail_Text
|
||||
Mail.To = Mail_To
|
||||
|
||||
If cbxScreenshot.Checked Then
|
||||
Mail.Attachments.Add(screenshotUrl, Microsoft.Office.Interop.Outlook.OlAttachmentType.olByValue, , "Screenshot.jpeg")
|
||||
End If
|
||||
|
||||
|
||||
If cbxEnviromentVariables.Checked Then
|
||||
|
||||
|
||||
If Not My.Computer.FileSystem.DirectoryExists(My.Computer.FileSystem.SpecialDirectories.Desktop & "\Screenshots_" & My.Application.Info.AssemblyName & "\") Then
|
||||
My.Computer.FileSystem.CreateDirectory(My.Computer.FileSystem.SpecialDirectories.Desktop & "\Screenshots_" & My.Application.Info.AssemblyName & "\")
|
||||
End If
|
||||
|
||||
Dim filename = "SystemEnviroment_" & Now.ToFileTime & "_.txt"
|
||||
Dim strFile As String = My.Computer.FileSystem.SpecialDirectories.Desktop & "\Screenshots_" & My.Application.Info.AssemblyName & "\" & filename
|
||||
Dim fileExists As Boolean = File.Exists(strFile)
|
||||
Using sw As New StreamWriter(File.Open(strFile, FileMode.CreateNew))
|
||||
|
||||
createSystemInformation(sw)
|
||||
sw.Close()
|
||||
|
||||
Mail.Attachments.Add(strFile, Microsoft.Office.Interop.Outlook.OlAttachmentType.olByValue, , filename)
|
||||
End Using
|
||||
End If
|
||||
|
||||
Try
|
||||
Mail.Send()
|
||||
Me.Close()
|
||||
|
||||
|
||||
Catch ex As System.Exception
|
||||
Cursor = Cursors.WaitCursor
|
||||
MsgBox(ex.Message)
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub frmErrorMeldung_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
TextBox2.Text = err_meldung & vbNewLine & vbNewLine & err_stack
|
||||
If screenshotUrl <> "" Then
|
||||
cbxScreenshot.Enabled = True
|
||||
cbxScreenshot.Checked = True
|
||||
Else
|
||||
cbxScreenshot.Enabled = False
|
||||
cbxScreenshot.Checked = False
|
||||
|
||||
End If
|
||||
|
||||
cbxEnviromentVariables.Enabled = True
|
||||
cbxEnviromentVariables.Checked = True
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub frmErrorMeldung_Shown(sender As Object, e As EventArgs) Handles Me.Shown
|
||||
txtNachricht.Focus()
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub createSystemInformation(ByRef sw As StreamWriter)
|
||||
|
||||
Dim str As String
|
||||
Dim nl As String = Environment.NewLine
|
||||
sw.WriteLine()
|
||||
sw.WriteLine("-- Environment members --")
|
||||
sw.WriteLine("CommandLine: {0}", Environment.CommandLine)
|
||||
Dim arguments As String() = Environment.GetCommandLineArgs()
|
||||
sw.WriteLine("GetCommandLineArgs: {0}", String.Join(", ", arguments))
|
||||
sw.WriteLine("CurrentDirectory: {0}", Environment.CurrentDirectory)
|
||||
sw.WriteLine("ExitCode: {0}", Environment.ExitCode)
|
||||
sw.WriteLine("HasShutdownStarted: {0}", Environment.HasShutdownStarted)
|
||||
sw.WriteLine("MachineName: {0}", Environment.MachineName)
|
||||
sw.WriteLine("NewLine: {0} first line{0} second line{0} third line", Environment.NewLine)
|
||||
sw.WriteLine("OSVersion: {0}", Environment.OSVersion.ToString())
|
||||
sw.WriteLine("StackTrace: '{0}'", Environment.StackTrace)
|
||||
sw.WriteLine("SystemDirectory: {0}", Environment.SystemDirectory)
|
||||
sw.WriteLine("TickCount: {0}", Environment.TickCount)
|
||||
sw.WriteLine("UserDomainName: {0}", Environment.UserDomainName)
|
||||
sw.WriteLine("UserInteractive: {0}", Environment.UserInteractive)
|
||||
sw.WriteLine("UserName: {0}", Environment.UserName)
|
||||
sw.WriteLine("Version: {0}", Environment.Version.ToString())
|
||||
sw.WriteLine("WorkingSet: {0}", Environment.WorkingSet)
|
||||
Dim query As String = "My system drive is %SystemDrive% and my system root is %SystemRoot%"
|
||||
str = Environment.ExpandEnvironmentVariables(query)
|
||||
sw.WriteLine("ExpandEnvironmentVariables: {0} {1}", nl, str)
|
||||
sw.WriteLine("GetEnvironmentVariable: {0} My temporary directory is {1}.", nl, Environment.GetEnvironmentVariable("TEMP"))
|
||||
sw.WriteLine("GetEnvironmentVariables: ")
|
||||
Dim environmentVariables As IDictionary = Environment.GetEnvironmentVariables()
|
||||
|
||||
For Each de As DictionaryEntry In environmentVariables
|
||||
sw.WriteLine((" {0} = {1}", de.Key, de.Value))
|
||||
Next
|
||||
|
||||
sw.WriteLine("GetFolderPath: {0}", Environment.GetFolderPath(Environment.SpecialFolder.System))
|
||||
Dim drives As String() = Environment.GetLogicalDrives()
|
||||
sw.WriteLine("GetLogicalDrives: {0}", String.Join(", ", drives))
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user