Add Base(Ribbon)Form to provide Logger and ErrorHandler to all forms, Save Config per frmEdit Instance

This commit is contained in:
Jonathan Jenne
2019-02-26 14:23:02 +01:00
parent 24c91553dd
commit 3d64eb6eef
11 changed files with 351 additions and 162 deletions

View File

@@ -0,0 +1,28 @@
Imports DevExpress.XtraBars.Ribbon
Imports DigitalData.Modules.Logging
''' <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.:
'''
''' Partial Class frmExample
''' Inherits BaseForm
'''
''' ...
''' End Class
''' </summary>
Public Class BaseForm
Inherits Form
Protected ReadOnly _Logger As Logger
Protected ReadOnly _ErrorHandler As ClassErrorHandler
Public Sub New()
Dim oClassName = [GetType]().Name
' My.LogConfig is undefined in the designer
' so we need to check with ?
_Logger = My.LogConfig?.GetLogger(oClassName)
_ErrorHandler = New ClassErrorHandler(_Logger)
End Sub
End Class