DedicatedThreadAccessible
Spotfire.Dxp.Framework.Preferences PreferenceBase
Spotfire.Dxp.Application.Extension CustomPreference
Namespace: Spotfire.Dxp.Application.Extension
Assembly: Spotfire.Dxp.Application (in Spotfire.Dxp.Application.dll) Version: 14.10.7525.5058 (14.10.7525.5058)
When a user is logged on, the preference is populated with its persisted values, if such exist. If not, the preference is given default values while waiting for the user to set its values. When preferences are saved, their values are persisted using .Net serialization on the client and on the server depending on the settings of the preference.
Preferences properties can be applied to single users or to user groups. Preferences applied to a group are inherited by all members of the group. The users can, however, choose to override the properties with custom values. In the same way, a group can override the properties inherited from its parent groups. If the group has more than one parent group, the value from the Primary parent group (as defined using the TIBCO Spotfire Administration Manager).
It is important for your preference implementation class to be decorated with the PersistenceVersionAttribute. If it is not, it will not be possible to register the preference class with the preference framework.
[Spotfire.Dxp.Framework.Persistence.PersistenceVersion(1, 0)] public class MyPreference : CustomPreference { private PreferenceProperty<string> myString; // Defaults to null private PreferenceProperty<ArrayList> numberList; public override string Category { get { return "MyCategory"; } } public override string SubCategory { get { return "MySubCategory"; } } public void AddToList(int value) { this.numberList.Value.Add(value); // Notify the framework of changes this.numberList.OnValueChanged(); } public string MyString { get { return this.myString.Value; } set { // The framwork is aware of the change to the property since // it is explicitly set. this.myString.Value = value; } } public MyPreference() { this.myString = this.AddPreference<string>( new PreferenceProperty<string>( "myString", "1.0", PreferencePersistenceScope.Server, PreferenceUsage.SingleUser)); this.numberList = this.AddPreference<ArrayList>( new PreferenceProperty<ArrayList>( "numberList", "1.0", PreferencePersistenceScope.Server, PreferenceUsage.SingleUser, delegate { // Calculate the default value ArrayList defaultList = new ArrayList(); defaultList.Add(10); return defaultList; })); } }