Improve Base Form Properties, Improve PanelManager
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
Imports DevExpress.XtraBars.Docking2010
|
||||
Imports DevExpress.XtraBars.Docking2010.Views
|
||||
Imports DevExpress.XtraBars.Docking2010.Views.Tabbed
|
||||
Imports DevExpress.XtraGrid
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class ClassPanelManager
|
||||
@@ -88,17 +89,42 @@ Public Class ClassPanelManager
|
||||
' TODO: determine how much panels at most can be added
|
||||
' check if initial panels should be loaded
|
||||
For Each oPanelInfo As PanelInfo In oInitialPanelInfo
|
||||
' Create the control
|
||||
Dim oControl = oPanelInfo.InnerControl
|
||||
oControl.Dock = DockStyle.Fill
|
||||
|
||||
' Create the panel and add the control
|
||||
' create the panel
|
||||
Dim oPanel = _dockManager.AddPanel(oPanelInfo.Position)
|
||||
|
||||
' create the control
|
||||
Dim oControl As BasePanel = GetPanelControl(oPanelInfo)
|
||||
|
||||
If oControl Is Nothing Then
|
||||
Dim oPanelType = oPanelInfo.PanelControl.GetType.ToString
|
||||
_logger.Warn("Unknown panel type {0}", oPanelType)
|
||||
Continue For
|
||||
End If
|
||||
|
||||
' configure the panel
|
||||
oPanel.Options.ShowCloseButton = oPanelInfo.CanBeClosed
|
||||
oPanel.Options.ShowAutoHideButton = oPanelInfo.CanBePinned
|
||||
oPanel.Options.ShowMaximizeButton = oPanelInfo.CanBeMaximized
|
||||
oPanel.Options.AllowFloating = oPanelInfo.CanBeUndocked
|
||||
|
||||
' hashcode is needed to know which form a panel belongs to
|
||||
oPanel.Tag = oForm.GetHashCode
|
||||
oPanel.Text = oPanelInfo.Caption
|
||||
oPanel.Text = oPanelInfo.Title
|
||||
oPanel.Controls.Add(oControl)
|
||||
Next
|
||||
|
||||
' TODO: establish communication channel to load panels on-demand
|
||||
End Sub
|
||||
|
||||
Private Function GetPanelControl(PanelInfo As PanelInfo) As BasePanel
|
||||
If TypeOf PanelInfo.PanelControl Is DocumentPanel Then
|
||||
Dim oPanelControl As DocumentPanel = DirectCast(PanelInfo.PanelControl, DocumentPanel)
|
||||
oPanelControl.Datasource = PanelInfo.Datasource
|
||||
oPanelControl.Dock = DockStyle.Fill
|
||||
|
||||
Return oPanelControl
|
||||
Else
|
||||
Return Nothing
|
||||
End If
|
||||
End Function
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user