Imports System.IO
Imports DevExpress.XtraGrid.Views.Base
'''
''' Helper Class to save DevExpress layouts
'''
''' Example:
'''
''' Layout 1 (for frmMain)
''' ----------------------------------------------
''' | Component 1 Component 2 |
''' | |-------------| |----------------| |
''' | | MainGrid | | DocumentGrid | |
''' | |-------------| |----------------| |
''' | |
''' |---------------------------------------------
'''
Public Class ClassLayout
Public Enum GroupName
LayoutMain
LayoutUserManager
End Enum
Public Enum LayoutComponent
DockManager
DocumentManager
End Enum
'''
''' Returns a path for the chosen Devexpress layout file
'''
''' The Group to which the the component belongs to. For example, a form could be a Layout
''' The component to which the layout belongs to
'''
Public Shared Function GetLayoutPath(Group As GroupName, Component As LayoutComponent) As String
Dim oFileName As String = $"{Group.ToString}-{Component.ToString}.xml"
Return Path.Combine(GetLayoutDirectory(), oFileName)
End Function
'''
''' Returns a path for the chosen Devexpress layout file
'''
''' The Group to which the the component belongs to. For example, a form could be a Layout
''' The component to which the layout belongs to
'''
Public Shared Function GetLayoutPath(Group As GroupName, Component As String) As String
Dim oFileName As String = $"{Group.ToString}-{Component}.xml"
Return Path.Combine(GetLayoutDirectory(), oFileName)
End Function
'''
''' Returns a path for the chosen Devexpress layout file
'''
''' The Group to which the the component belongs to. For example, a form could be a Layout
''' The component to which the layout belongs to
''' The sub component under the component
'''
Public Shared Function GetLayoutPath(Group As GroupName, Component As String, SubComponent As String) As String
Dim oFileName As String = $"{Group.ToString}-{Component}-{SubComponent}.xml"
Return Path.Combine(GetLayoutDirectory(), oFileName)
End Function
Public Shared Function GetLayoutDirectory() As String
Return Path.Combine(Application.UserAppDataPath, ClassConstants.FOLDER_NAME_LAYOUT)
End Function
End Class