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#Copypublic class EventContext
- Inheritance
-
System.ObjectPreference.EventContext
Events
Declaration
C#Copypublic event EventHandler<PreferenceChangedEventArgs> Changed
Event Type
Type | Description |
---|---|
System.EventHandler<PreferenceChangedEventArgs> |
Examples
Copyprivate 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. |