Monorepo/GUIs.ClientSuite/ClassConfig.vb
2019-04-15 14:30:00 +02:00

51 lines
1.8 KiB
VB.net

Imports System.Xml.Serialization
Imports DigitalData.Modules.Config.ConfigAttributes
''' <summary>
''' --- User Config for EDMI ---
'''
''' All settings are simple properties that should have a default value where possible
'''
''' More complex properties (for example, ServiceConnection) are built from simple ones,
''' should be readonly and have an `XmlIgnore` Attribute to prevent them from being saved to the config file.
'''
''' They can make saving and loading complex properties more easy.
'''
''' The config is loaded with `ConfigManager` which is initialized in ApplicationEvents
''' to ensure that the config is loaded before any of the forms (that might need a config)
'''
''' The config object can be accessed in two ways:
'''
''' - My.ConfigManager.Config
''' - My.Config (which simply points to My.ConfigManager.Config)
'''
''' After changing a config value, My.ConfigManager.Save() must be called to persist the change in the config file
''' </summary>
Public Class ClassConfig
' === Complex/Readonly Config Properties
<XmlIgnore>
Public ReadOnly Property ServiceConnection As String
Get
If ServiceIP = String.Empty Or ServicePort = -1 Then
Return String.Empty
Else
Return $"net.tcp://{ServiceIP}:{ServicePort}/DigitalData/Services/Main"
End If
End Get
End Property
' === Simple/Actual Config Properties ===
' === Service Configuration ===
<ConnectionString>
Public Property ServiceIP As String = String.Empty
<ConnectionString>
Public Property ServicePort As Integer = -1
Public Property HeartbeatInterval As Integer = 5000
' === Logging Configuration
Public Property LogDebug As Boolean = False
' === User Configuration ===
Public Property UserLanguage As String = "de-DE"
End Class