diff --git a/EDMI_ClientSuite/ClassPanelManager.vb b/EDMI_ClientSuite/ClassPanelManager.vb
new file mode 100644
index 00000000..38740535
--- /dev/null
+++ b/EDMI_ClientSuite/ClassPanelManager.vb
@@ -0,0 +1,104 @@
+Imports DevExpress.XtraBars.Docking
+Imports DevExpress.XtraBars.Docking2010
+Imports DevExpress.XtraBars.Docking2010.Views
+Imports DevExpress.XtraBars.Docking2010.Views.Tabbed
+Imports DigitalData.Modules.Logging
+
+Public Class ClassPanelManager
+ Private _logger As Logger
+ Private _logConfig As LogConfig
+
+ Private _documentManager As DocumentManager
+ Private _dockManager As DockManager
+ Private _view As TabbedView
+
+ Private _panels As New List(Of DockPanel)
+ Private _documents As New List(Of Document)
+
+ Public Sub New(LogConfig As LogConfig, DocumentManager As DocumentManager, DockManager As DockManager)
+ Try
+ Dim oView = DocumentManager.View
+
+ _logConfig = LogConfig
+ _logger = LogConfig.GetLogger()
+
+ _documentManager = DocumentManager
+ _dockManager = DockManager
+ _view = oView
+
+ AddHandler oView.DocumentAdded, AddressOf View_DocumentAdded
+ AddHandler oView.DocumentClosed, AddressOf View_DocumentClosed
+ AddHandler oView.DocumentClosing, AddressOf View_DocumentClosing
+ AddHandler oView.DocumentActivated, AddressOf View_DocumentActivated
+ AddHandler oView.DocumentDeactivated, AddressOf View_DocumentDeactivated
+ Catch ex As Exception
+ _logger.Error(ex)
+ Throw ex
+ End Try
+ End Sub
+
+
+
+ Private Sub View_DocumentDeactivated(sender As Object, e As DocumentEventArgs)
+ ' Maybe hide panels for this form
+ End Sub
+
+ Private Sub View_DocumentActivated(sender As Object, e As DocumentEventArgs)
+ Dim oDocument As BaseDocument = e.Document
+
+ If oDocument Is Nothing Then
+ Exit Sub
+ End If
+
+ ' Show Panels for this form
+ End Sub
+
+ Private Sub View_DocumentClosing(sender As Object, e As DocumentCancelEventArgs)
+ ' close all related panels
+ For Each oPanel As DockPanel In _dockManager.Panels
+ Dim oTag As Integer = oPanel.Tag
+
+ If oTag = e.Document.Control.GetHashCode() Then
+ oPanel.Close()
+ End If
+ Next
+ End Sub
+
+ Private Sub View_DocumentClosed(sender As Object, e As DocumentEventArgs)
+ ' remove event handlers
+ _documents.Remove(e.Document)
+ End Sub
+
+ Private Sub View_DocumentAdded(sender As Object, e As DocumentEventArgs)
+ ' Only Ribbon Forms can have panels!
+ If TypeOf e.Document.Control IsNot BaseRibbonForm Then
+ Exit Sub
+ End If
+
+ ' Don't open panels for the same form twice!
+ If _documents.Contains(e.Document) Then
+ Exit Sub
+ End If
+
+ _documents.Add(e.Document)
+
+ Dim oForm As BaseRibbonForm = e.Document.Control
+ Dim oInitialPanelInfo As List(Of PanelInfo) = oForm.GetInitialPanels()
+
+ ' 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
+ Dim oPanel = _dockManager.AddPanel(oPanelInfo.Position)
+ oPanel.Tag = oForm.GetHashCode
+ oPanel.Text = oPanelInfo.Caption
+ oPanel.Controls.Add(oControl)
+ Next
+
+ ' TODO: establish communication channel to load panels on-demand
+ End Sub
+End Class
diff --git a/EDMI_ClientSuite/ClientSuite.vbproj b/EDMI_ClientSuite/ClientSuite.vbproj
index f444cb1f..3f30d0fa 100644
--- a/EDMI_ClientSuite/ClientSuite.vbproj
+++ b/EDMI_ClientSuite/ClientSuite.vbproj
@@ -134,6 +134,7 @@
+
@@ -146,6 +147,20 @@
Form
+
+ BasePanel.vb
+
+
+ UserControl
+
+
+ DocumentPanel.vb
+
+
+ UserControl
+
+
+
DockManagerTest.vb
@@ -291,6 +306,9 @@
frmSearch.vb
+
+ DocumentPanel.vb
+
DockManagerTest.vb
diff --git a/EDMI_ClientSuite/FormDefaults/BaseRibbonForm.vb b/EDMI_ClientSuite/FormDefaults/BaseRibbonForm.vb
index 46c412ac..10fcc0ff 100644
--- a/EDMI_ClientSuite/FormDefaults/BaseRibbonForm.vb
+++ b/EDMI_ClientSuite/FormDefaults/BaseRibbonForm.vb
@@ -1,4 +1,5 @@
-Imports DevExpress.XtraBars.Ribbon
+Imports DevExpress.XtraBars.Docking
+Imports DevExpress.XtraBars.Ribbon
Imports DigitalData.Modules.Logging
'''
@@ -10,6 +11,8 @@ Imports DigitalData.Modules.Logging
'''
''' ...
''' End Class
+'''
+''' Only BaseRibbonForms can have panels attached to it!
'''
Public Class BaseRibbonForm
Inherits RibbonForm
@@ -30,6 +33,10 @@ Public Class BaseRibbonForm
' depends on a global var like My.LogConfig
' you might need to check for its existence with ?
End Sub
+
+ Public Overridable Function GetInitialPanels() As List(Of PanelInfo)
+ Return New List(Of PanelInfo)
+ End Function
End Class
diff --git a/EDMI_ClientSuite/Panels/BasePanel.Designer.vb b/EDMI_ClientSuite/Panels/BasePanel.Designer.vb
new file mode 100644
index 00000000..fb6a0d8b
--- /dev/null
+++ b/EDMI_ClientSuite/Panels/BasePanel.Designer.vb
@@ -0,0 +1,29 @@
+ _
+Partial Class BasePanel
+ Inherits System.Windows.Forms.UserControl
+
+ 'UserControl überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
+ _
+ Protected Overrides Sub Dispose(ByVal disposing As Boolean)
+ Try
+ If disposing AndAlso components IsNot Nothing Then
+ components.Dispose()
+ End If
+ Finally
+ MyBase.Dispose(disposing)
+ End Try
+ End Sub
+
+ 'Wird vom Windows Form-Designer benötigt.
+ Private components As System.ComponentModel.IContainer
+
+ 'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich.
+ 'Das Bearbeiten ist mit dem Windows Form-Designer möglich.
+ 'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
+ _
+ Private Sub InitializeComponent()
+ components = New System.ComponentModel.Container()
+ Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
+ End Sub
+
+End Class
diff --git a/EDMI_ClientSuite/Panels/BasePanel.vb b/EDMI_ClientSuite/Panels/BasePanel.vb
new file mode 100644
index 00000000..a3733566
--- /dev/null
+++ b/EDMI_ClientSuite/Panels/BasePanel.vb
@@ -0,0 +1,3 @@
+Public Class BasePanel
+
+End Class
diff --git a/EDMI_ClientSuite/Panels/DocumentPanel.Designer.vb b/EDMI_ClientSuite/Panels/DocumentPanel.Designer.vb
new file mode 100644
index 00000000..0451c34f
--- /dev/null
+++ b/EDMI_ClientSuite/Panels/DocumentPanel.Designer.vb
@@ -0,0 +1,61 @@
+ _
+Partial Class DocumentPanel
+ Inherits System.Windows.Forms.UserControl
+
+ 'UserControl überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
+ _
+ Protected Overrides Sub Dispose(ByVal disposing As Boolean)
+ Try
+ If disposing AndAlso components IsNot Nothing Then
+ components.Dispose()
+ End If
+ Finally
+ MyBase.Dispose(disposing)
+ End Try
+ End Sub
+
+ 'Wird vom Windows Form-Designer benötigt.
+ Private components As System.ComponentModel.IContainer
+
+ 'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich.
+ 'Das Bearbeiten ist mit dem Windows Form-Designer möglich.
+ 'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
+ _
+ Private Sub InitializeComponent()
+ Me.GridControl1 = New DevExpress.XtraGrid.GridControl()
+ Me.GridView1 = New DevExpress.XtraGrid.Views.Grid.GridView()
+ CType(Me.GridControl1, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.GridView1, System.ComponentModel.ISupportInitialize).BeginInit()
+ Me.SuspendLayout()
+ '
+ 'GridControl1
+ '
+ Me.GridControl1.Dock = System.Windows.Forms.DockStyle.Fill
+ Me.GridControl1.Location = New System.Drawing.Point(0, 0)
+ Me.GridControl1.MainView = Me.GridView1
+ Me.GridControl1.Name = "GridControl1"
+ Me.GridControl1.Size = New System.Drawing.Size(1027, 383)
+ Me.GridControl1.TabIndex = 0
+ Me.GridControl1.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.GridView1})
+ '
+ 'GridView1
+ '
+ Me.GridView1.GridControl = Me.GridControl1
+ Me.GridView1.Name = "GridView1"
+ '
+ 'DocumentPanel
+ '
+ Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
+ Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
+ Me.Controls.Add(Me.GridControl1)
+ Me.Name = "DocumentPanel"
+ Me.Size = New System.Drawing.Size(1027, 383)
+ CType(Me.GridControl1, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.GridView1, System.ComponentModel.ISupportInitialize).EndInit()
+ Me.ResumeLayout(False)
+
+ End Sub
+
+ Friend WithEvents GridControl1 As DevExpress.XtraGrid.GridControl
+ Friend WithEvents GridView1 As DevExpress.XtraGrid.Views.Grid.GridView
+End Class
diff --git a/EDMI_ClientSuite/Panels/DocumentPanel.resx b/EDMI_ClientSuite/Panels/DocumentPanel.resx
new file mode 100644
index 00000000..1af7de15
--- /dev/null
+++ b/EDMI_ClientSuite/Panels/DocumentPanel.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/EDMI_ClientSuite/Panels/DocumentPanel.vb b/EDMI_ClientSuite/Panels/DocumentPanel.vb
new file mode 100644
index 00000000..73aca527
--- /dev/null
+++ b/EDMI_ClientSuite/Panels/DocumentPanel.vb
@@ -0,0 +1,12 @@
+Imports DevExpress.XtraGrid
+
+Public Class DocumentPanel
+ Inherits BasePanel
+
+ Private Sub DocumentPanel_Load(sender As Object, e As EventArgs) Handles Me.Load
+ Dim oGridPatcher As New ClassControlPatcher(Of GridControl)(Me)
+ oGridPatcher.
+ ProcessContainer(AddressOf GridControlDefaults.DefaultGridSettings).
+ ProcessContainer(AddressOf GridControlDefaults.ReadOnlyGridSettings)
+ End Sub
+End Class
diff --git a/EDMI_ClientSuite/Panels/IPanel.vb b/EDMI_ClientSuite/Panels/IPanel.vb
new file mode 100644
index 00000000..17fd6f87
--- /dev/null
+++ b/EDMI_ClientSuite/Panels/IPanel.vb
@@ -0,0 +1,3 @@
+Public Interface IPanel
+ ReadOnly Property PanelName As String
+End Interface
diff --git a/EDMI_ClientSuite/Panels/PanelInfo.vb b/EDMI_ClientSuite/Panels/PanelInfo.vb
new file mode 100644
index 00000000..6a43a203
--- /dev/null
+++ b/EDMI_ClientSuite/Panels/PanelInfo.vb
@@ -0,0 +1,7 @@
+Imports DevExpress.XtraBars.Docking
+
+Public Class PanelInfo
+ Public Caption As String
+ Public InnerControl As BasePanel
+ Public Position As DockingStyle
+End Class
diff --git a/EDMI_ClientSuite/frmMain.vb b/EDMI_ClientSuite/frmMain.vb
index bbf0478b..ac97cb01 100644
--- a/EDMI_ClientSuite/frmMain.vb
+++ b/EDMI_ClientSuite/frmMain.vb
@@ -8,8 +8,10 @@ Imports DevExpress.LookAndFeel
Imports DevExpress.XtraBars.Ribbon
Imports DevExpress.XtraBars.Docking
Imports DevExpress.XtraGrid
+Imports DevExpress.XtraBars.Docking2010.Views
Public Class frmMain
+ Private _PanelManager As ClassPanelManager
Private _Timer As ClassTimer
Private _Loading As Boolean = True
@@ -44,6 +46,9 @@ Public Class frmMain
_Timer = New ClassTimer(My.LogConfig, Me, My.SysConfig.HeartbeatInterval)
AddHandler _Timer.OnlineChanged, AddressOf HandleOnlineChanged
+ ' Initialize Panel Manager
+ _PanelManager = New ClassPanelManager(My.LogConfig, DocumentManager, DockManager)
+
' Show Service Status Label
SetOnlineLabel()
@@ -192,6 +197,8 @@ Public Class frmMain
End Sub
Private Sub MainNav_SelectedItemChanging(sender As Object, e As DevExpress.XtraBars.Navigation.SelectedItemChangingEventArgs) Handles MainNav.SelectedItemChanging
+
+
Select Case e.Item.Name
Case NavbarItemHome.Name
Dim oForm As New frmHome()
@@ -201,35 +208,6 @@ Public Class frmMain
Dim oForm As New frmSearch()
oForm.MdiParent = DocumentManager.MdiParent
oForm.Show()
-
- Dim oSearchPanel = DockManager.AddPanel(DockingStyle.Bottom)
- oSearchPanel.Options.ShowCloseButton = False
- oSearchPanel.Options.ShowAutoHideButton = False
- oSearchPanel.Text = "Search " & New Random().Next()
- oSearchPanel.Controls.Add(New GridControl With {.Dock = DockStyle.Fill})
-
- Dim oSearchPanel2 = DockManager.AddPanel(DockingStyle.Bottom)
- oSearchPanel2.Options.ShowCloseButton = False
- oSearchPanel2.Options.ShowAutoHideButton = False
- oSearchPanel2.Text = "Search " & New Random().Next()
- oSearchPanel2.Controls.Add(New GridControl With {.Dock = DockStyle.Fill})
-
- oSearchPanel2.DockTo(oSearchPanel)
-
- AddHandler oForm.FormClosed, Sub()
- oSearchPanel.Close()
- oSearchPanel2.Close()
- End Sub
-
- 'AddHandler oForm.Deactivate, Sub()
- ' oSearchPanel.Visibility = DockVisibility.Hidden
- ' oSearchPanel2.Visibility = DockVisibility.Hidden
- ' End Sub
-
- 'AddHandler oForm.Activated, Sub()
- ' oSearchPanel2.Visibility = DockVisibility.Visible
- ' oSearchPanel.Visibility = DockVisibility.Visible
- ' End Sub
End Select
e.Cancel = True
diff --git a/EDMI_ClientSuite/frmSearch.Designer.vb b/EDMI_ClientSuite/frmSearch.Designer.vb
index cabcf6ec..c3f5e582 100644
--- a/EDMI_ClientSuite/frmSearch.Designer.vb
+++ b/EDMI_ClientSuite/frmSearch.Designer.vb
@@ -1,6 +1,6 @@
_
Partial Class frmSearch
- Inherits DevExpress.XtraBars.Ribbon.RibbonForm
+ Inherits BaseRibbonForm
'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
_
diff --git a/EDMI_ClientSuite/frmSearch.vb b/EDMI_ClientSuite/frmSearch.vb
index 22d1c979..4bf00a18 100644
--- a/EDMI_ClientSuite/frmSearch.vb
+++ b/EDMI_ClientSuite/frmSearch.vb
@@ -1,4 +1,6 @@
-Imports DevExpress.XtraEditors.Controls
+Imports DevExpress.XtraBars.Docking
+Imports DevExpress.XtraEditors.Controls
+Imports DevExpress.XtraGrid
Public Class frmSearch
Private Sub frmSearch_Load(sender As Object, e As EventArgs) Handles Me.Load
@@ -10,8 +12,17 @@ Public Class frmSearch
ImageListBoxControl1.Items.Add(oItem)
Next
-
-
-
End Sub
+
+ Public Overrides Function GetInitialPanels() As List(Of PanelInfo)
+ Dim oList = MyBase.GetInitialPanels()
+
+ oList.Add(New PanelInfo() With {
+ .Caption = "Search",
+ .InnerControl = New DocumentPanel(),
+ .Position = DockingStyle.Bottom
+ })
+
+ Return oList
+ End Function
End Class
\ No newline at end of file