Class Preference.EventContext
Definition
- Namespace:
- Tizen.Applications
- Assembly:
- Tizen.Applications.Preference.dll
The class manages event handlers of the preference keys. The class enables having event handlers for individual preference keys.
public class Preference.EventContext
- Inheritance
-
objectPreference.EventContext
Events
View SourceChanged
Occurs whenever there is a change in the value of a preference key.
Declaration
public event EventHandler<PreferenceChangedEventArgs> Changed
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><PreferenceChangedEventArgs> |
Examples
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. |