Imports System.IO ''' ''' Helper Class to save DevExpress layouts ''' ''' Example: ''' ''' Layout 1 (for frmMain) ''' ---------------------------------------------- ''' | Component 1 Component 2 | ''' | |-------------| |----------------| | ''' | | MainGrid | | DocumentGrid | | ''' | |-------------| |----------------| | ''' | | ''' |--------------------------------------------- ''' Public Class ClassLayout Public Enum GroupName LayoutMain 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 Public Shared Function GetLayoutDirectory() As String Return Path.Combine(GetAppDataFolder(), ClassConstants.FOLDER_NAME_LAYOUT) End Function Private Shared Function GetAppDataFolder() As String Dim oLocalAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) Dim oProduct = My.Application.Info.ProductName Dim oCompany = My.Application.Info.CompanyName Return Path.Combine(oLocalAppData, oCompany, oProduct) End Function End Class