PersistentSettings Type
A class to save window size, layout and position, or any arbitrary string-string key-value pairs. This class is useful when app.config does not work in a hosted context. Keys may not contain the separator character, Values and keys may not contain a new line character. Comments are not allowed. Whitespace around keys and values will be trimmed off. Any errors are reported to the provided logging functions.
Constructors
Constructor |
Description
|
Full Usage:
PersistentSettings(settingsFile, errorLogger)
Parameters:
FileInfo
errorLogger : string -> unit
Returns: PersistentSettings
|
Create a class to save window size, layout and position, or any arbitrary string-string key value pairs. This class is useful when app.config does not work in a hosted context. Keys may not contain the separator character '=' , Values and keys may not contain a new line character. Comments are not allowed. Whitespace around keys and values will be trimmed off. Any errors are reported to the provided logging functions.
|
Full Usage:
PersistentSettings(settingsFile, separator, errorLogger)
Parameters:
FileInfo
separator : char
errorLogger : string -> unit
Returns: PersistentSettings
|
|
Instance members
Instance member |
Description
|
Full Usage:
this.GetBool
Parameters:
string
def : bool
Returns: bool
|
Also saves the default value to the settings if not found.
|
Full Usage:
this.GetFloat
Parameters:
string
def : float
Returns: float
|
Also saves the default value to the settings if not found.
|
Full Usage:
this.GetInt
Parameters:
string
def : int
Returns: int
|
Also saves the default value to the settings if not found.
|
Full Usage:
this.GetString
Parameters:
string
def : string
Returns: string
|
Also saves the default value to the settings if not found.
|
Full Usage:
this.SaveWithDelay
Parameters:
int
|
|
Full Usage:
this.SaveWithDelay
|
Write to Settings to file in specified in constructor. Writes after a delay of 400 ms and only if there was no more recent call to Save. |
Full Usage:
this.Set
Parameters:
string
value : string
|
Add string value to the Concurrent settings Dictionary. Keys may not contain the separator character, Values and keys may not contain a new line character. If they do it will be replaced by empty string. And a message will be written to errorLogger. Comments care not allowed. Call this.Save() afterwards to write to file async with a bit of delay.
|
Full Usage:
this.SetBool
Parameters:
string
v : bool
|
|
Full Usage:
this.SetDelayed
Parameters:
string
v : string
delay : int
|
Save setting with a delay. Delayed because the OnMaximize of window event triggers first location changed and then state changed, State change event should still be able to Get previous size and location that is not saved yet. Call Save() afterwards.
|
Full Usage:
this.SetFloat
Parameters:
string
v : float
|
Using just one digit after zero for precision
|
Full Usage:
this.SetFloatDelayed
Parameters:
string
v : float
delay : int
|
Save float to dict after a delay. Using just one digit after zero for precision. A delay is useful e.g. because the OnMaximize of window event triggers first Location changed and then state changed, State change event should still be able to Get previous size and location that is not saved yet.
|
Full Usage:
this.SetFloatHighPrec
Parameters:
string
v : float
|
Using maximum digits of precision
|
Full Usage:
this.SetInt
Parameters:
string
v : int
|
|
Full Usage:
this.TryGetBool
Parameters:
string
Returns: bool option
|
|
Full Usage:
this.TryGetFloat
Parameters:
string
Returns: float option
|
|
Full Usage:
this.TryGetInt
Parameters:
string
Returns: int option
|
|
Full Usage:
this.TryGetString
Parameters:
string
Returns: string option
|
|