C# Класс XCore.PropertyTable

Наследование: IFWDisposable
Показать файл Открыть проект Примеры использования класса

Private Properties

Свойство Тип Описание
BroadcastPropertyChange void
DecodeLocalPropertyName string
Dispose void
FormatPropertyNameForLocalSettings string
FormatPropertyNameForLocalSettings string
GetBestSettings PropertyTable.SettingsGroup
GetBestSettings SettingsGroup
GetBoolPropertyInternal bool
GetIntPropertyInternal int
GetPathPrefixForSettingsId string
GetStringPropertyInternal string
GetValueInternal object
GetValueInternal object
MakePropertyArrayForSerializing Property[]
MakePropertyArrayForSerializingForNewProjectName Property[]
ReadPropertyArrayForDeserializing void
RemoveLocalAndGlobalSettings void
SaveGlobalSettings void
SaveLocalSettings void
SetDefaultInternal void
SetPropertyDisposeInternal void
SetPropertyInternal void
SetPropertyInternal void
SetPropertyPersistenceInternal void
TestForBestSettings SettingsGroup
TraceVerboseLine void

Открытые методы

Метод Описание
CheckDisposed ( ) : void

Check to see if the object has been disposed. All public Properties and Methods should call this before doing anything else.

Dispose ( ) : void

Must not be virtual.

GetBoolProperty ( string name, bool defaultValue ) : bool

Gets the boolean value of property in the best settings group (trying local first then global) and creates the (global) property with the default value if it doesn't exist yet.

GetBoolProperty ( string name, bool defaultValue, SettingsGroup settingsGroup ) : bool

Gets boolean value of property for the specified settingsGroup and creates the property with the default value if it doesn't exist yet.

GetIntProperty ( string name, int defaultValue ) : int

Gets the int value of property in the best settings group (trying local first then global) and creates the (global) property with the default value if it doesn't exist yet.

GetIntProperty ( string name, int defaultValue, SettingsGroup settingsGroup ) : int

Gets string value of property for the specified settingsGroup and creates the property with the default value if it doesn't exist yet.

GetPropertiesDumpString ( ) : string
GetStringProperty ( string name, string defaultValue ) : string

Gets the string value of property in the best settings group (trying local first then global) and creates the (global) property with the default value if it doesn't exist yet.

GetStringProperty ( string name, string defaultValue, SettingsGroup settingsGroup ) : string

Gets string value of property for the specified settingsGroup and creates the property with the default value if it doesn't exist yet.

GetValue ( string name ) : object

get the value of the best property (i.e. tries local first, then global).

GetValue ( string name, SettingsGroup settingsGroup ) : object

Get the value of the property of the specified settingsGroup.

GetValue ( string name, object defaultValue ) : object

get the value of the best property (tries local then global), set the defaultValue if it doesn't exist. (creates global property)

GetValue ( string name, object defaultValue, SettingsGroup settingsGroup ) : object

Get the value of the property in the specified settingsGroup. Sets the defaultValue if the property doesn't exist.

PropertyExists ( string name ) : bool

Test whether a property exists, tries local first and then global.

PropertyExists ( string name, SettingsGroup &bestGuessGroup ) : bool

Tests whether a property exists, and gives the 'best' group it was found in (ie. local first and then global).

PropertyExists ( string name, object &propertyValue, SettingsGroup &bestGuessGroup ) : bool

Test whether a property exists and gives its 'best' group and its value. (ie. local first and then global).

PropertyTable ( XCore.Mediator mediator ) : System

Initializes a new instance of the PropertySet class.

RemoveProperty ( string name ) : void

Remove a property from the table.

RestoreFromFile ( string settingsId ) : void

load with properties stored in the settings file, if that file is found.

Save ( string settingsId, string omitSettingIds ) : void

save the project and its contents to a file

SaveLocalSettingsForNewProjectName ( string oldSettingsId, string newSettingsId ) : void

Save database specific settings for the renamed Fieldworks project. Rename settings starting with the old project name (oldSettingsId) to the new project name (newSettingsId). Also write it to a file using the new project name.

SetDefault ( string name, object defaultValue, bool doBroadcastChange ) : void

set the default; does nothing if this value is already in the PropertyTable (local or global).

SetDefault ( string name, object defaultValue, bool doBroadcastChange, SettingsGroup settingsGroup ) : void

set the default; does nothing if this value is already in the specified settingsGroup.

SetProperty ( string name, object newValue ) : void

set the value of the best property (try finding local first, then global) and broadcast the change.

SetProperty ( string name, object newValue, SettingsGroup settingsGroup ) : void

set the property value for the specified settingsGroup (broadcast change by default)

SetProperty ( string name, object newValue, bool doBroadcastChange ) : void

set the value of the best property (try finding local first, then global) and broadcast the change if so instructed

SetProperty ( string name, object newValue, bool doBroadcastChange, SettingsGroup settingsGroup ) : void

set the property value for the specified settingsGroup, and allow user to not broadcast the change.

SetPropertyDispose ( string name, bool doDispose ) : void
SetPropertyDispose ( string name, bool doDispose, SettingsGroup settingsGroup ) : void
SetPropertyPersistence ( string name, bool doPersist ) : void
SetPropertyPersistence ( string name, bool doPersist, SettingsGroup settingsGroup ) : void
SettingsPath ( string settingsId ) : string

Get a file path for the project settings file.

Приватные методы

Метод Описание
BroadcastPropertyChange ( string name ) : void
DecodeLocalPropertyName ( string name ) : string
Dispose ( bool disposing ) : void

Executes in two distinct scenarios. 1. If disposing is true, the method has been called directly or indirectly by a user's code via the Dispose method. Both managed and unmanaged resources can be disposed. 2. If disposing is false, the method has been called by the runtime from inside the finalizer and you should not reference (access) other managed objects, as they already have been garbage collected. Only unmanaged resources can be disposed.

If any exceptions are thrown, that is fine. If the method is being done in a finalizer, it will be ignored. If it is thrown by client code calling Dispose, it needs to be handled by fixing the bug. If subclasses override this method, they should call the base implementation.

FormatPropertyNameForLocalSettings ( string name ) : string
FormatPropertyNameForLocalSettings ( string name, string settingsId ) : string
GetBestSettings ( string ids ) : PropertyTable.SettingsGroup

Get the best settings for the first property found in a set of property names. This is useful for setting/retrieving contextual properties based upon the group setting of some root property. The user may want to look up the setting based upon the contextual name, and then the root property name, if it couldn't find one.

GetBestSettings ( string name ) : SettingsGroup

See if we can find an existing property setting trying local first, and then global.

GetBoolPropertyInternal ( string name, bool defaultValue ) : bool

Gets the boolean value of property and creates the property with the default value if it doesn't exist yet.

GetIntPropertyInternal ( string name, int defaultValue ) : int

Gets the string value of property and creates the property with the default value if it doesn't exist yet.

GetPathPrefixForSettingsId ( string settingsId ) : string
GetStringPropertyInternal ( string name, string defaultValue ) : string

Gets the string value of property and creates the property with the default value if it doesn't exist yet.

GetValueInternal ( string key ) : object

get the value of a property

GetValueInternal ( string key, object defaultValue ) : object

Get the value of the property of the specified settingsGroup.

MakePropertyArrayForSerializing ( string settingsId, string omitSettingIds ) : Property[]
MakePropertyArrayForSerializingForNewProjectName ( string oldSettingsId, string newSettingsId ) : Property[]
ReadPropertyArrayForDeserializing ( Property list ) : void
RemoveLocalAndGlobalSettings ( ) : void
SaveGlobalSettings ( ) : void
SaveLocalSettings ( ) : void
SetDefaultInternal ( string key, object defaultValue, bool doBroadcastChange ) : void

set a default; does nothing if this value is already in the PropertyTable.

SetPropertyDisposeInternal ( string name, bool doDispose ) : void
SetPropertyInternal ( string key, object newValue ) : void

set the value of the best property (try finding local first, then global) and broadcast the change.

SetPropertyInternal ( string key, object newValue, bool doBroadcastChange ) : void

set the value and broadcast the change if so instructed

SetPropertyPersistenceInternal ( string name, bool doPersist ) : void
TestForBestSettings ( string name, SettingsGroup settingsGroup, SettingsGroup &firstSettings ) : SettingsGroup

If the specified settingsGroup is "BestSettings", find the best setting, otherwise return the specified settingsGroup.

TraceVerboseLine ( string s ) : void

Описание методов

CheckDisposed() публичный Метод

Check to see if the object has been disposed. All public Properties and Methods should call this before doing anything else.
public CheckDisposed ( ) : void
Результат void

Dispose() публичный Метод

Must not be virtual.
public Dispose ( ) : void
Результат void

GetBoolProperty() публичный Метод

Gets the boolean value of property in the best settings group (trying local first then global) and creates the (global) property with the default value if it doesn't exist yet.
public GetBoolProperty ( string name, bool defaultValue ) : bool
name string
defaultValue bool
Результат bool

GetBoolProperty() публичный Метод

Gets boolean value of property for the specified settingsGroup and creates the property with the default value if it doesn't exist yet.
public GetBoolProperty ( string name, bool defaultValue, SettingsGroup settingsGroup ) : bool
name string
defaultValue bool
settingsGroup SettingsGroup
Результат bool

GetIntProperty() публичный Метод

Gets the int value of property in the best settings group (trying local first then global) and creates the (global) property with the default value if it doesn't exist yet.
public GetIntProperty ( string name, int defaultValue ) : int
name string
defaultValue int
Результат int

GetIntProperty() публичный Метод

Gets string value of property for the specified settingsGroup and creates the property with the default value if it doesn't exist yet.
public GetIntProperty ( string name, int defaultValue, SettingsGroup settingsGroup ) : int
name string
defaultValue int
settingsGroup SettingsGroup
Результат int

GetPropertiesDumpString() публичный Метод

public GetPropertiesDumpString ( ) : string
Результат string

GetStringProperty() публичный Метод

Gets the string value of property in the best settings group (trying local first then global) and creates the (global) property with the default value if it doesn't exist yet.
public GetStringProperty ( string name, string defaultValue ) : string
name string
defaultValue string
Результат string

GetStringProperty() публичный Метод

Gets string value of property for the specified settingsGroup and creates the property with the default value if it doesn't exist yet.
public GetStringProperty ( string name, string defaultValue, SettingsGroup settingsGroup ) : string
name string
defaultValue string
settingsGroup SettingsGroup
Результат string

GetValue() публичный Метод

get the value of the best property (i.e. tries local first, then global).
public GetValue ( string name ) : object
name string
Результат object

GetValue() публичный Метод

Get the value of the property of the specified settingsGroup.
public GetValue ( string name, SettingsGroup settingsGroup ) : object
name string
settingsGroup SettingsGroup
Результат object

GetValue() публичный Метод

get the value of the best property (tries local then global), set the defaultValue if it doesn't exist. (creates global property)
public GetValue ( string name, object defaultValue ) : object
name string
defaultValue object
Результат object

GetValue() публичный Метод

Get the value of the property in the specified settingsGroup. Sets the defaultValue if the property doesn't exist.
public GetValue ( string name, object defaultValue, SettingsGroup settingsGroup ) : object
name string
defaultValue object
settingsGroup SettingsGroup
Результат object

PropertyExists() публичный Метод

Test whether a property exists, tries local first and then global.
public PropertyExists ( string name ) : bool
name string
Результат bool

PropertyExists() публичный Метод

Tests whether a property exists, and gives the 'best' group it was found in (ie. local first and then global).
public PropertyExists ( string name, SettingsGroup &bestGuessGroup ) : bool
name string
bestGuessGroup SettingsGroup Undecided, if none was found.
Результат bool

PropertyExists() публичный Метод

Test whether a property exists and gives its 'best' group and its value. (ie. local first and then global).
public PropertyExists ( string name, object &propertyValue, SettingsGroup &bestGuessGroup ) : bool
name string
propertyValue object null, if it didn't find the property.
bestGuessGroup SettingsGroup Undecided, if none was found.
Результат bool

PropertyTable() публичный Метод

Initializes a new instance of the PropertySet class.
public PropertyTable ( XCore.Mediator mediator ) : System
mediator XCore.Mediator
Результат System

RemoveProperty() публичный Метод

Remove a property from the table.
public RemoveProperty ( string name ) : void
name string
Результат void

RestoreFromFile() публичный Метод

load with properties stored in the settings file, if that file is found.
public RestoreFromFile ( string settingsId ) : void
settingsId string e.g. "itinerary"
Результат void

Save() публичный Метод

save the project and its contents to a file
public Save ( string settingsId, string omitSettingIds ) : void
settingsId string save settings starting with this, and use as part of file name
omitSettingIds string skip settings starting with any of these.
Результат void

SaveLocalSettingsForNewProjectName() публичный Метод

Save database specific settings for the renamed Fieldworks project. Rename settings starting with the old project name (oldSettingsId) to the new project name (newSettingsId). Also write it to a file using the new project name.
public SaveLocalSettingsForNewProjectName ( string oldSettingsId, string newSettingsId ) : void
oldSettingsId string This is the old project name.
newSettingsId string Save settings starting with this string, and use as part of file name
Результат void

SetDefault() публичный Метод

set the default; does nothing if this value is already in the PropertyTable (local or global).
public SetDefault ( string name, object defaultValue, bool doBroadcastChange ) : void
name string
defaultValue object
doBroadcastChange bool >if true, will fire in the OnPropertyChanged() methods of all colleagues
Результат void

SetDefault() публичный Метод

set the default; does nothing if this value is already in the specified settingsGroup.
public SetDefault ( string name, object defaultValue, bool doBroadcastChange, SettingsGroup settingsGroup ) : void
name string
defaultValue object
doBroadcastChange bool
settingsGroup SettingsGroup
Результат void

SetProperty() публичный Метод

set the value of the best property (try finding local first, then global) and broadcast the change.
public SetProperty ( string name, object newValue ) : void
name string
newValue object
Результат void

SetProperty() публичный Метод

set the property value for the specified settingsGroup (broadcast change by default)
public SetProperty ( string name, object newValue, SettingsGroup settingsGroup ) : void
name string
newValue object
settingsGroup SettingsGroup
Результат void

SetProperty() публичный Метод

set the value of the best property (try finding local first, then global) and broadcast the change if so instructed
public SetProperty ( string name, object newValue, bool doBroadcastChange ) : void
name string
newValue object
doBroadcastChange bool if true & the property is actually different, /// will fire the OnPropertyChanged() methods of all colleagues
Результат void

SetProperty() публичный Метод

set the property value for the specified settingsGroup, and allow user to not broadcast the change.
public SetProperty ( string name, object newValue, bool doBroadcastChange, SettingsGroup settingsGroup ) : void
name string
newValue object
doBroadcastChange bool
settingsGroup SettingsGroup
Результат void

SetPropertyDispose() публичный Метод

public SetPropertyDispose ( string name, bool doDispose ) : void
name string
doDispose bool
Результат void

SetPropertyDispose() публичный Метод

public SetPropertyDispose ( string name, bool doDispose, SettingsGroup settingsGroup ) : void
name string
doDispose bool
settingsGroup SettingsGroup
Результат void

SetPropertyPersistence() публичный Метод

public SetPropertyPersistence ( string name, bool doPersist ) : void
name string
doPersist bool
Результат void

SetPropertyPersistence() публичный Метод

public SetPropertyPersistence ( string name, bool doPersist, SettingsGroup settingsGroup ) : void
name string
doPersist bool
settingsGroup SettingsGroup
Результат void

SettingsPath() публичный Метод

Get a file path for the project settings file.
public SettingsPath ( string settingsId ) : string
settingsId string
Результат string