Save Layout Config in RoamingAppData, LogFiles in LocalAppData

This commit is contained in:
Jonathan Jenne 2019-03-21 16:13:19 +01:00
parent 3312ebc569
commit e90af16932
3 changed files with 9 additions and 14 deletions

View File

@ -12,14 +12,18 @@ Namespace My
Partial Friend Class MyApplication Partial Friend Class MyApplication
Private _Logger As Logger Private _Logger As Logger
Private _BaseUserConfigPath As String = Windows.Forms.Application.UserAppDataPath
Private _BaseMachineConfigPath As String = Windows.Forms.Application.CommonAppDataPath
Public Sub App_Startup() Handles Me.Startup Public Sub App_Startup() Handles Me.Startup
Dim oLogConfig As New LogConfig(PathType.AppData) Dim oLogConfig As New LogConfig(PathType.AppData)
' TODO: WHERE SHOULD CONFIG BE SAVED? LOCAL/ROAMING ' Layout files will be saved in %Appdata% (Roaming) so they will be syncronized with the user profile
Dim oUIConfigPAth = IO.Path.Combine(Windows.Forms.Application.UserAppDataPath, ClassConstants.FOLDER_NAME_LAYOUT) Dim oUIConfigPath = IO.Path.Combine(_BaseUserConfigPath, ClassConstants.FOLDER_NAME_LAYOUT)
Dim oSystemConfigManager As New ConfigManager(Of ClassConfig)(oLogConfig, Windows.Forms.Application.UserAppDataPath, Windows.Forms.Application.CommonAppDataPath) ' Set up config Managers for Layout and System Configs
Dim oUIConfigManager As New ConfigManager(Of ClassUIConfig)(oLogConfig, oUIConfigPAth, oUIConfigPAth) Dim oSystemConfigManager As New ConfigManager(Of ClassConfig)(oLogConfig, _BaseUserConfigPath, _BaseMachineConfigPath)
Dim oUIConfigManager As New ConfigManager(Of ClassUIConfig)(oLogConfig, oUIConfigPath, oUIConfigPath)
LogConfig = oLogConfig LogConfig = oLogConfig
SystemConfigManager = oSystemConfigManager SystemConfigManager = oSystemConfigManager

View File

@ -10,8 +10,6 @@
Public Const ATTRIBUTE_ID_COLUMN = "RECORD_ID" Public Const ATTRIBUTE_ID_COLUMN = "RECORD_ID"
Public Const DB_USER_ATTRIBUTE_ID = 1 Public Const DB_USER_ATTRIBUTE_ID = 1
Public Const DB_USER_ATTRIBUTE_SYSKEY = "001" Public Const DB_USER_ATTRIBUTE_SYSKEY = "001"

View File

@ -61,13 +61,6 @@ Public Class ClassLayout
End Function End Function
Public Shared Function GetLayoutDirectory() As String Public Shared Function GetLayoutDirectory() As String
Return Path.Combine(GetAppDataFolder(), ClassConstants.FOLDER_NAME_LAYOUT) Return Path.Combine(Application.UserAppDataPath, 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 Function
End Class End Class