First Pass of new control loader add BaseClass that provides Logger
This commit is contained in:
@@ -31,6 +31,7 @@ Partial Class frmFormDesigner
|
||||
Me.ToolboxItemMemoedit = New DevExpress.XtraToolbox.ToolboxItem()
|
||||
Me.ToolboxItemDatepicker = New DevExpress.XtraToolbox.ToolboxItem()
|
||||
Me.ToolboxItemCombobox = New DevExpress.XtraToolbox.ToolboxItem()
|
||||
Me.ToolboxItemCheckbox = New DevExpress.XtraToolbox.ToolboxItem()
|
||||
Me.RibbonPageGroup1 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
|
||||
Me.XtraTabControl1 = New DevExpress.XtraTab.XtraTabControl()
|
||||
Me.XtraTabPageControls = New DevExpress.XtraTab.XtraTabPage()
|
||||
@@ -105,7 +106,6 @@ Partial Class frmFormDesigner
|
||||
Me.ToolboxControlMain.Name = "ToolboxControlMain"
|
||||
Me.ToolboxControlMain.OptionsMinimizing.AllowMinimizing = False
|
||||
Me.ToolboxControlMain.OptionsView.ShowMenuButton = False
|
||||
Me.ToolboxControlMain.OptionsView.ShowToolboxCaption = True
|
||||
Me.ToolboxControlMain.SelectedGroup = Me.ToolboxGroupMain
|
||||
Me.ToolboxControlMain.SelectedGroupIndex = 0
|
||||
Me.ToolboxControlMain.Size = New System.Drawing.Size(232, 337)
|
||||
@@ -120,6 +120,7 @@ Partial Class frmFormDesigner
|
||||
Me.ToolboxGroupMain.Items.Add(Me.ToolboxItemMemoedit)
|
||||
Me.ToolboxGroupMain.Items.Add(Me.ToolboxItemDatepicker)
|
||||
Me.ToolboxGroupMain.Items.Add(Me.ToolboxItemCombobox)
|
||||
Me.ToolboxGroupMain.Items.Add(Me.ToolboxItemCheckbox)
|
||||
Me.ToolboxGroupMain.Name = "ToolboxGroupMain"
|
||||
'
|
||||
'ToolboxItemTextbox
|
||||
@@ -154,6 +155,14 @@ Partial Class frmFormDesigner
|
||||
Me.ToolboxItemCombobox.Name = "ToolboxItemCombobox"
|
||||
Me.ToolboxItemCombobox.Tag = "Combobox"
|
||||
'
|
||||
'ToolboxItemCheckbox
|
||||
'
|
||||
Me.ToolboxItemCheckbox.BeginGroupCaption = Nothing
|
||||
Me.ToolboxItemCheckbox.Caption = "Checkbox"
|
||||
Me.ToolboxItemCheckbox.ImageOptions.Image = Global.DigitalData.GUIs.ClientSuite.My.Resources.Resources.CheckBox
|
||||
Me.ToolboxItemCheckbox.Name = "ToolboxItemCheckbox"
|
||||
Me.ToolboxItemCheckbox.Tag = "Checkbox"
|
||||
'
|
||||
'RibbonPageGroup1
|
||||
'
|
||||
Me.RibbonPageGroup1.Name = "RibbonPageGroup1"
|
||||
@@ -162,6 +171,7 @@ Partial Class frmFormDesigner
|
||||
'XtraTabControl1
|
||||
'
|
||||
Me.XtraTabControl1.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.XtraTabControl1.HeaderLocation = DevExpress.XtraTab.TabHeaderLocation.Bottom
|
||||
Me.XtraTabControl1.Location = New System.Drawing.Point(0, 0)
|
||||
Me.XtraTabControl1.Name = "XtraTabControl1"
|
||||
Me.XtraTabControl1.SelectedTabPage = Me.XtraTabPageControls
|
||||
@@ -250,4 +260,5 @@ Partial Class frmFormDesigner
|
||||
Friend WithEvents PropertyGridControl1 As DevExpress.XtraVerticalGrid.PropertyGridControl
|
||||
Friend WithEvents SplitContainerMain As DevExpress.XtraEditors.SplitContainerControl
|
||||
Friend WithEvents ToolboxItemCombobox As DevExpress.XtraToolbox.ToolboxItem
|
||||
Friend WithEvents ToolboxItemCheckbox As DevExpress.XtraToolbox.ToolboxItem
|
||||
End Class
|
||||
|
||||
@@ -7,6 +7,9 @@ Imports DevExpress.XtraLayout.HitInfo
|
||||
Imports DigitalData.Controls.LookupGrid
|
||||
|
||||
Public Class frmFormDesigner
|
||||
Private _FormId As Int64
|
||||
Private _ControlLoader As ClassControlLoader
|
||||
|
||||
#Region "Drag Helper"
|
||||
Private _DragItem As BaseLayoutItem
|
||||
Private _Window As DragFrameWindow
|
||||
@@ -42,7 +45,7 @@ Public Class frmFormDesigner
|
||||
Dim oHitInfo As BaseLayoutItemHitInfo = LayoutControlMain.CalcHitInfo(oPosition)
|
||||
Dim oLayoutControl As LayoutControlItem = DirectCast(_DragItem, LayoutControlItem)
|
||||
Dim oControlName As String = oLayoutControl.Tag & ClassUtils.ShortGUID()
|
||||
Dim oControl As Control = GetControl(oLayoutControl.Tag, oControlName)
|
||||
Dim oControl As Control = _ControlLoader.CreateLayoutControl(oLayoutControl.Tag, oControlName)
|
||||
|
||||
If oLayoutControl IsNot Nothing Then
|
||||
HideDragHelper()
|
||||
@@ -84,7 +87,7 @@ Public Class frmFormDesigner
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
Private _FormId As Int64
|
||||
|
||||
|
||||
Public Sub New()
|
||||
' Dieser Aufruf ist für den Designer erforderlich.
|
||||
@@ -100,69 +103,18 @@ Public Class frmFormDesigner
|
||||
_FormId = FormId
|
||||
End Sub
|
||||
|
||||
Private Sub frmFormDesigner_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||
My.Channel.CreateDatabaseRequest("Load Controls", True)
|
||||
Private Async Sub frmFormDesigner_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||
_ControlLoader = New ClassControlLoader(My.LogConfig)
|
||||
|
||||
Dim oSQL As String = $"SELECT * FROM VWICM_FORMCONTROL WHERE FORMID = {_FormId}"
|
||||
Dim oResult = My.Channel.ReturnDatatable(oSQL)
|
||||
Dim oTable = oResult.Table
|
||||
Dim oTable = Await My.Common.Views.VWICM_FORM_CONTROL(_FormId)
|
||||
|
||||
If Not oResult.OK Then
|
||||
ShowErrorMessage(New ApplicationException(oResult.ErrorMessage))
|
||||
End If
|
||||
|
||||
My.Channel.CloseDatabaseRequest()
|
||||
|
||||
LoadControls(oTable)
|
||||
_ControlLoader.LoadControls(oTable, LayoutControlGroupMain)
|
||||
End Sub
|
||||
|
||||
Private Function GetControl(Type As String, Name As String)
|
||||
Dim oEditor As BaseEdit = Nothing
|
||||
|
||||
Select Case Type
|
||||
Case ClassConstants.CONTROL_TEXTEDIT
|
||||
Dim oTextEdit As New TextEdit() With {.Name = Name}
|
||||
oEditor = oTextEdit
|
||||
Case ClassConstants.CONTROL_MEMOEDIT
|
||||
Dim oMemoEdit As New MemoEdit() With {.Name = Name}
|
||||
oEditor = oMemoEdit
|
||||
Case ClassConstants.CONTROL_DATEEDIT
|
||||
Dim oDateEdit As New DateEdit() With {.Name = Name}
|
||||
oEditor = oDateEdit
|
||||
Case ClassConstants.CONTROL_CHECKEDIT
|
||||
Dim oCheckEdit As New CheckEdit() With {.Name = Name}
|
||||
oEditor = oCheckEdit
|
||||
Case ClassConstants.CONTROL_COMBOEDIT
|
||||
Dim oComboEdit As New LookupControl2() With {.Name = Name}
|
||||
oEditor = oComboEdit
|
||||
Case Else
|
||||
oEditor = Nothing
|
||||
End Select
|
||||
|
||||
Return oEditor
|
||||
End Function
|
||||
|
||||
Private Function CreateLayoutControlItem(Id As String) As LayoutControlItem
|
||||
Return New LayoutControlItem() With {.Tag = Id}
|
||||
End Function
|
||||
|
||||
Private Sub LoadControls(Datatable As DataTable)
|
||||
For Each oRow As DataRow In Datatable.Rows
|
||||
Dim oCaption As String = oRow.Item("COLNAME")
|
||||
Dim oControlType As String = oRow.Item("CTRLTYPE")
|
||||
Dim oControlId As String = oRow.Item("RECORD_ID").ToString
|
||||
Dim oEditor As BaseEdit = GetControl(oControlType, oControlId)
|
||||
|
||||
If oEditor Is Nothing Then
|
||||
Continue For
|
||||
End If
|
||||
|
||||
LayoutControlGroupMain.AddItem(oCaption, oEditor)
|
||||
Next
|
||||
|
||||
LayoutControlGroupMain.AddItem(New EmptySpaceItem())
|
||||
End Sub
|
||||
|
||||
Private Sub LayoutControlMain_ItemSelectionChanged(sender As Object, e As EventArgs) Handles LayoutControlMain.ItemSelectionChanged
|
||||
' TODO: Load Property Grid for selected item
|
||||
End Sub
|
||||
|
||||
Reference in New Issue
Block a user