Add Base(Ribbon)Form to provide Logger and ErrorHandler to all forms, Save Config per frmEdit Instance
This commit is contained in:
28
EDMI_ClientSuite/FormDefaults/BaseForm.vb
Normal file
28
EDMI_ClientSuite/FormDefaults/BaseForm.vb
Normal 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
|
||||
Reference in New Issue
Block a user