3 namespace Tizen.System.SystemSettings
6 /// The System Settings API provides APIs for sharing configuration over a system
9 /// System Settings API provides functions for getting the system configuration related to user preferences.
10 /// The main features of the System Settings API include accessing system-wide configurations, such as ringtones, wallpapers, and etc
12 public static class SystemSettings
15 /// The file path of the current ringtone
17 public static string IncomingCallRingtone
22 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.IncomingCallRingtone, out filePath);
23 if (res != SystemSettingsError.None)
25 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get IncomingCallRingtone system setting value.");
31 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.IncomingCallRingtone, value);
32 if (res != SystemSettingsError.None)
34 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set IncomingCallRingtone system setting.");
40 /// The file path of the current home screen wallpaper
42 public static string WallpaperHomeScreen
47 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.WallpaperHomeScreen, out filePath);
48 if (res != SystemSettingsError.None)
50 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get WallpaperHomeScreen system setting value.");
56 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.WallpaperHomeScreen, value);
57 if (res != SystemSettingsError.None)
59 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set WallpaperHomeScreen system setting.");
65 /// The file path of the current lock screen wallpaper
67 public static string WallpaperLockScreen
72 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.WallpaperLockScreen, out filePath);
73 if (res != SystemSettingsError.None)
75 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get WallpaperLockScreen system setting value.");
81 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.WallpaperLockScreen, value);
82 if (res != SystemSettingsError.None)
84 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set WallpaperLockScreen system setting.");
90 /// The current system font size
92 public static SystemSettingsFontSize FontSize
97 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueInt(SystemSettingsKeys.FontSize, out fontSize);
98 if (res != SystemSettingsError.None)
100 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get FontSize system setting value.");
102 return (SystemSettingsFontSize)fontSize;
106 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueInt(SystemSettingsKeys.FontSize, (int)value);
107 if (res != SystemSettingsError.None)
109 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set FontSize system setting.");
115 /// The current system font type
117 public static string FontType
122 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.FontType, out fontType);
123 if (res != SystemSettingsError.None)
125 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get FontType system setting value.");
131 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.FontType, value);
132 if (res != SystemSettingsError.None)
134 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set FontType system setting.");
140 /// Indicates whether the motion service is activated
142 public static bool MotionActivation
146 bool isMotionServiceActivated;
147 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.MotionActivation, out isMotionServiceActivated);
148 if (res != SystemSettingsError.None)
150 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get MotionActivation system setting value.");
152 return isMotionServiceActivated;
156 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueBool(SystemSettingsKeys.MotionActivation, value);
157 if (res != SystemSettingsError.None)
159 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set MotionActivation system setting.");
165 /// The file path of the current email alert ringtone
167 public static string EmailAlertRingtone
172 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.EmailAlertRingtone, out filePath);
173 if (res != SystemSettingsError.None)
175 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get EmailAlertRingtone system setting value.");
181 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.EmailAlertRingtone, value);
182 if (res != SystemSettingsError.None)
184 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set EmailAlertRingtone system setting.");
189 /// Indicates whether the USB debugging is enabled (Since 2.4)
191 public static bool UsbDebuggingEnabled
195 bool isusbDebuggingEnabled;
196 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.UsbDebuggingEnabled, out isusbDebuggingEnabled);
197 if (res != SystemSettingsError.None)
199 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get UsbDebuggingEnabled system setting value.");
201 return isusbDebuggingEnabled;
205 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueBool(SystemSettingsKeys.UsbDebuggingEnabled, value);
206 if (res != SystemSettingsError.None)
208 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set UsbDebuggingEnabled system setting.");
214 /// Indicates whether the 3G data network is enabled (Since 2.4)
216 public static bool Data3GNetworkEnabled
220 bool is3GDataEnabled;
221 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.Data3GNetworkEnabled, out is3GDataEnabled);
222 if (res != SystemSettingsError.None)
224 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get Data3GNetworkEnabled system setting value.");
226 return is3GDataEnabled;
230 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueBool(SystemSettingsKeys.Data3GNetworkEnabled, value);
231 if (res != SystemSettingsError.None)
233 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set Data3GNetworkEnabled system setting.");
239 /// Indicates lockscreen app pkg name
241 public static string LockscreenApp
246 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.LockscreenApp, out pkgName);
247 if (res != SystemSettingsError.None)
249 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get LockscreenApp system setting value.");
255 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.LockscreenApp, value);
256 if (res != SystemSettingsError.None)
258 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set LockscreenApp system setting.");
264 /// The current system default font type (only support Get)
266 public static string DefaultFontType
270 string defaultFontType;
271 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.DefaultFontType, out defaultFontType);
272 if (res != SystemSettingsError.None)
274 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get DefaultFontType system setting value.");
276 return defaultFontType;
281 /// Indicates the current country setting in the <LANGUAGE>_<REGION> syntax.
282 /// The country setting is in the ISO 639-2 format,
283 /// and the region setting is in the ISO 3166-1 alpha-2 format
285 public static string LocaleCountry
289 string countrySetting;
290 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.LocaleCountry, out countrySetting);
291 if (res != SystemSettingsError.None)
293 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get LocaleCountry system setting value.");
295 return countrySetting;
299 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.LocaleCountry, value);
300 if (res != SystemSettingsError.None)
302 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set LocaleCountry system setting.");
308 /// Indicates the current language setting in the <LANGUAGE>_<REGION> syntax.
309 /// The language setting is in the ISO 639-2 format
310 /// and the region setting is in the ISO 3166-1 alpha-2 format.
312 public static string LocaleLanguage
316 string languageSetting;
317 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.LocaleLanguage, out languageSetting);
318 if (res != SystemSettingsError.None)
320 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get LocaleLanguage system setting value.");
322 return languageSetting;
326 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.LocaleLanguage, value);
327 if (res != SystemSettingsError.None)
329 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set LocaleLanguage system setting.");
335 /// Indicates whether the 24-hour clock is used.
336 /// If the value is false, the 12-hour clock is used.
338 public static bool LocaleTimeformat24Hour
343 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.LocaleTimeformat24Hour, out is24HrFormat);
344 if (res != SystemSettingsError.None)
346 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get LocaleTimeformat24Hour system setting value.");
352 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueBool(SystemSettingsKeys.LocaleTimeformat24Hour, value);
353 if (res != SystemSettingsError.None)
355 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set LocaleTimeformat24Hour system setting.");
361 /// Indicates the current time zone.
363 public static string LocaleTimezone
368 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.LocaleTimezone, out timeZone);
369 if (res != SystemSettingsError.None)
371 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get LocaleTimezone system setting value.");
377 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.LocaleTimezone, value);
378 if (res != SystemSettingsError.None)
380 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set LocaleTimezone system setting.");
385 /// Indicates whether the screen lock sound is enabled on the device. ex) LCD on/off sound
387 public static bool SoundLock
391 bool isSoundLockEnabled;
392 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.SoundLock, out isSoundLockEnabled);
393 if (res != SystemSettingsError.None)
395 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get SoundLock system setting value.");
397 return isSoundLockEnabled;
402 /// Indicates whether the device is in the silent mode.
404 public static bool SoundSilentMode
409 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.SoundSilentMode, out isSilent);
410 if (res != SystemSettingsError.None)
412 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get SoundSilentMode system setting value.");
419 /// Indicates whether the screen touch sound is enabled on the device.
421 public static bool SoundTouch
425 bool isTouchSoundEnabled;
426 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.SoundTouch, out isTouchSoundEnabled);
427 if (res != SystemSettingsError.None)
429 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get SoundTouch system setting value.");
431 return isTouchSoundEnabled;
436 /// Indicates whether rotation control is automatic.
438 public static bool DisplayScreenRotationAuto
442 bool isRotationAutomatic;
443 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.DisplayScreenRotationAuto, out isRotationAutomatic);
444 if (res != SystemSettingsError.None)
446 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get DisplayScreenRotationAuto system setting value.");
448 return isRotationAutomatic;
453 /// Indicates device name.
455 public static string DeviceName
460 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.DeviceName, out deviceName);
461 if (res != SystemSettingsError.None)
463 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get DeviceName system setting value.");
469 /// Indicates whether the device user has enabled motion feature.
471 public static bool MotionEnabled
475 bool isMotionEnabled;
476 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.MotionEnabled, out isMotionEnabled);
477 if (res != SystemSettingsError.None)
479 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get MotionEnabled system setting value.");
481 return isMotionEnabled;
486 /// Indicates whether Wi-Fi-related notifications are enabled on the device.
488 public static bool NetworkWifiNotification
492 bool isWifiNotificationEnabled;
493 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.NetworkWifiNotification, out isWifiNotificationEnabled);
494 if (res != SystemSettingsError.None)
496 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get NetworkWifiNotification system setting value.");
498 return isWifiNotificationEnabled;
503 /// Indicates whether the device is in the flight mode.
505 public static bool NetworkFlightMode
509 bool isFlightModeEnabled;
510 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.NetworkFlightMode, out isFlightModeEnabled);
511 if (res != SystemSettingsError.None)
513 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get NetworkFlightMode system setting value.");
515 return isFlightModeEnabled;
520 /// Indicates the backlight time (in seconds). The following values can be used: 15, 30, 60, 120, 300, and 600.
522 public static int ScreenBacklightTime
527 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueInt(SystemSettingsKeys.ScreenBacklightTime, out backlightTime);
528 if (res != SystemSettingsError.None)
530 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get ScreenBacklightTime system setting value.");
532 return backlightTime;
536 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueInt(SystemSettingsKeys.ScreenBacklightTime, value);
537 if (res != SystemSettingsError.None)
539 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set ScreenBacklightTime system setting.");
545 /// Indicates the file path of the current notification tone set by the user.
547 public static string SoundNotification
552 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.SoundNotification, out filePath);
553 if (res != SystemSettingsError.None)
555 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get SoundNotification system setting value.");
561 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.SoundNotification, value);
562 if (res != SystemSettingsError.None)
564 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set SoundNotification system setting.");
570 /// Indicates the time period for notification repetitions.
572 public static int SoundNotificationRepetitionPeriod
576 int notificationRepetitionPeriod;
577 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueInt(SystemSettingsKeys.SoundNotificationRepetitionPeriod, out notificationRepetitionPeriod);
578 if (res != SystemSettingsError.None)
580 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get SoundNotificationRepetitionPeriod system setting value.");
582 return notificationRepetitionPeriod;
586 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueInt(SystemSettingsKeys.SoundNotificationRepetitionPeriod, value);
587 if (res != SystemSettingsError.None)
589 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set SoundNotificationRepetitionPeriod system setting.");
595 /// Indicates the current lock state
597 public static SystemSettingsIdleLockState LockState
602 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueInt(SystemSettingsKeys.LockState, out LockState);
603 if (res != SystemSettingsError.None)
605 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get LockState system setting value.");
607 return (SystemSettingsIdleLockState)LockState;
611 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueInt(SystemSettingsKeys.LockState, (int)value);
612 if (res != SystemSettingsError.None)
614 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set LockState system setting.");
619 private static readonly Interop.Settings.SystemSettingsChangedCallback s_incomingCallRingtoneChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
621 string path = SystemSettings.IncomingCallRingtone;
622 IncomingCallRingtoneChangedEventArgs eventArgs = new IncomingCallRingtoneChangedEventArgs(path);
623 s_incomingCallRingtoneChanged?.Invoke(null, eventArgs);
625 private static event EventHandler<IncomingCallRingtoneChangedEventArgs> s_incomingCallRingtoneChanged;
627 /// IncomingCallRingtoneChanged event is triggered when the file path of the incoming ringtone is changed
629 /// <param name="sender"></param>
630 /// <param name="e">A IncomingCallRingtoneChangedEventArgs object that contains the key & changed value</param>
631 public static event EventHandler<IncomingCallRingtoneChangedEventArgs> IncomingCallRingtoneChanged
635 if (s_incomingCallRingtoneChanged == null)
637 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.IncomingCallRingtone, s_incomingCallRingtoneChangedCallback, IntPtr.Zero);
638 if (ret != SystemSettingsError.None)
640 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
643 s_incomingCallRingtoneChanged += value;
648 s_incomingCallRingtoneChanged -= value;
649 if (s_incomingCallRingtoneChanged == null)
651 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.IncomingCallRingtone);
652 if (ret != SystemSettingsError.None)
654 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
660 private static readonly Interop.Settings.SystemSettingsChangedCallback s_wallpaperHomeScreenChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
662 string path = SystemSettings.WallpaperHomeScreen;
663 WallpaperHomeScreenChangedEventArgs eventArgs = new WallpaperHomeScreenChangedEventArgs(path);
664 s_wallpaperHomeScreenChanged?.Invoke(null, eventArgs);
666 private static event EventHandler<WallpaperHomeScreenChangedEventArgs> s_wallpaperHomeScreenChanged;
668 /// WallpaperHomeScreenChanged event is triggered when the file path of the current home screen wallpaper is changed
670 /// <param name="sender"></param>
671 /// <param name="e">A WallpaperHomeScreenChangedEventArgs object that contains the key & changed value</param>
672 public static event EventHandler<WallpaperHomeScreenChangedEventArgs> WallpaperHomeScreenChanged
676 if (s_wallpaperHomeScreenChanged == null)
678 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.WallpaperHomeScreen, s_wallpaperHomeScreenChangedCallback, IntPtr.Zero);
679 if (ret != SystemSettingsError.None)
681 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
684 s_wallpaperHomeScreenChanged += value;
689 s_wallpaperHomeScreenChanged -= value;
690 if (s_wallpaperHomeScreenChanged == null)
692 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.WallpaperHomeScreen);
693 if (ret != SystemSettingsError.None)
695 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
701 private static readonly Interop.Settings.SystemSettingsChangedCallback s_wallpaperLockScreenChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
703 string path = SystemSettings.WallpaperLockScreen;
704 WallpaperLockScreenChangedEventArgs eventArgs = new WallpaperLockScreenChangedEventArgs(path);
705 s_wallpaperLockScreenChanged?.Invoke(null, eventArgs);
707 private static event EventHandler<WallpaperLockScreenChangedEventArgs> s_wallpaperLockScreenChanged;
709 /// WallpaperLockScreenChanged event is triggered when the file path of the current lock screen wallpaper is changed
711 /// <param name="sender"></param>
712 /// <param name="e">A WallpaperLockScreenChangedEventArgs object that contains the key & changed value</param>
713 public static event EventHandler<WallpaperLockScreenChangedEventArgs> WallpaperLockScreenChanged
717 if (s_wallpaperLockScreenChanged == null)
719 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.WallpaperLockScreen, s_wallpaperLockScreenChangedCallback, IntPtr.Zero);
720 if (ret != SystemSettingsError.None)
722 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
725 s_wallpaperLockScreenChanged += value;
730 s_wallpaperLockScreenChanged -= value;
731 if (s_wallpaperLockScreenChanged == null)
733 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.WallpaperLockScreen);
734 if (ret != SystemSettingsError.None)
736 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
742 private static readonly Interop.Settings.SystemSettingsChangedCallback s_fontSizeChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
744 SystemSettingsFontSize fontSize = SystemSettings.FontSize;
745 FontSizeChangedEventArgs eventArgs = new FontSizeChangedEventArgs(fontSize);
746 s_fontSizeChanged?.Invoke(null, eventArgs);
748 private static event EventHandler<FontSizeChangedEventArgs> s_fontSizeChanged;
750 /// FontSizeChanged event is triggered when the current system font size is changed
752 /// <param name="sender"></param>
753 /// <param name="e">A FontSizeChangedEventArgs object that contains the key & changed value</param>
754 public static event EventHandler<FontSizeChangedEventArgs> FontSizeChanged
758 if (s_fontSizeChanged == null)
760 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.FontSize, s_fontSizeChangedCallback, IntPtr.Zero);
761 if (ret != SystemSettingsError.None)
763 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
766 s_fontSizeChanged += value;
771 s_fontSizeChanged -= value;
772 if (s_fontSizeChanged == null)
774 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.FontSize);
775 if (ret != SystemSettingsError.None)
777 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
783 private static readonly Interop.Settings.SystemSettingsChangedCallback s_fontTypeChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
785 string fontType = SystemSettings.FontType;
786 FontTypeChangedEventArgs eventArgs = new FontTypeChangedEventArgs(fontType);
787 s_fontTypeChanged?.Invoke(null, eventArgs);
789 private static event EventHandler<FontTypeChangedEventArgs> s_fontTypeChanged;
791 /// FontTypeChanged event is triggered when the current system font type is changed
793 /// <param name="sender"></param>
794 /// <param name="e">A FontTypeChangedEventArgs object that contains the key & changed value</param>
795 public static event EventHandler<FontTypeChangedEventArgs> FontTypeChanged
799 if (s_fontTypeChanged == null)
801 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.FontType, s_fontTypeChangedCallback, IntPtr.Zero);
802 if (ret != SystemSettingsError.None)
804 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
807 s_fontTypeChanged += value;
812 s_fontTypeChanged -= value;
813 if (s_fontTypeChanged == null)
815 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.FontType);
816 if (ret != SystemSettingsError.None)
818 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
824 private static readonly Interop.Settings.SystemSettingsChangedCallback s_motionActivationChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
826 bool motionActivation = SystemSettings.MotionActivation;
827 MotionActivationChangedEventArgs eventArgs = new MotionActivationChangedEventArgs(motionActivation);
828 s_motionActivationChanged?.Invoke(null, eventArgs);
830 private static event EventHandler<MotionActivationChangedEventArgs> s_motionActivationChanged;
832 /// MotionActivationChanged event is triggered when the motion service status is changed
834 /// <param name="sender"></param>
835 /// <param name="e">A MotionActivationChangedEventArgs object that contains the key & changed value</param>
836 public static event EventHandler<MotionActivationChangedEventArgs> MotionActivationChanged
840 if (s_motionActivationChanged == null)
842 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.MotionActivation, s_motionActivationChangedCallback, IntPtr.Zero);
843 if (ret != SystemSettingsError.None)
845 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
848 s_motionActivationChanged += value;
853 s_motionActivationChanged -= value;
854 if (s_motionActivationChanged == null)
856 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.MotionActivation);
857 if (ret != SystemSettingsError.None)
859 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
865 private static readonly Interop.Settings.SystemSettingsChangedCallback s_emailAlertRingtoneChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
867 string emailAlertRingtone = SystemSettings.EmailAlertRingtone;
868 EmailAlertRingtoneChangedEventArgs eventArgs = new EmailAlertRingtoneChangedEventArgs(emailAlertRingtone);
869 s_emailAlertRingtoneChanged?.Invoke(null, eventArgs);
871 private static event EventHandler<EmailAlertRingtoneChangedEventArgs> s_emailAlertRingtoneChanged;
873 /// EmailAlertRingtoneChanged event is triggered when the file path of the current email alert ringtone is changed
875 /// <param name="sender"></param>
876 /// <param name="e">A EmailAlertRingtoneChangedEventArgs object that contains the key & changed value</param>
877 public static event EventHandler<EmailAlertRingtoneChangedEventArgs> EmailAlertRingtoneChanged
881 if (s_emailAlertRingtoneChanged == null)
883 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.EmailAlertRingtone, s_emailAlertRingtoneChangedCallback, IntPtr.Zero);
884 if (ret != SystemSettingsError.None)
886 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
889 s_emailAlertRingtoneChanged += value;
894 s_emailAlertRingtoneChanged -= value;
895 if (s_emailAlertRingtoneChanged == null)
897 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.EmailAlertRingtone);
898 if (ret != SystemSettingsError.None)
900 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
906 private static readonly Interop.Settings.SystemSettingsChangedCallback s_usbDebuggingSettingChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
908 bool usbDebuggingEnabled = SystemSettings.UsbDebuggingEnabled;
909 UsbDebuggingSettingChangedEventArgs eventArgs = new UsbDebuggingSettingChangedEventArgs(usbDebuggingEnabled);
910 s_usbDebuggingSettingChanged?.Invoke(null, eventArgs);
912 private static event EventHandler<UsbDebuggingSettingChangedEventArgs> s_usbDebuggingSettingChanged;
914 /// UsbDebuggingSettingChangedEventArgs event is triggered when the USB debugging status is changed
916 /// <param name="sender"></param>
917 /// <param name="e">A UsbDebuggingSettingChangedEventArgs object that contains the key & changed value</param>
918 public static event EventHandler<UsbDebuggingSettingChangedEventArgs> UsbDebuggingSettingChanged
922 if (s_usbDebuggingSettingChanged == null)
924 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.UsbDebuggingEnabled, s_usbDebuggingSettingChangedCallback, IntPtr.Zero);
925 if (ret != SystemSettingsError.None)
927 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
930 s_usbDebuggingSettingChanged += value;
935 s_usbDebuggingSettingChanged -= value;
936 if (s_usbDebuggingSettingChanged == null)
938 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.UsbDebuggingEnabled);
939 if (ret != SystemSettingsError.None)
941 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
947 private static readonly Interop.Settings.SystemSettingsChangedCallback s_data3GNetworkSettingChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
949 bool data3GEnabled = SystemSettings.Data3GNetworkEnabled;
950 Data3GNetworkSettingChangedEventArgs eventArgs = new Data3GNetworkSettingChangedEventArgs(data3GEnabled);
951 s_data3GNetworkSettingChanged?.Invoke(null, eventArgs);
953 private static event EventHandler<Data3GNetworkSettingChangedEventArgs> s_data3GNetworkSettingChanged;
955 /// Data3GNetworkSettingChanged event is triggered when the 3G data network status is changed
957 /// <param name="sender"></param>
958 /// <param name="e">A Data3GNetworkSettingChangedEventArgs object that contains the key & changed value</param>
959 public static event EventHandler<Data3GNetworkSettingChangedEventArgs> Data3GNetworkSettingChanged
963 if (s_data3GNetworkSettingChanged == null)
965 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.Data3GNetworkEnabled, s_data3GNetworkSettingChangedCallback, IntPtr.Zero);
966 if (ret != SystemSettingsError.None)
968 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
971 s_data3GNetworkSettingChanged += value;
976 s_data3GNetworkSettingChanged -= value;
977 if (s_data3GNetworkSettingChanged == null)
979 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.Data3GNetworkEnabled);
980 if (ret != SystemSettingsError.None)
982 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
988 private static readonly Interop.Settings.SystemSettingsChangedCallback s_lockscreenAppChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
990 string lockScreenApp = SystemSettings.LockscreenApp;
991 LockscreenAppChangedEventArgs eventArgs = new LockscreenAppChangedEventArgs(lockScreenApp);
992 s_lockscreenAppChanged?.Invoke(null, eventArgs);
994 private static event EventHandler<LockscreenAppChangedEventArgs> s_lockscreenAppChanged;
996 /// LockscreenAppChanged event is triggered when the lockscreen app pkg name is changed
998 /// <param name="sender"></param>
999 /// <param name="e">A LockscreenAppChangedEventArgs object that contains the key & changed value</param>
1000 public static event EventHandler<LockscreenAppChangedEventArgs> LockscreenAppChanged
1004 if (s_lockscreenAppChanged == null)
1006 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LockscreenApp, s_lockscreenAppChangedCallback, IntPtr.Zero);
1007 if (ret != SystemSettingsError.None)
1009 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1012 s_lockscreenAppChanged += value;
1017 s_lockscreenAppChanged -= value;
1018 if (s_lockscreenAppChanged == null)
1020 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LockscreenApp);
1021 if (ret != SystemSettingsError.None)
1023 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1029 private static readonly Interop.Settings.SystemSettingsChangedCallback s_defaultFontTypeChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1031 string defaultFontType = SystemSettings.DefaultFontType;
1032 DefaultFontTypeChangedEventArgs eventArgs = new DefaultFontTypeChangedEventArgs(defaultFontType);
1033 s_defaultFontTypeChanged?.Invoke(null, eventArgs);
1035 private static event EventHandler<DefaultFontTypeChangedEventArgs> s_defaultFontTypeChanged;
1037 /// DefaultFontTypeChanged event is triggered when the current system default font type is changed
1039 /// <param name="sender"></param>
1040 /// <param name="e">A DefaultFontTypeChangedEventArgs object that contains the key & changed value</param>
1041 public static event EventHandler<DefaultFontTypeChangedEventArgs> DefaultFontTypeChanged
1045 if (s_defaultFontTypeChanged == null)
1047 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.DefaultFontType, s_defaultFontTypeChangedCallback, IntPtr.Zero);
1048 if (ret != SystemSettingsError.None)
1050 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1053 s_defaultFontTypeChanged += value;
1058 s_defaultFontTypeChanged -= value;
1059 if (s_defaultFontTypeChanged == null)
1061 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.DefaultFontType);
1062 if (ret != SystemSettingsError.None)
1064 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1070 private static readonly Interop.Settings.SystemSettingsChangedCallback s_localeCountryChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1072 string localeCountry = SystemSettings.LocaleCountry;
1073 LocaleCountryChangedEventArgs eventArgs = new LocaleCountryChangedEventArgs(localeCountry);
1074 s_localeCountryChanged?.Invoke(null, eventArgs);
1076 private static event EventHandler<LocaleCountryChangedEventArgs> s_localeCountryChanged;
1078 /// LocaleCountryChanged event is triggered when the current country setting in the <LANGUAGE>_<REGION> syntax, is changed
1080 /// <param name="sender"></param>
1081 /// <param name="e">A LocaleCountryChangedEventArgs object that contains the key & changed value</param>
1082 public static event EventHandler<LocaleCountryChangedEventArgs> LocaleCountryChanged
1086 if (s_localeCountryChanged == null)
1088 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LocaleCountry, s_localeCountryChangedCallback, IntPtr.Zero);
1089 if (ret != SystemSettingsError.None)
1091 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1094 s_localeCountryChanged += value;
1099 s_localeCountryChanged -= value;
1100 if (s_localeCountryChanged == null)
1102 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LocaleCountry);
1103 if (ret != SystemSettingsError.None)
1105 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1111 private static readonly Interop.Settings.SystemSettingsChangedCallback s_localeLanguageChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1113 string localeLanguage = SystemSettings.LocaleLanguage;
1114 LocaleLanguageChangedEventArgs eventArgs = new LocaleLanguageChangedEventArgs(localeLanguage);
1115 s_localeLanguageChanged?.Invoke(null, eventArgs);
1117 private static event EventHandler<LocaleLanguageChangedEventArgs> s_localeLanguageChanged;
1119 /// LocaleLanguageChanged event is triggered when the current language setting in the <LANGUAGE>_<REGION> syntax, is changed
1121 /// <param name="sender"></param>
1122 /// <param name="e">A LocaleLanguageChangedEventArgs object that contains the key & changed value</param>
1123 public static event EventHandler<LocaleLanguageChangedEventArgs> LocaleLanguageChanged
1127 if (s_localeLanguageChanged == null)
1129 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LocaleLanguage, s_localeLanguageChangedCallback, IntPtr.Zero);
1130 if (ret != SystemSettingsError.None)
1132 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1135 s_localeLanguageChanged += value;
1140 s_localeLanguageChanged -= value;
1141 if (s_localeLanguageChanged == null)
1143 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LocaleLanguage);
1144 if (ret != SystemSettingsError.None)
1146 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1152 private static readonly Interop.Settings.SystemSettingsChangedCallback s_localeTimeformat24HourChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1154 bool localeTimeFormat24Hour = SystemSettings.LocaleTimeformat24Hour;
1155 LocaleTimeformat24HourChangedEventArgs eventArgs = new LocaleTimeformat24HourChangedEventArgs(localeTimeFormat24Hour);
1156 s_localeTimeformat24HourChanged?.Invoke(null, eventArgs);
1158 private static event EventHandler<LocaleTimeformat24HourChangedEventArgs> s_localeTimeformat24HourChanged;
1160 /// LocaleTimeformat24HourChanged event is triggered when the time format is changed
1162 /// <param name="sender"></param>
1163 /// <param name="e">A LocaleTimeformat24HourChangedEventArgs object that contains the key & changed value</param>
1164 public static event EventHandler<LocaleTimeformat24HourChangedEventArgs> LocaleTimeformat24HourChanged
1168 if (s_localeTimeformat24HourChanged == null)
1170 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LocaleTimeformat24Hour, s_localeTimeformat24HourChangedCallback, IntPtr.Zero);
1171 if (ret != SystemSettingsError.None)
1173 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1176 s_localeTimeformat24HourChanged += value;
1181 s_localeTimeformat24HourChanged -= value;
1182 if (s_localeTimeformat24HourChanged == null)
1184 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LocaleTimeformat24Hour);
1185 if (ret != SystemSettingsError.None)
1187 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1193 private static readonly Interop.Settings.SystemSettingsChangedCallback s_localeTimezoneChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1195 string localeTimezone = SystemSettings.LocaleTimezone;
1196 LocaleTimezoneChangedEventArgs eventArgs = new LocaleTimezoneChangedEventArgs(localeTimezone);
1197 s_localeTimezoneChanged?.Invoke(null, eventArgs);
1199 private static event EventHandler<LocaleTimezoneChangedEventArgs> s_localeTimezoneChanged;
1201 /// LocaleTimezoneChanged event is triggered when the current time zone is changed
1203 /// <param name="sender"></param>
1204 /// <param name="e">A LocaleTimezoneChangedEventArgs object that contains the key & changed value</param>
1205 public static event EventHandler<LocaleTimezoneChangedEventArgs> LocaleTimezoneChanged
1209 if (s_localeTimezoneChanged == null)
1211 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LocaleTimezone, s_localeTimezoneChangedCallback, IntPtr.Zero);
1212 if (ret != SystemSettingsError.None)
1214 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1217 s_localeTimezoneChanged += value;
1222 s_localeTimezoneChanged -= value;
1223 if (s_localeTimezoneChanged == null)
1225 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LocaleTimezone);
1226 if (ret != SystemSettingsError.None)
1228 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1234 private static readonly Interop.Settings.SystemSettingsChangedCallback s_timeChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1236 //bool motionActivation = SystemSettings.Time;
1237 TimeChangedEventArgs eventArgs = new TimeChangedEventArgs();
1238 s_timeChanged?.Invoke(null, eventArgs);
1240 private static event EventHandler<TimeChangedEventArgs> s_timeChanged;
1242 /// TimeChanged event is triggered when the system time is changed
1244 /// <param name="sender"></param>
1245 /// <param name="e">A TimeChangedEventArgs object that contains the key & changed value</param>
1246 public static event EventHandler<TimeChangedEventArgs> TimeChanged
1250 if (s_timeChanged == null)
1252 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.Time, s_timeChangedCallback, IntPtr.Zero);
1253 if (ret != SystemSettingsError.None)
1255 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1258 s_timeChanged += value;
1263 s_timeChanged -= value;
1264 if (s_timeChanged == null)
1266 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.Time);
1267 if (ret != SystemSettingsError.None)
1269 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1275 private static readonly Interop.Settings.SystemSettingsChangedCallback s_soundLockChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1277 bool soundLock = SystemSettings.SoundLock;
1278 SoundLockChangedEventArgs eventArgs = new SoundLockChangedEventArgs(soundLock);
1279 s_soundLockChanged?.Invoke(null, eventArgs);
1281 private static event EventHandler<SoundLockChangedEventArgs> s_soundLockChanged;
1283 /// SoundLockChanged event is triggered when the screen lock sound enabled status is changed
1285 /// <param name="sender"></param>
1286 /// <param name="e">A SoundLockChangedEventArgs object that contains the key & changed value</param>
1287 public static event EventHandler<SoundLockChangedEventArgs> SoundLockChanged
1291 if (s_soundLockChanged == null)
1293 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.SoundLock, s_soundLockChangedCallback, IntPtr.Zero);
1294 if (ret != SystemSettingsError.None)
1296 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1299 s_soundLockChanged += value;
1304 s_soundLockChanged -= value;
1305 if (s_soundLockChanged == null)
1307 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.SoundLock);
1308 if (ret != SystemSettingsError.None)
1310 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1316 private static readonly Interop.Settings.SystemSettingsChangedCallback s_soundSilentModeChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1318 bool soundSilentMode = SystemSettings.SoundSilentMode;
1319 SoundSilentModeChangedEventArgs eventArgs = new SoundSilentModeChangedEventArgs(soundSilentMode);
1320 s_soundSilentModeChanged?.Invoke(null, eventArgs);
1322 private static event EventHandler<SoundSilentModeChangedEventArgs> s_soundSilentModeChanged;
1324 /// SoundSilentModeChanged event is triggered when the silent mode status is changed
1326 /// <param name="sender"></param>
1327 /// <param name="e">A SoundSilentModeChangedEventArgs object that contains the key & changed value</param>
1328 public static event EventHandler<SoundSilentModeChangedEventArgs> SoundSilentModeChanged
1332 if (s_soundSilentModeChanged == null)
1334 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.SoundSilentMode, s_soundSilentModeChangedCallback, IntPtr.Zero);
1335 if (ret != SystemSettingsError.None)
1337 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1340 s_soundSilentModeChanged += value;
1345 s_soundSilentModeChanged -= value;
1346 if (s_soundSilentModeChanged == null)
1348 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.SoundSilentMode);
1349 if (ret != SystemSettingsError.None)
1351 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1357 private static readonly Interop.Settings.SystemSettingsChangedCallback s_soundTouchChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1359 bool soundTouch = SystemSettings.SoundTouch;
1360 SoundTouchChangedEventArgs eventArgs = new SoundTouchChangedEventArgs(soundTouch);
1361 s_soundTouchChanged?.Invoke(null, eventArgs);
1363 private static event EventHandler<SoundTouchChangedEventArgs> s_soundTouchChanged;
1365 /// SoundTouchChanged event is triggered when the screen touch sound enabled status is changed
1367 /// <param name="sender"></param>
1368 /// <param name="e">A SoundTouchChangedEventArgs object that contains the key & changed value</param>
1369 public static event EventHandler<SoundTouchChangedEventArgs> SoundTouchChanged
1373 if (s_soundTouchChanged == null)
1375 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.SoundTouch, s_soundTouchChangedCallback, IntPtr.Zero);
1376 if (ret != SystemSettingsError.None)
1378 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1381 s_soundTouchChanged += value;
1386 s_soundTouchChanged -= value;
1387 if (s_soundTouchChanged == null)
1389 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.SoundTouch);
1390 if (ret != SystemSettingsError.None)
1392 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1398 private static readonly Interop.Settings.SystemSettingsChangedCallback s_displayScreenRotationAutoChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1400 bool displayScreenRotationAuto = SystemSettings.DisplayScreenRotationAuto;
1401 DisplayScreenRotationAutoChangedEventArgs eventArgs = new DisplayScreenRotationAutoChangedEventArgs(displayScreenRotationAuto);
1402 s_displayScreenRotationAutoChanged?.Invoke(null, eventArgs);
1404 private static event EventHandler<DisplayScreenRotationAutoChangedEventArgs> s_displayScreenRotationAutoChanged;
1406 /// DisplayScreenRotationAutoChanged event is triggered when the automatic rotation control status is changed
1408 /// <param name="sender"></param>
1409 /// <param name="e">A DisplayScreenRotationAutoChangedEventArgs object that contains the key & changed value</param>
1410 public static event EventHandler<DisplayScreenRotationAutoChangedEventArgs> DisplayScreenRotationAutoChanged
1414 if (s_displayScreenRotationAutoChanged == null)
1416 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.DisplayScreenRotationAuto, s_displayScreenRotationAutoChangedCallback, IntPtr.Zero);
1417 if (ret != SystemSettingsError.None)
1419 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1422 s_displayScreenRotationAutoChanged += value;
1427 s_displayScreenRotationAutoChanged -= value;
1428 if (s_displayScreenRotationAutoChanged == null)
1430 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.DisplayScreenRotationAuto);
1431 if (ret != SystemSettingsError.None)
1433 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1439 private static readonly Interop.Settings.SystemSettingsChangedCallback s_deviceNameChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1441 string deviceName = SystemSettings.DeviceName;
1442 DeviceNameChangedEventArgs eventArgs = new DeviceNameChangedEventArgs(deviceName);
1443 s_deviceNameChanged?.Invoke(null, eventArgs);
1445 private static event EventHandler<DeviceNameChangedEventArgs> s_deviceNameChanged;
1447 /// DeviceNameChanged event is triggered when the device name is changed
1449 /// <param name="sender"></param>
1450 /// <param name="e">A DeviceNameChangedEventArgs object that contains the key & changed value</param>
1451 public static event EventHandler<DeviceNameChangedEventArgs> DeviceNameChanged
1455 if (s_deviceNameChanged == null)
1457 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.DeviceName, s_deviceNameChangedCallback, IntPtr.Zero);
1458 if (ret != SystemSettingsError.None)
1460 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1463 s_deviceNameChanged += value;
1468 s_deviceNameChanged -= value;
1469 if (s_deviceNameChanged == null)
1471 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.DeviceName);
1472 if (ret != SystemSettingsError.None)
1474 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1480 private static readonly Interop.Settings.SystemSettingsChangedCallback s_motionSettingChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1482 bool motionEnabled = SystemSettings.MotionEnabled;
1483 MotionSettingChangedEventArgs eventArgs = new MotionSettingChangedEventArgs(motionEnabled);
1484 s_motionSettingChanged?.Invoke(null, eventArgs);
1486 private static event EventHandler<MotionSettingChangedEventArgs> s_motionSettingChanged;
1488 /// MotionSettingChanged event is triggered when the motion feature enabled status is changed
1490 /// <param name="sender"></param>
1491 /// <param name="e">A MotionSettingChangedEventArgs object that contains the key & changed value</param>
1492 public static event EventHandler<MotionSettingChangedEventArgs> MotionSettingChanged
1496 if (s_motionSettingChanged == null)
1498 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.MotionEnabled, s_motionSettingChangedCallback, IntPtr.Zero);
1499 if (ret != SystemSettingsError.None)
1501 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1504 s_motionSettingChanged += value;
1509 s_motionSettingChanged -= value;
1510 if (s_motionSettingChanged == null)
1512 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.MotionEnabled);
1513 if (ret != SystemSettingsError.None)
1515 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1521 private static readonly Interop.Settings.SystemSettingsChangedCallback s_networkWifiNotificationChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1523 bool networkWifiNotification = SystemSettings.NetworkWifiNotification;
1524 NetworkWifiNotificationChangedEventArgs eventArgs = new NetworkWifiNotificationChangedEventArgs(networkWifiNotification);
1525 s_networkWifiNotificationChanged?.Invoke(null, eventArgs);
1527 private static event EventHandler<NetworkWifiNotificationChangedEventArgs> s_networkWifiNotificationChanged;
1529 /// NetworkWifiNotificationChanged event is triggered when the Wi-Fi-related notifications enabled status is changed
1531 /// <param name="sender"></param>
1532 /// <param name="e">A NetworkWifiNotificationChangedEventArgs object that contains the key & changed value</param>
1533 public static event EventHandler<NetworkWifiNotificationChangedEventArgs> NetworkWifiNotificationChanged
1537 if (s_networkWifiNotificationChanged == null)
1539 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.NetworkWifiNotification, s_networkWifiNotificationChangedCallback, IntPtr.Zero);
1540 if (ret != SystemSettingsError.None)
1542 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1545 s_networkWifiNotificationChanged += value;
1550 s_networkWifiNotificationChanged -= value;
1551 if (s_networkWifiNotificationChanged == null)
1553 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.NetworkWifiNotification);
1554 if (ret != SystemSettingsError.None)
1556 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1562 private static readonly Interop.Settings.SystemSettingsChangedCallback s_networkFlightModeChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1564 bool networkFlightMode = SystemSettings.NetworkFlightMode;
1565 NetworkFlightModeChangedEventArgs eventArgs = new NetworkFlightModeChangedEventArgs(networkFlightMode);
1566 s_networkFlightModeChanged?.Invoke(null, eventArgs);
1568 private static event EventHandler<NetworkFlightModeChangedEventArgs> s_networkFlightModeChanged;
1570 /// NetworkFlightModeChanged event is triggered when the flight mode status is changed
1572 /// <param name="sender"></param>
1573 /// <param name="e">A NetworkFlightModeChangedEventArgs object that contains the key & changed value</param>
1574 public static event EventHandler<NetworkFlightModeChangedEventArgs> NetworkFlightModeChanged
1578 if (s_networkFlightModeChanged == null)
1580 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.NetworkFlightMode, s_networkFlightModeChangedCallback, IntPtr.Zero);
1581 if (ret != SystemSettingsError.None)
1583 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1586 s_networkFlightModeChanged += value;
1591 s_networkFlightModeChanged -= value;
1592 if (s_networkFlightModeChanged == null)
1594 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.NetworkFlightMode);
1595 if (ret != SystemSettingsError.None)
1597 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1603 private static readonly Interop.Settings.SystemSettingsChangedCallback s_screenBacklightTimeChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1605 int screenBacklightTime = SystemSettings.ScreenBacklightTime;
1606 ScreenBacklightTimeChangedEventArgs eventArgs = new ScreenBacklightTimeChangedEventArgs(screenBacklightTime);
1607 s_screenBacklightTimeChanged?.Invoke(null, eventArgs);
1609 private static event EventHandler<ScreenBacklightTimeChangedEventArgs> s_screenBacklightTimeChanged;
1611 /// ScreenBacklightTimeChanged event is triggered when the backlight time is changed.
1613 /// <param name="sender"></param>
1614 /// <param name="e">A ScreenBacklightTimeChangedEventArgs object that contains the key & changed value</param>
1615 public static event EventHandler<ScreenBacklightTimeChangedEventArgs> ScreenBacklightTimeChanged
1619 if (s_screenBacklightTimeChanged == null)
1621 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.ScreenBacklightTime, s_screenBacklightTimeChangedCallback, IntPtr.Zero);
1622 if (ret != SystemSettingsError.None)
1624 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1627 s_screenBacklightTimeChanged += value;
1632 s_screenBacklightTimeChanged -= value;
1633 if (s_screenBacklightTimeChanged == null)
1635 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.ScreenBacklightTime);
1636 if (ret != SystemSettingsError.None)
1638 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1644 private static readonly Interop.Settings.SystemSettingsChangedCallback s_soundNotificationChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1646 string soundNotification = SystemSettings.SoundNotification;
1647 SoundNotificationChangedEventArgs eventArgs = new SoundNotificationChangedEventArgs(soundNotification);
1648 s_soundNotificationChanged?.Invoke(null, eventArgs);
1650 private static event EventHandler<SoundNotificationChangedEventArgs> s_soundNotificationChanged;
1652 /// SoundNotificationChanged event is triggered when the file path of the current notification tone set by the user is changed
1654 /// <param name="sender"></param>
1655 /// <param name="e">A SoundNotificationChangedEventArgs object that contains the key & changed value</param>
1656 public static event EventHandler<SoundNotificationChangedEventArgs> SoundNotificationChanged
1660 if (s_soundNotificationChanged == null)
1662 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.SoundNotification, s_soundNotificationChangedCallback, IntPtr.Zero);
1663 if (ret != SystemSettingsError.None)
1665 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1668 s_soundNotificationChanged += value;
1673 s_soundNotificationChanged -= value;
1674 if (s_soundNotificationChanged == null)
1676 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.SoundNotification);
1677 if (ret != SystemSettingsError.None)
1679 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1685 private static readonly Interop.Settings.SystemSettingsChangedCallback s_soundNotificationRepetitionPeriodChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1687 int soundNotificationRepetitionPeriod = SystemSettings.SoundNotificationRepetitionPeriod;
1688 SoundNotificationRepetitionPeriodChangedEventArgs eventArgs = new SoundNotificationRepetitionPeriodChangedEventArgs(soundNotificationRepetitionPeriod);
1689 s_soundNotificationRepetitionPeriodChanged?.Invoke(null, eventArgs);
1691 private static event EventHandler<SoundNotificationRepetitionPeriodChangedEventArgs> s_soundNotificationRepetitionPeriodChanged;
1693 /// SoundNotificationRepetitionPeriodChanged event is triggered when the time period for notification repetitions is changed
1695 /// <param name="sender"></param>
1696 /// <param name="e">A SoundNotificationRepetitionPeriodChangedEventArgs object that contains the key & changed value</param>
1697 public static event EventHandler<SoundNotificationRepetitionPeriodChangedEventArgs> SoundNotificationRepetitionPeriodChanged
1701 if (s_soundNotificationRepetitionPeriodChanged == null)
1703 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.SoundNotificationRepetitionPeriod, s_soundNotificationRepetitionPeriodChangedCallback, IntPtr.Zero);
1704 if (ret != SystemSettingsError.None)
1706 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1709 s_soundNotificationRepetitionPeriodChanged += value;
1714 s_soundNotificationRepetitionPeriodChanged -= value;
1715 if (s_soundNotificationRepetitionPeriodChanged == null)
1717 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.SoundNotificationRepetitionPeriod);
1718 if (ret != SystemSettingsError.None)
1720 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1726 private static readonly Interop.Settings.SystemSettingsChangedCallback s_lockStateChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1728 SystemSettingsIdleLockState lockState = SystemSettings.LockState;
1729 LockStateChangedEventArgs eventArgs = new LockStateChangedEventArgs(lockState);
1730 s_lockStateChanged?.Invoke(null, eventArgs);
1732 private static event EventHandler<LockStateChangedEventArgs> s_lockStateChanged;
1734 /// LockStateChanged event is triggered when the current lock state is changed
1736 /// <param name="sender"></param>
1737 /// <param name="e">A LockStateChangedEventArgs object that contains the key & changed value</param>
1738 public static event EventHandler<LockStateChangedEventArgs> LockStateChanged
1742 if (s_lockStateChanged == null)
1744 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LockState, s_lockStateChangedCallback, IntPtr.Zero);
1745 if (ret != SystemSettingsError.None)
1747 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1750 s_lockStateChanged += value;
1755 s_lockStateChanged -= value;
1756 if (s_lockStateChanged == null)
1758 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LockState);
1759 if (ret != SystemSettingsError.None)
1761 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");