C# Class XCore.PropertyTable

Inheritance: IFWDisposable
Afficher le fichier Open project: sillsdev/FieldWorks Class Usage Examples

Private Properties

Свойство Type Description
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

Méthodes publiques

Méthode Description
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.

Private Methods

Méthode Description
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

Method Details

CheckDisposed() public méthode

Check to see if the object has been disposed. All public Properties and Methods should call this before doing anything else.
public CheckDisposed ( ) : void
Résultat void

Dispose() public méthode

Must not be virtual.
public Dispose ( ) : void
Résultat void

GetBoolProperty() public méthode

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
Résultat bool

GetBoolProperty() public méthode

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
Résultat bool

GetIntProperty() public méthode

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
Résultat int

GetIntProperty() public méthode

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
Résultat int

GetPropertiesDumpString() public méthode

public GetPropertiesDumpString ( ) : string
Résultat string

GetStringProperty() public méthode

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
Résultat string

GetStringProperty() public méthode

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
Résultat string

GetValue() public méthode

get the value of the best property (i.e. tries local first, then global).
public GetValue ( string name ) : object
name string
Résultat object

GetValue() public méthode

Get the value of the property of the specified settingsGroup.
public GetValue ( string name, SettingsGroup settingsGroup ) : object
name string
settingsGroup SettingsGroup
Résultat object

GetValue() public méthode

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
Résultat object

GetValue() public méthode

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
Résultat object

PropertyExists() public méthode

Test whether a property exists, tries local first and then global.
public PropertyExists ( string name ) : bool
name string
Résultat bool

PropertyExists() public méthode

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.
Résultat bool

PropertyExists() public méthode

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.
Résultat bool

PropertyTable() public méthode

Initializes a new instance of the PropertySet class.
public PropertyTable ( XCore.Mediator mediator ) : System
mediator XCore.Mediator
Résultat System

RemoveProperty() public méthode

Remove a property from the table.
public RemoveProperty ( string name ) : void
name string
Résultat void

RestoreFromFile() public méthode

load with properties stored in the settings file, if that file is found.
public RestoreFromFile ( string settingsId ) : void
settingsId string e.g. "itinerary"
Résultat void

Save() public méthode

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.
Résultat void

SaveLocalSettingsForNewProjectName() public méthode

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
Résultat void

SetDefault() public méthode

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
Résultat void

SetDefault() public méthode

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
Résultat void

SetProperty() public méthode

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
Résultat void

SetProperty() public méthode

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
Résultat void

SetProperty() public méthode

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
Résultat void

SetProperty() public méthode

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
Résultat void

SetPropertyDispose() public méthode

public SetPropertyDispose ( string name, bool doDispose ) : void
name string
doDispose bool
Résultat void

SetPropertyDispose() public méthode

public SetPropertyDispose ( string name, bool doDispose, SettingsGroup settingsGroup ) : void
name string
doDispose bool
settingsGroup SettingsGroup
Résultat void

SetPropertyPersistence() public méthode

public SetPropertyPersistence ( string name, bool doPersist ) : void
name string
doPersist bool
Résultat void

SetPropertyPersistence() public méthode

public SetPropertyPersistence ( string name, bool doPersist, SettingsGroup settingsGroup ) : void
name string
doPersist bool
settingsGroup SettingsGroup
Résultat void

SettingsPath() public méthode

Get a file path for the project settings file.
public SettingsPath ( string settingsId ) : string
settingsId string
Résultat string