Difference between revisions of "UserPreference class"
Nguyenduyan (talk | contribs) (Created page with "{{CGscriptClass_Template |Name=UserPreference |Description=A user preference |Constructors= {{CGscriptConstructors_Template|Parameters= {{CGscriptParameters_Template|Type=stri...") |
|||
Line 1: | Line 1: | ||
{{CGscriptClass_Template | {{CGscriptClass_Template | ||
− | |Name=UserPreference | + | |Name=<nowiki>UserPreference</nowiki> |
− | |Description=A user preference | + | |Description=<nowiki>A user preference</nowiki> |
− | |Constructors= | + | |InheritsFrom=object|Constructors= |
{{CGscriptConstructors_Template|Parameters= | {{CGscriptConstructors_Template|Parameters= | ||
− | {{CGscriptParameters_Template|Type=string|Name=navName|Description=Navigation access value was stored with|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=prefType|Description=Unique key for the setting}} | + | {{CGscriptParameters_Template|Type=string|Name=<nowiki>navName</nowiki>|Description=<nowiki>Navigation access value was stored with</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=<nowiki>prefType</nowiki>|Description=<nowiki>Unique key for the setting</nowiki>}} |
− | |Description=Get existing a new personalized stored value.}} | + | |Description=<nowiki>Get existing a new personalized stored value.</nowiki>}} |
{{CGscriptConstructors_Template|Parameters= | {{CGscriptConstructors_Template|Parameters= | ||
− | {{CGscriptParameters_Template|Type=string|Name=navName|Description=Navigation access to associate the value with|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=prefType|Description=Unique key for the setting|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=value|Description=Value to store}} | + | {{CGscriptParameters_Template|Type=string|Name=<nowiki>navName</nowiki>|Description=<nowiki>Navigation access to associate the value with</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=<nowiki>prefType</nowiki>|Description=<nowiki>Unique key for the setting</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>value</nowiki>|Description=<nowiki>Value to store</nowiki>}} |
− | |Description=Create a new or update existing personalized stored value.}} | + | |Description=<nowiki>Create a new or update existing personalized stored value.</nowiki>}} |
|Methods= | |Methods= | ||
− | {{CGscriptMethods_Template|ReturnType=Empty|Name=Save|Description=Save the current value}} | + | {{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>Save</nowiki>|Description=<nowiki>Save the current value</nowiki>}} |
− | {{CGscriptMethods_Template|ReturnType=string|Name=ToString|Description=The string representation of the object.}} | + | {{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>ToString</nowiki>|Inherited=object|Description=<nowiki>The string representation of the object.</nowiki>}} |
|Properties= | |Properties= | ||
− | {{CGscriptProperties_Template|ReturnType=string|Name=ObjectTypeName|HasGetter=1|Description=The name of the type of object.}} | + | {{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>ObjectTypeName</nowiki>|HasGetter=1|Description=<nowiki>The name of the type of object.</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=TypeInformation|Name=TypeInformation|HasGetter=1|Description=Get information about this class.}} | + | {{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>PrefType</nowiki>|HasGetter=1|Description=<nowiki>Get the preference type</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=string|Name=Value|HasGetter=1|HasSetter=1|Description=Get/Set the current value}} | + | {{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Inherited=object|Description=<nowiki>Get information about this class.</nowiki>}} |
+ | {{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>Value</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/Set the current value</nowiki>}} | ||
+ | |StaticMethods= | ||
+ | {{CGscriptMethods_Template|ReturnType=Array of UserPreference|Name=<nowiki>UserPreference_getAll</nowiki>|Parameters= | ||
+ | {{CGscriptParameters_Template|Type=string|Name=<nowiki>navName</nowiki>|Description=<nowiki>Navigation access value was stored with</nowiki>}} | ||
+ | |Description=<nowiki>Get all user preferences for a given navName</nowiki>}} | ||
}} | }} | ||
− | |||
− | |||
=== <span style="color:#DF8621">'''Examples'''</span> === | === <span style="color:#DF8621">'''Examples'''</span> === |
Latest revision as of 10:10, 26 March 2020
UserPreference
A user preference
Parent class
Inherits from object
Constructors
- (string navName "Navigation access value was stored with", int prefType "Unique key for the setting") - Get existing a new personalized stored value.
- (string navName "Navigation access to associate the value with", int prefType "Unique key for the setting", string value "Value to store") - Create a new or update existing personalized stored value.
Methods
- Empty Save() - Save the current value
- (From object) string ToString() - The string representation of the object.
Properties
- string ObjectTypeName { get; } - The name of the type of object.
- int PrefType { get; } - Get the preference type
- (From object) TypeInformation TypeInformation { get; } - Get information about this class.
- string Value { get; set; } - Get/Set the current value
Static Methods
- Array of UserPreference UserPreference_getAll(string navName "Navigation access value was stored with") - Get all user preferences for a given navName
Examples
//create a new userPreference
string navName="Questionnaire_Search";
number prefType=1;
string value="Hello world";
UserPreference pref = new UserPreference(navName, prefType,value);
pref.Save();
//Get existing userPreference
string navName="Questionnaire_Search";
number prefType=1;
UserPreference pref = new UserPreference(navName, prefType);
print(pref.Value);//return: Hello world
//Update an existing userPreference
string navName="Questionnaire_Search";
number prefType=1;
string value="abc xyz";
UserPreference pref = new UserPreference(navName, prefType, value);
pref.Save();
print(pref.Value);//return: abc xyz