Common: Improve BaseForms and ErrorHandler

This commit is contained in:
Jonathan Jenne
2021-04-26 16:31:41 +02:00
parent 72e639dc0c
commit 18786bee33
4 changed files with 77 additions and 12 deletions

View File

@@ -5,14 +5,16 @@ Imports DigitalData.Modules.Logging
Namespace Base
''' <summary>
''' This BaseClass is used to provide common functionality like the Logger or ErrorHandler to all Forms
''' To use it, create a form and change the `Inherits` statement in FormName.Designer.vb to this form, eg.:
''' </summary>
''' <example>
''' To use it, create a form and change the `Inherits` statement in FormName.Designer.vb to this form.
'''
''' Partial Class frmExample
''' Inherits BaseRibbonForm
'''
''' ...
''' End Class
''' </summary>
''' </example>
Public Class BaseRibbonForm
Inherits RibbonForm
@@ -43,13 +45,18 @@ Namespace Base
End Sub
''' ============== PUBLIC METHODS ==============
Public Sub ShowInfoMessage(Message As String)
_ErrorHandler.ShowInfoMessage(Message)
End Sub
Public Sub ShowErrorMessage(Exception As Exception)
_ErrorHandler.ShowErrorMessage(Exception)
Dim oCallingClass = LogConfig.GetClassFullName(IncludeMethodNames:=True, Parts:=2)
_ErrorHandler.ShowErrorMessage(Exception, oCallingClass)
End Sub
Public Sub ShowErrorMessage(ErrorMessage As String)
_ErrorHandler.ShowErrorMessage(New ApplicationException(ErrorMessage))
Dim oCallingClass = LogConfig.GetClassFullName(IncludeMethodNames:=True, Parts:=2)
_ErrorHandler.ShowErrorMessage(New ApplicationException(ErrorMessage), oCallingClass)
End Sub
End Class
End Namespace