Difference between revisions of "UserPreference"

From Catglobe Wiki
Jump to: navigation, search
Line 23: Line 23:
  
 
<source lang="javascript">
 
<source lang="javascript">
 
+
//create a new userPreference
 +
string navName="Questionnaire_Search";
 +
number prefType=1;
 +
string value="Hello world";
 +
UserPreference pref = new UserPreference(navName, prefType,value);
 +
pref.Save();
 
</source>
 
</source>
  
 
<br/><source lang="javascript">
 
<br/><source lang="javascript">
 +
//Get existing userPreference
 +
string navName="Questionnaire_Search";
 +
number prefType=1;
 +
UserPreference pref = new UserPreference(navName, prefType);
 +
print(pref.Value);//return: Hello world
  
 
</source>
 
</source>
  
 
<br/><source lang="javascript">
 
<br/><source lang="javascript">
 
+
//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
 
</source>
 
</source>

Revision as of 05:13, 22 November 2016

UserPreference



A user preference

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
  • string ToString() - The string representation of the object.

Properties

  • string ObjectTypeName { get; } - The name of the type of object.
  • TypeInformation TypeInformation { get; } - Get information about this class.
  • string Value { get; set; } - Get/Set the current value



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