zooflow: msgbox
This commit is contained in:
@@ -15,18 +15,15 @@ Public Class FormHelper
|
||||
Public Function ShowInfoMessage(pMessage As String, pTitle As String) As DialogResult
|
||||
Logger.Info(pMessage)
|
||||
|
||||
Dim oForm As New frmDialog(pMessage, pTitle, frmDialog.DialogType.Info)
|
||||
Return oForm.ShowDialog()
|
||||
End Function
|
||||
|
||||
Public Function ShowErrorMessage(pMessage As String, pTitle As String) As DialogResult
|
||||
Return ShowErrorMessage(New ApplicationException(pMessage), pTitle)
|
||||
Return ShowMessage(pMessage, pTitle, frmDialog.DialogType.Info)
|
||||
End Function
|
||||
|
||||
Public Function ShowErrorMessage(pException As Exception, pTitle As String) As DialogResult
|
||||
Logger.Error(pException)
|
||||
|
||||
Dim oMessage = String.Format("In der Funktion '{0}' ist folgender Fehler aufgetreten: {1}", pTitle, vbNewLine & vbNewLine & pException.Message)
|
||||
Dim oMethodName = GetMethodName()
|
||||
Dim oBaseMessage = "In der Funktion '{0}' ist folgender Fehler aufgetreten: {1}"
|
||||
Dim oMessage = String.Format(oBaseMessage, oMethodName, vbNewLine & vbNewLine & pException.Message)
|
||||
|
||||
If LogConfig.Debug Then
|
||||
oMessage &= vbNewLine & vbNewLine & "=== Debug Information ==="
|
||||
@@ -34,14 +31,32 @@ Public Class FormHelper
|
||||
oMessage &= vbNewLine & pException.StackTrace
|
||||
End If
|
||||
|
||||
Dim oForm As New frmDialog(oMessage, pTitle, frmDialog.DialogType.Error)
|
||||
Return oForm.ShowDialog()
|
||||
Return ShowMessage(oMessage, pTitle, frmDialog.DialogType.Error)
|
||||
End Function
|
||||
|
||||
Public Function ShowWarningMessage(pMessage As String, pTitle As String) As DialogResult
|
||||
Logger.Warn(pMessage)
|
||||
Logger.Info(pTitle & " - " & pMessage)
|
||||
Return ShowMessage(pMessage, pTitle, frmDialog.DialogType.Warning)
|
||||
End Function
|
||||
|
||||
Dim oForm As New frmDialog(pMessage, pTitle, frmDialog.DialogType.Error)
|
||||
Public Function ShowQuestionMessage(pMessage As String, pTitle As String) As DialogResult
|
||||
Logger.Info(pTitle & " - " & pMessage)
|
||||
Return ShowMessage(pMessage, pTitle, frmDialog.DialogType.Question)
|
||||
End Function
|
||||
|
||||
Public Function ShowSuccessMessage(pMessage As String, pTitle As String) As DialogResult
|
||||
Logger.Info(pTitle & " - " & pMessage)
|
||||
Return ShowMessage(pMessage, pTitle, frmDialog.DialogType.Success)
|
||||
End Function
|
||||
|
||||
Private Function ShowMessage(pMessage As String, pTitle As String, pType As frmDialog.DialogType) As DialogResult
|
||||
Dim oForm As New frmDialog(pMessage, pTitle, pType)
|
||||
Return oForm.ShowDialog()
|
||||
End Function
|
||||
|
||||
Private Function GetMethodName() As String
|
||||
Dim oStackTrace As New StackTrace()
|
||||
Dim oMethodName As String = oStackTrace.GetFrame(2).GetMethod.Name
|
||||
Return oMethodName
|
||||
End Function
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user