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

@ -1,14 +1,15 @@
Public Class ClassUIConfig
Imports System.Xml.Serialization
Public Class ClassUIConfig
Public Property SkinName As String = "Office 2016 Colorful"
Public Property FrmEdit_Splitter As Integer = 300
Public Property EditFormConfigs As List(Of EditFormConfig) = New List(Of EditFormConfig)
'Public Property EditFormConfigs As New List(Of KeyValuePair(Of String, EditFormConfig))
Public Property EditFormConfigs As New List(Of EditFormConfig)
Public Class EditFormConfig
Public Property SysKey As String
Public Property SplitterDistance As Integer
Public Property SplitterOrientation As Integer
Public Property SplitterDistance As Integer = 700
Public Property SplitterHorizontal As Boolean = True
End Class
End Class

View File

@ -162,6 +162,12 @@
<Compile Include="EntityDesigner\frmEntityDesigner.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="FormDefaults\BaseForm.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="FormDefaults\BaseRibbonForm.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmDashboard.Designer.vb">
<DependentUpon>frmDashboard.vb</DependentUpon>
</Compile>
@ -198,10 +204,10 @@
<Compile Include="frmConfigUser.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="UserManager\frmEdit.Designer.vb">
<Compile Include="frmEdit.Designer.vb">
<DependentUpon>frmEdit.vb</DependentUpon>
</Compile>
<Compile Include="UserManager\frmEdit.vb">
<Compile Include="frmEdit.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="UserManager\frmUserManager.Designer.vb">
@ -282,7 +288,7 @@
<EmbeddedResource Include="frmConfigUser.resx">
<DependentUpon>frmConfigUser.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UserManager\frmEdit.resx">
<EmbeddedResource Include="frmEdit.resx">
<DependentUpon>frmEdit.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UserManager\frmUserManager.resx">

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

View File

@ -0,0 +1,31 @@
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 BaseRibbonForm
'''
''' ...
''' End Class
''' </summary>
Public Class BaseRibbonForm
Inherits RibbonForm
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

View File

@ -137,12 +137,12 @@ Public Class frmUserManager
End Function
Private Sub BarButtonUserEdit_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonUserEdit.ItemClick
Dim oForm As New frmEdit(ClassConstants.DB_USER_ATTRIBUTE_ID, _UserTable)
Dim oForm As New frmEdit(ClassConstants.DB_USER_ATTRIBUTE_ID, ClassConstants.DB_USER_ATTRIBUTE_SYSKEY, _UserTable)
oForm.Show()
End Sub
Private Sub BarButtonGroupEdit_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonGroupEdit.ItemClick
Dim oForm As New frmEdit(ClassConstants.DB_GROUP_ATTRIBUTE_ID, _GroupTable)
Dim oForm As New frmEdit(ClassConstants.DB_GROUP_ATTRIBUTE_ID, ClassConstants.DB_GROUP_ATTRIBUTE_SYSKEY, _GroupTable)
oForm.Show()
End Sub

View File

@ -1,6 +1,6 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class frmEdit
Inherits DevExpress.XtraBars.Ribbon.RibbonForm
Inherits BaseRibbonForm
'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
<System.Diagnostics.DebuggerNonUserCode()>
@ -24,7 +24,7 @@ Partial Class frmEdit
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmEdit))
Me.SplitContainerControl1 = New DevExpress.XtraEditors.SplitContainerControl()
Me.SplitContainer = New DevExpress.XtraEditors.SplitContainerControl()
Me.GridList = New DevExpress.XtraGrid.GridControl()
Me.ViewList = New DevExpress.XtraGrid.Views.Grid.GridView()
Me.LayoutControl1 = New DevExpress.XtraLayout.LayoutControl()
@ -33,13 +33,17 @@ Partial Class frmEdit
Me.BarButtonSave = New DevExpress.XtraBars.BarButtonItem()
Me.BarButtonNew = New DevExpress.XtraBars.BarButtonItem()
Me.BarButtonDelete = New DevExpress.XtraBars.BarButtonItem()
Me.labelParentAttributeId = New DevExpress.XtraBars.BarStaticItem()
Me.labelSyskey = New DevExpress.XtraBars.BarStaticItem()
Me.BarCheckHorizontalLayout = New DevExpress.XtraBars.BarCheckItem()
Me.BarButtonResetLayout = New DevExpress.XtraBars.BarButtonItem()
Me.RibbonPage1 = New DevExpress.XtraBars.Ribbon.RibbonPage()
Me.RibbonPageGroup1 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
Me.RibbonPageGroup2 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
Me.RibbonStatusBar1 = New DevExpress.XtraBars.Ribbon.RibbonStatusBar()
Me.RibbonPage2 = New DevExpress.XtraBars.Ribbon.RibbonPage()
Me.labelParentAttributeId = New DevExpress.XtraBars.BarStaticItem()
CType(Me.SplitContainerControl1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SplitContainerControl1.SuspendLayout()
CType(Me.SplitContainer, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SplitContainer.SuspendLayout()
CType(Me.GridList, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.ViewList, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.LayoutControl1, System.ComponentModel.ISupportInitialize).BeginInit()
@ -47,19 +51,19 @@ Partial Class frmEdit
CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'SplitContainerControl1
'SplitContainer
'
Me.SplitContainerControl1.Dock = System.Windows.Forms.DockStyle.Fill
Me.SplitContainerControl1.Location = New System.Drawing.Point(0, 146)
Me.SplitContainerControl1.Name = "SplitContainerControl1"
Me.SplitContainerControl1.Panel1.Controls.Add(Me.GridList)
Me.SplitContainerControl1.Panel1.Text = "Panel1"
Me.SplitContainerControl1.Panel2.Controls.Add(Me.LayoutControl1)
Me.SplitContainerControl1.Panel2.Text = "Panel2"
Me.SplitContainerControl1.Size = New System.Drawing.Size(1104, 338)
Me.SplitContainerControl1.SplitterPosition = 332
Me.SplitContainerControl1.TabIndex = 0
Me.SplitContainerControl1.Text = "SplitContainerControl1"
Me.SplitContainer.Dock = System.Windows.Forms.DockStyle.Fill
Me.SplitContainer.Location = New System.Drawing.Point(0, 146)
Me.SplitContainer.Name = "SplitContainer"
Me.SplitContainer.Panel1.Controls.Add(Me.GridList)
Me.SplitContainer.Panel1.Text = "Panel1"
Me.SplitContainer.Panel2.Controls.Add(Me.LayoutControl1)
Me.SplitContainer.Panel2.Text = "Panel2"
Me.SplitContainer.Size = New System.Drawing.Size(1104, 338)
Me.SplitContainer.SplitterPosition = 547
Me.SplitContainer.TabIndex = 0
Me.SplitContainer.Text = "SplitContainerControl1"
'
'GridList
'
@ -67,7 +71,7 @@ Partial Class frmEdit
Me.GridList.Location = New System.Drawing.Point(0, 0)
Me.GridList.MainView = Me.ViewList
Me.GridList.Name = "GridList"
Me.GridList.Size = New System.Drawing.Size(332, 338)
Me.GridList.Size = New System.Drawing.Size(547, 338)
Me.GridList.TabIndex = 0
Me.GridList.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.ViewList})
'
@ -83,7 +87,7 @@ Partial Class frmEdit
Me.LayoutControl1.Name = "LayoutControl1"
Me.LayoutControl1.OptionsCustomizationForm.DesignTimeCustomizationFormPositionAndSize = New System.Drawing.Rectangle(-870, 211, 650, 400)
Me.LayoutControl1.Root = Me.LayoutGroup
Me.LayoutControl1.Size = New System.Drawing.Size(760, 338)
Me.LayoutControl1.Size = New System.Drawing.Size(545, 338)
Me.LayoutControl1.TabIndex = 0
Me.LayoutControl1.Text = "LayoutControl1"
'
@ -92,15 +96,15 @@ Partial Class frmEdit
Me.LayoutGroup.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.[True]
Me.LayoutGroup.GroupBordersVisible = False
Me.LayoutGroup.Name = "Root"
Me.LayoutGroup.Size = New System.Drawing.Size(760, 338)
Me.LayoutGroup.Size = New System.Drawing.Size(545, 338)
Me.LayoutGroup.TextVisible = False
'
'RibbonControl1
'
Me.RibbonControl1.ExpandCollapseItem.Id = 0
Me.RibbonControl1.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl1.ExpandCollapseItem, Me.BarButtonSave, Me.BarButtonNew, Me.BarButtonDelete, Me.labelParentAttributeId})
Me.RibbonControl1.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl1.ExpandCollapseItem, Me.BarButtonSave, Me.BarButtonNew, Me.BarButtonDelete, Me.labelParentAttributeId, Me.labelSyskey, Me.BarCheckHorizontalLayout, Me.BarButtonResetLayout})
Me.RibbonControl1.Location = New System.Drawing.Point(0, 0)
Me.RibbonControl1.MaxItemId = 6
Me.RibbonControl1.MaxItemId = 11
Me.RibbonControl1.Name = "RibbonControl1"
Me.RibbonControl1.Pages.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPage() {Me.RibbonPage1})
Me.RibbonControl1.ShowApplicationButton = DevExpress.Utils.DefaultBoolean.[False]
@ -131,11 +135,39 @@ Partial Class frmEdit
Me.BarButtonDelete.ImageOptions.LargeImage = CType(resources.GetObject("BarButtonDelete.ImageOptions.LargeImage"), System.Drawing.Image)
Me.BarButtonDelete.Name = "BarButtonDelete"
'
'labelParentAttributeId
'
Me.labelParentAttributeId.Caption = "AttributeId"
Me.labelParentAttributeId.Id = 5
Me.labelParentAttributeId.Name = "labelParentAttributeId"
'
'labelSyskey
'
Me.labelSyskey.Caption = "Syskey"
Me.labelSyskey.Id = 6
Me.labelSyskey.Name = "labelSyskey"
'
'BarCheckHorizontalLayout
'
Me.BarCheckHorizontalLayout.Caption = "Horizontales Layout"
Me.BarCheckHorizontalLayout.Id = 9
Me.BarCheckHorizontalLayout.ImageOptions.Image = CType(resources.GetObject("BarCheckHorizontalLayout.ImageOptions.Image"), System.Drawing.Image)
Me.BarCheckHorizontalLayout.ImageOptions.LargeImage = CType(resources.GetObject("BarCheckHorizontalLayout.ImageOptions.LargeImage"), System.Drawing.Image)
Me.BarCheckHorizontalLayout.Name = "BarCheckHorizontalLayout"
'
'BarButtonResetLayout
'
Me.BarButtonResetLayout.Caption = "Layout zurücksetzen"
Me.BarButtonResetLayout.Id = 10
Me.BarButtonResetLayout.ImageOptions.Image = CType(resources.GetObject("BarButtonResetLayout.ImageOptions.Image"), System.Drawing.Image)
Me.BarButtonResetLayout.ImageOptions.LargeImage = CType(resources.GetObject("BarButtonResetLayout.ImageOptions.LargeImage"), System.Drawing.Image)
Me.BarButtonResetLayout.Name = "BarButtonResetLayout"
'
'RibbonPage1
'
Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup1})
Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup1, Me.RibbonPageGroup2})
Me.RibbonPage1.Name = "RibbonPage1"
Me.RibbonPage1.Text = "Aktionen"
Me.RibbonPage1.Text = "Allgemein"
'
'RibbonPageGroup1
'
@ -146,9 +178,17 @@ Partial Class frmEdit
Me.RibbonPageGroup1.ShowCaptionButton = False
Me.RibbonPageGroup1.Text = "Aktionen"
'
'RibbonPageGroup2
'
Me.RibbonPageGroup2.ItemLinks.Add(Me.BarCheckHorizontalLayout)
Me.RibbonPageGroup2.ItemLinks.Add(Me.BarButtonResetLayout)
Me.RibbonPageGroup2.Name = "RibbonPageGroup2"
Me.RibbonPageGroup2.Text = "Layout"
'
'RibbonStatusBar1
'
Me.RibbonStatusBar1.ItemLinks.Add(Me.labelParentAttributeId)
Me.RibbonStatusBar1.ItemLinks.Add(Me.labelSyskey)
Me.RibbonStatusBar1.Location = New System.Drawing.Point(0, 484)
Me.RibbonStatusBar1.Name = "RibbonStatusBar1"
Me.RibbonStatusBar1.Ribbon = Me.RibbonControl1
@ -159,18 +199,12 @@ Partial Class frmEdit
Me.RibbonPage2.Name = "RibbonPage2"
Me.RibbonPage2.Text = "RibbonPage2"
'
'labelParentAttributeId
'
Me.labelParentAttributeId.Caption = "BarStaticItem1"
Me.labelParentAttributeId.Id = 5
Me.labelParentAttributeId.Name = "labelParentAttributeId"
'
'frmEdit
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(1104, 505)
Me.Controls.Add(Me.SplitContainerControl1)
Me.Controls.Add(Me.SplitContainer)
Me.Controls.Add(Me.RibbonStatusBar1)
Me.Controls.Add(Me.RibbonControl1)
Me.Name = "frmEdit"
@ -178,8 +212,8 @@ Partial Class frmEdit
Me.ShowIcon = False
Me.StatusBar = Me.RibbonStatusBar1
Me.Text = "Datensätze bearbeiten"
CType(Me.SplitContainerControl1, System.ComponentModel.ISupportInitialize).EndInit()
Me.SplitContainerControl1.ResumeLayout(False)
CType(Me.SplitContainer, System.ComponentModel.ISupportInitialize).EndInit()
Me.SplitContainer.ResumeLayout(False)
CType(Me.GridList, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.ViewList, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.LayoutControl1, System.ComponentModel.ISupportInitialize).EndInit()
@ -190,7 +224,7 @@ Partial Class frmEdit
End Sub
Friend WithEvents SplitContainerControl1 As DevExpress.XtraEditors.SplitContainerControl
Friend WithEvents SplitContainer As DevExpress.XtraEditors.SplitContainerControl
Friend WithEvents GridList As DevExpress.XtraGrid.GridControl
Friend WithEvents ViewList As DevExpress.XtraGrid.Views.Grid.GridView
Friend WithEvents LayoutControl1 As DevExpress.XtraLayout.LayoutControl
@ -204,4 +238,8 @@ Partial Class frmEdit
Friend WithEvents BarButtonNew As DevExpress.XtraBars.BarButtonItem
Friend WithEvents BarButtonDelete As DevExpress.XtraBars.BarButtonItem
Friend WithEvents labelParentAttributeId As DevExpress.XtraBars.BarStaticItem
Friend WithEvents labelSyskey As DevExpress.XtraBars.BarStaticItem
Friend WithEvents RibbonPageGroup2 As DevExpress.XtraBars.Ribbon.RibbonPageGroup
Friend WithEvents BarCheckHorizontalLayout As DevExpress.XtraBars.BarCheckItem
Friend WithEvents BarButtonResetLayout As DevExpress.XtraBars.BarButtonItem
End Class

View File

@ -176,6 +176,46 @@
5cVUmRFSZEhAVG4sI1RmhBQRoojedqV1j5AiAnrL+czDT1Rlt0gR5t5yuzM8QoowZsqNoRFShIlE5Sfg
iz3pEVKEYaTcSI1YCbi4B2/V6AN6yg014h10/5Bcg69qzJZbhh9xBjdtD1kJBJcJR3B1qpy4HI5ghiwn
UrQgwP9Df+6iycr/ls9EijOR4kykOBMpzqPsfgDZ5w1jF/MagwAAAABJRU5ErkJggg==
</value>
</data>
<data name="BarCheckHorizontalLayout.ImageOptions.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAAkdEVYdFRpdGxlAENvbnRlbnQ7QXJyYW5nZTtBbGln
bjtDb2x1bW5zO1zGIX4AAAA5SURBVDhPY2hpaflPLgYCBrABZcunM5CKMQzwbdrxH4aJ4Y8aMGrAIDWA
VIxiALkYbACIIB//ZwAAbIFcNNtz9AIAAAAASUVORK5CYII=
</value>
</data>
<data name="BarCheckHorizontalLayout.ImageOptions.LargeImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAAkdEVYdFRpdGxlAENvbnRlbnQ7QXJyYW5nZTtBbGln
bjtDb2x1bW5zO1zGIX4AAABvSURBVFhH7c7BDYAgDIXhLug6DmC6gyO4gts9W5IeCOUm5fIOP5Ji0k8A
bK0dqorqBkAMVme7un0xxHG9UtEUcD63ePaTY9L+ePcIIIAAAggggAACCCCAgBRgtXtFU8DqYqnd7TMC
SusAO0uHdUE+LKTicYZIPukAAAAASUVORK5CYII=
</value>
</data>
<data name="BarButtonResetLayout.ImageOptions.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAARdEVYdFRpdGxlAFJlc2V0O1VuZG87E4EW/wAAAKtJ
REFUOE+l0r0NgzAQhmEWQRkiFTtkjtRMkCITpYMuY6SkZ4njey1bOqGDYCgefu7MJ2O7MbNLwmKNdHm8
x5dwRyu9DDJnPFOjl8atA0wI6eST3yP0GBMG4JfvX3nKLeOZWglptwIwyV3SVB1qJaTfC4BfE4+Z0B/+
BSAK4XfozeuAo3YD2CqaTNN/5G3+AthnmixU9SKCQ1LOQPU2FqcPkld/lK8Ii8dZswC12mC3TFCEqwAA
AABJRU5ErkJggg==
</value>
</data>
<data name="BarButtonResetLayout.ImageOptions.LargeImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAARdEVYdFRpdGxlAFJlc2V0O1VuZG87E4EW/wAAAYVJ
REFUWEfFlj1Ow2AMhnsAJK7ThRtwBE7ACEtZGBCH4BSd4SbdOAADUyW24KdKqtfG6ceHqDM8Uuz4tZ18
v6thGBYldVaSOitJnZU44/rptcXa2BhbY2fsR3jGxztiMu0BrQfOyAQjV8aL8WkMDYghFs2PXFoPnGEB
j1Fg3Bp8YVbsFGjQunxaD5xhAQi1iQfjy4jJfwtacnQ1ADRB91nxN+POYKwvR3jGx7sYT47jn9B64IxR
MPER7Hfj3rgwjl8U4B0xxKqW4TjMCa0HzhBBhIQ3Riw4B7GxCSamqwfOCAKFr4pFWqDRHKyOtdYDZwSB
8mzEAi0YjjgnNloPnBGCI9kSbcHE1BxbrQfOCMEZvU2wOlS/03rgjBA8R08TLFHV7rUeOMMC/pvFG+ge
AuBUUxETSZP20D0JgSNVRSylU7vfHH9ahsBvi8du2UY0wbap4rKteIKDI94BSMhXnfUwUhY5jiPlF5IM
ui+7ks1RdiltwVif71q+BKmzktRZSeqsY1h9A4ZDkwafEbAVAAAAAElFTkSuQmCC
</value>
</data>
</root>

View File

@ -1,13 +1,16 @@
Imports DevExpress.XtraEditors
Imports DevExpress.XtraGrid
Imports DevExpress.XtraLayout
Imports DigitalData.Modules.Logging
Public Class frmEdit
Private ReadOnly _Datatable As DataTable
Private _BindingSource As BindingSource
Private _LayoutConfig As ClassUIConfig.EditFormConfig
Private _LanguageDatatable As DataTable
Private _AttributeId As Integer
Private _Syskey As String
Private Class ControlMetadata
Public AttributeId As Integer
@ -15,42 +18,96 @@ Public Class frmEdit
Public ColumnName As String
End Class
Public Sub New(AttributeId As Integer, Datatable As DataTable)
Public Sub New(AttributeId As Integer, Syskey As String, Datatable As DataTable)
' Dieser Aufruf ist für den Designer erforderlich.
InitializeComponent()
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
_Datatable = Datatable
_Syskey = Syskey
_AttributeId = AttributeId
_Datatable = Datatable
_BindingSource = New BindingSource With {
.DataSource = _Datatable
}
End Sub
Private Async Sub frmEdit_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim oGridPatcher = New ClassControlPatcher(Of GridControl)(Me)
oGridPatcher.
ProcessContainer(AddressOf ClassGridControl.DefaultGridSettings).
ProcessContainer(AddressOf ClassGridControl.ReadOnlyGridSettings)
Try
Dim oGridPatcher = New ClassControlPatcher(Of GridControl)(Me)
oGridPatcher.
ProcessContainer(AddressOf ClassGridControl.DefaultGridSettings).
ProcessContainer(AddressOf ClassGridControl.ReadOnlyGridSettings)
labelParentAttributeId.Caption = $"Attribut-ID: {_AttributeId}"
labelParentAttributeId.Caption = $"Attribut-ID: {_AttributeId}"
labelSyskey.Caption = $"Syskey: {_Syskey}"
_BindingSource = New BindingSource()
_BindingSource.DataSource = _Datatable
GridList.DataSource = _BindingSource
GridList.DataSource = _BindingSource
SplitContainerControl1.SplitterPosition = My.UIConfig.FrmEdit_Splitter
_LayoutConfig = GetLayoutBySyskey(_Syskey)
ApplyLayout()
Dim oUserLanguage = My.Application.User.Language
Await LoadLanguageTableAsync(oUserLanguage)
LoadFormLayout()
Await LoadLanguageTableAsync(My.Application.User.Language)
LoadDetailForm()
Catch ex As Exception
_ErrorHandler.ShowErrorMessage(ex)
End Try
End Sub
''' <summary>
''' Applies to currently saved layout to all controls
''' </summary>
Private Sub ApplyLayout()
SplitContainer.Horizontal = _LayoutConfig.SplitterHorizontal
SplitContainer.SplitterPosition = _LayoutConfig.SplitterDistance
BarCheckHorizontalLayout.Checked = _LayoutConfig.SplitterHorizontal
End Sub
Private Function GetLayoutBySyskey(Syskey As String) As ClassUIConfig.EditFormConfig
Dim oConfig = My.UIConfig.EditFormConfigs.Find(Function(c) c.SysKey = Syskey)
If Not IsNothing(oConfig) Then
Return oConfig
Else
Return New ClassUIConfig.EditFormConfig() With {.SysKey = Syskey}
End If
End Function
Private Sub SaveLayoutBySyskey(Syskey As String, Config As ClassUIConfig.EditFormConfig)
Dim oIndex = My.UIConfig.EditFormConfigs.FindIndex(Function(c) c.SysKey = Syskey)
If oIndex >= 0 Then
My.UIConfig.EditFormConfigs.Item(oIndex) = Config
Else
My.UIConfig.EditFormConfigs.Add(Config)
End If
My.UIConfigManager.Save()
End Sub
Private Sub ResetLayoutBySyskey(Syskey As String)
Dim oIndex = My.UIConfig.EditFormConfigs.FindIndex(Function(c) c.SysKey = Syskey)
Dim oDefaultLayout = New ClassUIConfig.EditFormConfig With {.SysKey = Syskey}
If oIndex >= 0 Then
My.UIConfig.EditFormConfigs.Item(oIndex) = oDefaultLayout
End If
My.UIConfigManager.Save()
End Sub
Private Async Function LoadLanguageTableAsync(UserLanguage As String) As Task
Dim oSQL = $"SELECT * FROM VWICM_ATTRIBUTE_LANGUAGE WHERE LANGUAGE_CODE = '{UserLanguage}' AND PARENT_ATTRIBUTE_ID = '{_AttributeId}' ORDER BY ""SEQUENCE"";"
Try
Dim oSQL = $"SELECT * FROM VWICM_ATTRIBUTE_LANGUAGE WHERE LANGUAGE_CODE = '{UserLanguage}' AND PARENT_ATTRIBUTE_ID = '{_AttributeId}' ORDER BY ""SEQUENCE"";"
Await My.Channel.CreateDatabaseRequestAsync("Language Syskey", False)
Dim oResult = Await My.Channel.ReturnDatatableAsync(oSQL)
_LanguageDatatable = oResult.Table
Await My.Channel.CreateDatabaseRequestAsync("Language Syskey", False)
Dim oResult = Await My.Channel.ReturnDatatableAsync(oSQL)
_LanguageDatatable = oResult.Table
Await My.Channel.CloseDatabaseRequestAsync()
Await My.Channel.CloseDatabaseRequestAsync()
Catch ex As Exception
_ErrorHandler.ShowErrorMessage(ex)
End Try
End Function
Private Function GetColumnEditor(Column As DataColumn, AttributeId As Integer)
@ -107,7 +164,7 @@ Public Class frmEdit
Return oRow?.Item(ColumnName)
End Function
Private Sub LoadFormLayout()
Private Sub LoadDetailForm()
' Counter is used to match SEQUENCE in Attributes
' to column order in the used View (eg. VWICM_USER)
Dim oCounter = 0
@ -149,12 +206,25 @@ Public Class frmEdit
End Sub
Private Sub SplitContainerControl1_SplitterPositionChanged(sender As Object, e As EventArgs) Handles SplitContainerControl1.SplitterPositionChanged
My.UIConfig.FrmEdit_Splitter = SplitContainerControl1.SplitterPosition
My.UIConfigManager.Save()
Private Sub SplitContainerControl1_SplitterPositionChanged(sender As Object, e As EventArgs) Handles SplitContainer.SplitterPositionChanged
_LayoutConfig.SplitterDistance = SplitContainer.SplitterPosition
SaveLayoutBySyskey(_Syskey, _LayoutConfig)
End Sub
Private Sub BarButtonSave_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonSave.ItemClick
SaveRecord()
End Sub
Private Sub BarCheckHorizontalLayout_CheckedChanged(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarCheckHorizontalLayout.CheckedChanged
SplitContainer.Horizontal = BarCheckHorizontalLayout.Checked
_LayoutConfig.SplitterHorizontal = BarCheckHorizontalLayout.Checked
SaveLayoutBySyskey(_Syskey, _LayoutConfig)
End Sub
Private Sub BarButtonResetLayout_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonResetLayout.ItemClick
Dim oDefaultLayout = New ClassUIConfig.EditFormConfig With {.SysKey = _Syskey}
SaveLayoutBySyskey(_Syskey, oDefaultLayout)
_LayoutConfig = oDefaultLayout
ApplyLayout()
End Sub
End Class

View File

@ -1,6 +1,6 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class frmMain
Inherits DevExpress.XtraBars.Ribbon.RibbonForm
Inherits BaseRibbonForm
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()>

View File

@ -8,7 +8,6 @@ Imports DevExpress.LookAndFeel
Imports DevExpress.XtraBars.Ribbon
Public Class frmMain
Private _Logger As Logger
Private _Timer As ClassTimer
Private _Loading As Boolean = True
@ -38,75 +37,89 @@ Public Class frmMain
End Sub
Private Sub FrmMain_Load(sender As Object, e As EventArgs) Handles Me.Load
' Initialize Main Timer
_Timer = New ClassTimer(My.LogConfig, Me, My.SysConfig.HeartbeatInterval)
AddHandler _Timer.OnlineChanged, AddressOf HandleOnlineChanged
SetOnlineLabel()
Try
' Initialize Main Timer
_Timer = New ClassTimer(My.LogConfig, Me, My.SysConfig.HeartbeatInterval)
AddHandler _Timer.OnlineChanged, AddressOf HandleOnlineChanged
SetOnlineLabel()
UserLookAndFeel.Default.SetSkinStyle(My.UIConfig.SkinName)
LabelCurrentUser.Caption = My.Application.User.UserName
LabelCurrentMachine.Caption = My.Application.User.MachineName
LabelCurrentVersion.Caption = My.Application.Info.Version.ToString
LabelCurrentLanguage.Caption = My.Application.User.Language
Dim oDashboard = New frmDashboard()
oDashboard.MdiParent = DocumentManager.MdiParent
oDashboard.Show()
' --- Process Manager Panel ---
Dim oDataTable = New DataTable("PMDocuments")
Dim oDocNameColumn = New DataColumn("DocName", GetType(String))
oDataTable.Columns.Add(oDocNameColumn)
Dim oRow = oDataTable.NewRow()
oRow.Item("DocName") = "test1.xlsx"
oDataTable.Rows.Add(oRow)
ProcessManagerWidget.DataSource = oDataTable
AddHandler ProcessManagerWidget.RowDoubleClicked, Sub(RowView As DataRowView)
MsgBox($"Clicked on Document {RowView.Row.Item("DocName")}")
End Sub
AddHandler UserLookAndFeel.Default.StyleChanged, AddressOf frmMain_StyleChanged
LoadLayout()
_Loading = False
Catch ex As Exception
_ErrorHandler.ShowErrorMessage(ex)
End Try
LabelCurrentUser.Caption = My.Application.User.UserName
LabelCurrentMachine.Caption = My.Application.User.MachineName
LabelCurrentVersion.Caption = My.Application.Info.Version.ToString
LabelCurrentLanguage.Caption = My.Application.User.Language
Dim oDashboard = New frmDashboard()
oDashboard.MdiParent = DocumentManager.MdiParent
oDashboard.Show()
' --- Process Manager Panel ---
Dim oDataTable = New DataTable("PMDocuments")
Dim oDocNameColumn = New DataColumn("DocName", GetType(String))
oDataTable.Columns.Add(oDocNameColumn)
Dim oRow = oDataTable.NewRow()
oRow.Item("DocName") = "test1.xlsx"
oDataTable.Rows.Add(oRow)
ProcessManagerWidget.DataSource = oDataTable
AddHandler ProcessManagerWidget.RowDoubleClicked, Sub(RowView As DataRowView)
MsgBox($"Clicked on Document {RowView.Row.Item("DocName")}")
End Sub
AddHandler UserLookAndFeel.Default.StyleChanged, AddressOf frmMain_StyleChanged
LoadLayout()
_Loading = False
End Sub
Private Sub FrmMain_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing
SaveLayout()
End Sub
Private Sub LoadLayout()
Dim oLayoutPathForDockManager As String = GetLayoutPath(GroupName.LayoutMain, LayoutComponent.DockManager)
Dim oLayoutPathForDocumentManager As String = GetLayoutPath(GroupName.LayoutMain, LayoutComponent.DocumentManager)
If File.Exists(oLayoutPathForDockManager) Then
DockManager.RestoreLayoutFromXml(oLayoutPathForDockManager)
End If
If File.Exists(oLayoutPathForDocumentManager) Then
DocumentManager.View.RestoreLayoutFromXml(oLayoutPathForDocumentManager)
Private Sub frmMain_StyleChanged(sender As Object, e As EventArgs) Handles Me.StyleChanged
If _Loading = False Then
My.UIConfig.SkinName = LookAndFeel.ActiveSkinName
My.UIConfigManager.Save()
End If
End Sub
Private Sub LoadLayout()
Try
Dim oLayoutPathForDockManager As String = GetLayoutPath(GroupName.LayoutMain, LayoutComponent.DockManager)
Dim oLayoutPathForDocumentManager As String = GetLayoutPath(GroupName.LayoutMain, LayoutComponent.DocumentManager)
If File.Exists(oLayoutPathForDockManager) Then
DockManager.RestoreLayoutFromXml(oLayoutPathForDockManager)
End If
If File.Exists(oLayoutPathForDocumentManager) Then
DocumentManager.View.RestoreLayoutFromXml(oLayoutPathForDocumentManager)
End If
Catch ex As Exception
_ErrorHandler.ShowErrorMessage(ex)
End Try
End Sub
Private Sub SaveLayout()
Dim oLayoutPathForDockManager As String = GetLayoutPath(GroupName.LayoutMain, LayoutComponent.DockManager)
Dim oLayoutPathForDocumentManager As String = GetLayoutPath(GroupName.LayoutMain, LayoutComponent.DocumentManager)
Dim oDirectory As String = GetLayoutDirectory()
Try
Dim oLayoutPathForDockManager As String = GetLayoutPath(GroupName.LayoutMain, LayoutComponent.DockManager)
Dim oLayoutPathForDocumentManager As String = GetLayoutPath(GroupName.LayoutMain, LayoutComponent.DocumentManager)
Dim oDirectory As String = GetLayoutDirectory()
If Not Directory.Exists(oDirectory) Then
Directory.CreateDirectory(oDirectory)
End If
If Not Directory.Exists(oDirectory) Then
Directory.CreateDirectory(oDirectory)
End If
DockManager.SaveLayoutToXml(oLayoutPathForDockManager)
DocumentManager.View.SaveLayoutToXml(oLayoutPathForDocumentManager)
DockManager.SaveLayoutToXml(oLayoutPathForDockManager)
DocumentManager.View.SaveLayoutToXml(oLayoutPathForDocumentManager)
Catch ex As Exception
_ErrorHandler.ShowErrorMessage(ex)
End Try
End Sub
Private Sub BarButtonUserSettings_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonUserSettings.ItemClick
@ -167,13 +180,6 @@ Public Class frmMain
oForm.Show()
End Sub
Private Sub frmMain_StyleChanged(sender As Object, e As EventArgs) Handles Me.StyleChanged
If _Loading = False Then
My.UIConfig.SkinName = LookAndFeel.ActiveSkinName
My.UIConfigManager.Save()
End If
End Sub
' Manually merge the status bars of the parent and child MDI forms.
Private Sub RibbonControl1_Merge(ByVal sender As System.Object, ByVal e As RibbonMergeEventArgs) Handles RibbonControl.Merge
Dim oParentRibbon As RibbonControl = TryCast(sender, RibbonControl)

View File

@ -1,31 +0,0 @@
Imports System.IO
Imports DigitalData.Modules.Logging
Public Class frmUserBasics
Private _Logger As Logger
Private _MyLogger As LogConfig
Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
' Specify that the link was visited.
Me.LinkLabel1.LinkVisited = True
' Navigate to a URL.
System.Diagnostics.Process.Start("http://www.didalog.de/Support")
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Process.Start(_MyLogger.LogDirectory)
End Sub
Private Sub frmUserBasics_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim oUserAppdata = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Digital Data\EDMI_Client_Suite\Log")
_MyLogger = New LogConfig(LogConfig.PathType.CustomPath, oUserAppdata)
_Logger = _MyLogger.GetLogger()
End Sub
Private Sub btnApplicationFolder_Click(sender As Object, e As EventArgs) Handles btnApplicationFolder.Click
End Sub
End Class