74 lines
2.8 KiB
VB.net
74 lines
2.8 KiB
VB.net
Imports DevExpress.Utils
|
|
Imports DevExpress.XtraBars.Docking
|
|
Imports DevExpress.XtraGrid.Views.Grid
|
|
Imports DigitalData.Modules.Base
|
|
Imports DigitalData.Modules.Config
|
|
Imports DigitalData.Modules.Logging
|
|
|
|
Namespace DocumentResultList
|
|
Public Class Layout
|
|
Inherits BaseClass
|
|
|
|
Private Config As ConfigManager(Of Config)
|
|
|
|
Public Sub New(pLogConfig As LogConfig, pConfig As ConfigManager(Of DocumentResultList.Config))
|
|
MyBase.New(pLogConfig)
|
|
Config = pConfig
|
|
End Sub
|
|
|
|
Public Sub DockManager_SaveLayout(pDockManager As DockManager)
|
|
Try
|
|
Dim oXml As String = GetDockmanager_LayoutName()
|
|
pDockManager.SaveLayoutToXml(oXml)
|
|
Catch ex As Exception
|
|
Logger.Error(ex)
|
|
Logger.Info("Error while saving GridLayout: " & ex.Message)
|
|
End Try
|
|
End Sub
|
|
|
|
Public Sub DockManager_RestoreLayout(pDockManager As DockManager)
|
|
Try
|
|
Dim oXml As String = GetDockmanager_LayoutName()
|
|
pDockManager.RestoreLayoutFromXml(oXml)
|
|
Catch ex As Exception
|
|
Logger.Error(ex)
|
|
Logger.Info("Error while restoring GridLayout: " & ex.Message)
|
|
End Try
|
|
End Sub
|
|
|
|
Public Sub GridView_RestoreLayout(pGridView As GridView)
|
|
Try
|
|
Dim oLayoutFile As String = GetGrid_LayoutName(pGridView)
|
|
If IO.File.Exists(oLayoutFile) Then
|
|
pGridView.RestoreLayoutFromXml(oLayoutFile, OptionsLayoutBase.FullLayout)
|
|
End If
|
|
Catch ex As Exception
|
|
Logger.Error(ex)
|
|
Logger.Info("Error while restoring layout: " & ex.Message)
|
|
End Try
|
|
End Sub
|
|
|
|
Public Sub GridView_SaveLayout(pGridView As GridView)
|
|
Try
|
|
Dim oXml As String = GetGrid_LayoutName(pGridView)
|
|
pGridView.SaveLayoutToXml(oXml, OptionsLayoutBase.FullLayout)
|
|
Catch ex As Exception
|
|
Logger.Error(ex)
|
|
Logger.Info("Error while saving GridLayout: " & ex.Message)
|
|
End Try
|
|
End Sub
|
|
|
|
Public Function GetDockmanager_LayoutName() As String
|
|
Dim Filename As String = $"DockManagerDocResult_UserLayout.xml"
|
|
Dim oDirectory As String = IO.Path.GetDirectoryName(Config.UserConfigPath)
|
|
Return IO.Path.Combine(oDirectory, Filename)
|
|
End Function
|
|
|
|
Public Function GetGrid_LayoutName(pGridView As GridView) As String
|
|
Dim Filename As String = $"DevExpressGridViewDocResult_{pGridView.Name}UserLayout.xml"
|
|
Dim oDirectory As String = IO.Path.GetDirectoryName(Config.UserConfigPath)
|
|
Return IO.Path.Combine(oDirectory, Filename)
|
|
End Function
|
|
End Class
|
|
|
|
End Namespace |