Header menu logo Fittings

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

PersistentSettings(settingsFile, errorLogger)

Full Usage: PersistentSettings(settingsFile, errorLogger)

Parameters:
    settingsFile : 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.

settingsFile : FileInfo
errorLogger : string -> unit
Returns: PersistentSettings

PersistentSettings(settingsFile, separator, errorLogger)

Full Usage: PersistentSettings(settingsFile, separator, errorLogger)

Parameters:
    settingsFile : FileInfo
    separator : char
    errorLogger : string -> unit

Returns: PersistentSettings
settingsFile : FileInfo
separator : char
errorLogger : string -> unit
Returns: PersistentSettings

Instance members

Instance member Description

this.GetBool

Full Usage: this.GetBool

Parameters:
    key : string
    def : bool

Returns: bool

Also saves the default value to the settings if not found.

key : string
def : bool
Returns: bool

this.GetFloat

Full Usage: this.GetFloat

Parameters:
    key : string
    def : float

Returns: float

Also saves the default value to the settings if not found.

key : string
def : float
Returns: float

this.GetInt

Full Usage: this.GetInt

Parameters:
    key : string
    def : int

Returns: int

Also saves the default value to the settings if not found.

key : string
def : int
Returns: int

this.GetString

Full Usage: this.GetString

Parameters:
    key : string
    def : string

Returns: string

Also saves the default value to the settings if not found.

key : string
def : string
Returns: string

this.SaveWithDelay

Full Usage: this.SaveWithDelay

Parameters:
    delay : int

delay : int

this.SaveWithDelay

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.

this.Set

Full Usage: this.Set

Parameters:
    key : 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.

key : string
value : string

this.SetBool

Full Usage: this.SetBool

Parameters:
    key : string
    v : bool

key : string
v : bool

this.SetDelayed

Full Usage: this.SetDelayed

Parameters:
    k : 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.

k : string
v : string
delay : int

this.SetFloat

Full Usage: this.SetFloat

Parameters:
    key : string
    v : float

Using just one digit after zero for precision

key : string
v : float

this.SetFloatDelayed

Full Usage: this.SetFloatDelayed

Parameters:
    key : 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.

key : string
v : float
delay : int

this.SetFloatHighPrec

Full Usage: this.SetFloatHighPrec

Parameters:
    key : string
    v : float

Using maximum digits of precision

key : string
v : float

this.SetInt

Full Usage: this.SetInt

Parameters:
    key : string
    v : int

key : string
v : int

this.TryGetBool

Full Usage: this.TryGetBool

Parameters:
    key : string

Returns: bool option
key : string
Returns: bool option

this.TryGetFloat

Full Usage: this.TryGetFloat

Parameters:
    key : string

Returns: float option
key : string
Returns: float option

this.TryGetInt

Full Usage: this.TryGetInt

Parameters:
    key : string

Returns: int option
key : string
Returns: int option

this.TryGetString

Full Usage: this.TryGetString

Parameters:
    key : string

Returns: string option
key : string
Returns: string option

Type something to start searching.