Class Preference.EventContext

Definition

Namespace:
Tizen.Applications
Assembly:
Tizen.Applications.Preference.dll
API Level:
3

The class manages event handlers of the preference keys. The class enables having event handlers for individual preference keys.

C#
Copy
public class EventContext
Inheritance
System.Object
Preference.EventContext

Events

View Source

Changed

Occurs whenever there is a change in the value of a preference key.

Declaration
C#
Copy
public event EventHandler<PreferenceChangedEventArgs> Changed
Event Type
Type Description
System.EventHandler<PreferenceChangedEventArgs>
Examples
Copy
private static void Preference_PreferenceChanged(object sender, PreferenceChangedEventArgs e) { Console.WriteLine("key {0}", e.Key); } Preference.EventContext context = null; Preference.GetEventContext("active_user").TryGetTarget(out context); if(context != null) { context.Changed += Preference_PreferenceChanged; } Preference.Set("active_user", "Poe"); Preference.GetEventContext("active_user").TryGetTarget(out context); if (context != null) { context.Changed -= Preference_PreferenceChanged; }
Exceptions
Type Condition
System.ArgumentException

Thrown when the key does not exist or when there is an invalid parameter.

System.InvalidOperationException

Thrown when the bundle instance has been disposed.

API Level: 3