Release 4.0.0-preview1-00184
[platform/core/csapi/tizenfx.git] / Artifacts / bin / public / Tizen.Applications.Preference.xml
1 <?xml version="1.0"?>
2 <doc>
3     <assembly>
4         <name>Tizen.Applications.Preference</name>
5     </assembly>
6     <members>
7         <member name="T:Interop">
8             <summary>
9             Contains interop declarations of the preference classes.
10             </summary>
11         </member>
12         <member name="T:Interop.Preference">
13             <summary>
14             Contains interop declarations of the preference device API.
15             </summary>
16         </member>
17         <member name="T:Tizen.Applications.Preference">
18             <summary>
19             The preference class provides APIs to store and retrieve an application specific data/preference. A preference is saved in the form of a key-value pair.
20             Keys are always text strings and the value can be any one of the four types: integer, double, string, and boolean.
21             </summary>
22         </member>
23         <member name="P:Tizen.Applications.Preference.Keys">
24             <summary>
25             Retrieves all keys of the application preferences.
26             </summary>
27             <value>
28             The list of keys.
29             </value>
30             <example>
31             <code>
32                 Preference.Set("Option_enabled", true);
33                 Preference.Set("active_user", "Joe");
34                 Preference.Set("default_volume", 10);
35                 Preference.Set("brightness", "0.6");
36                 foreach(string key in Preference.Keys)
37                 {
38                     Console.WriteLine("key {0}", key);
39                 }
40             </code>
41             </example>
42         </member>
43         <member name="M:Tizen.Applications.Preference.GetEventContext(System.String)">
44              <summary>
45              Gets the event context for the given key.
46              </summary>
47              <seealso cref="T:Tizen.Applications.Preference.EventContext"/>
48              <param name="key">The preference key.</param>
49              <returns>The event context of respective key.</returns>
50              <exception cref="T:System.Collections.Generic.KeyNotFoundException">Thrown if the key is not found.</exception>
51              <exception cref="T:System.ArgumentException">Thrown if the key is invalid parameter.</exception>
52              <example>
53              <code>
54                  private static void Preference_PreferenceChanged(object sender, PreferenceChangedEventArgs e)
55                  {
56                      Console.WriteLine("key {0}", e.Key);
57                  }
58             
59                  Preference.EventContext context = null;
60                  Preference.GetEventContext("active_user").TryGetTarget(out context);
61                  if(context != null)
62                  {
63                      context.Changed += Preference_PreferenceChanged;
64                  }
65             
66                  Preference.Set("active_user", "Poe");
67             
68                  Preference.GetEventContext("active_user").TryGetTarget(out context);
69                  if (context != null)
70                  {
71                      context.Changed -= Preference_PreferenceChanged;
72                  }
73              </code>
74              </example>
75         </member>
76         <!-- Badly formed XML comment ignored for member "M:Tizen.Applications.Preference.Contains(System.String)" -->
77         <!-- Badly formed XML comment ignored for member "M:Tizen.Applications.Preference.Set(System.String,System.Object)" -->
78         <!-- Badly formed XML comment ignored for member "M:Tizen.Applications.Preference.Get``1(System.String)" -->
79         <member name="M:Tizen.Applications.Preference.Remove(System.String)">
80             <summary>
81             Removes any preference value with the given key.
82             </summary>
83             <param name="key">The key to remove.</param>
84             <exception cref="T:System.Collections.Generic.KeyNotFoundException">Thrown if the key is not found.</exception>
85             <exception cref="T:System.IO.IOException">Thrown when the method failed due to an internal I/O error.</exception>
86             <example>
87             <code>
88                 bool exists = Preference.Contains("active_user");
89                 if (exists)
90                 {
91                     string value = Preference.Remove("active_user");
92                 }
93             </code>
94             </example>
95         </member>
96         <member name="M:Tizen.Applications.Preference.RemoveAll">
97             <summary>
98             Removes all the key-value pairs from the preference.
99             </summary>
100             <exception cref="T:System.IO.IOException">Thrown when the method failed due to an internal I/O error.</exception>
101             <example>
102             <code>
103                 Preference.Set("Option_enabled", true);
104                 Preference.Set("active_user", "Joe");
105                 Preference.Set("default_volume", 10);
106                 Preference.Set("brightness", "0.6");
107                 Preference.RemoveAll();
108             </code>
109             </example>
110         </member>
111         <member name="T:Tizen.Applications.Preference.EventContext">
112             <summary>
113             The class manages event handlers of the preference keys. The class enables having event handlers for individual preference keys.
114             </summary>
115         </member>
116         <member name="E:Tizen.Applications.Preference.EventContext.Changed">
117              <summary>
118              Occurs whenever there is a change in the value of a preference key.
119              </summary>
120              <exception cref="T:System.ArgumentException">Thrown when the key does not exist or when there is an invalid parameter.</exception>
121              <exception cref="T:System.InvalidOperationException">Thrown when the bundle instance has been disposed.</exception>
122              <example>
123              <code>
124                  private static void Preference_PreferenceChanged(object sender, PreferenceChangedEventArgs e)
125                  {
126                      Console.WriteLine("key {0}", e.Key);
127                  }
128                  Preference.EventContext context = null;
129                  Preference.GetEventContext("active_user").TryGetTarget(out context);
130                  if(context != null)
131                  {
132                      context.Changed += Preference_PreferenceChanged;
133                  }
134             
135                  Preference.Set("active_user", "Poe");
136             
137                  Preference.GetEventContext("active_user").TryGetTarget(out context);
138                  if (context != null)
139                  {
140                      context.Changed -= Preference_PreferenceChanged;
141                  }
142              </code>
143              </example>
144         </member>
145         <member name="T:Tizen.Applications.PreferenceChangedEventArgs">
146             <summary>
147             This class is an event argument of the PreferenceChanged event.
148             </summary>
149         </member>
150         <member name="P:Tizen.Applications.PreferenceChangedEventArgs.Key">
151             <summary>
152             The key of the preference whose value is changed.
153             </summary>
154         </member>
155     </members>
156 </doc>