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 MotionActivationEnabled
146 bool isMotionServiceActivated;
147 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.MotionActivationEnabled, 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.MotionActivationEnabled, 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 LocaleTimeFormat24HourEnabled
343 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.LocaleTimeFormat24HourEnabled, 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.LocaleTimeFormat24HourEnabled, 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 SoundLockEnabled
391 bool isSoundLockEnabled;
392 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.SoundLockEnabled, 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 SoundSilentModeEnabled
409 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.SoundSilentModeEnabled, 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 SoundTouchEnabled
425 bool isTouchSoundEnabled;
426 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.SoundTouchEnabled, 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 DisplayScreenRotationAutoEnabled
442 bool isRotationAutomatic;
443 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.DisplayScreenRotationAutoEnabled, 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 NetworkWifiNotificationEnabled
492 bool isWifiNotificationEnabled;
493 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.NetworkWifiNotificationEnabled, 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 NetworkFlightModeEnabled
509 bool isFlightModeEnabled;
510 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.NetworkFlightModeEnabled, 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.MotionActivationEnabled;
827 MotionActivationSettingChangedEventArgs eventArgs = new MotionActivationSettingChangedEventArgs(motionActivation);
828 s_motionActivationChanged?.Invoke(null, eventArgs);
830 private static event EventHandler<MotionActivationSettingChangedEventArgs> 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<MotionActivationSettingChangedEventArgs> MotionActivationSettingChanged
840 if (s_motionActivationChanged == null)
842 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.MotionActivationEnabled, 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.MotionActivationEnabled);
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_localeCountryChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1031 string localeCountry = SystemSettings.LocaleCountry;
1032 LocaleCountryChangedEventArgs eventArgs = new LocaleCountryChangedEventArgs(localeCountry);
1033 s_localeCountryChanged?.Invoke(null, eventArgs);
1035 private static event EventHandler<LocaleCountryChangedEventArgs> s_localeCountryChanged;
1037 /// LocaleCountryChanged event is triggered when the current country setting in the <LANGUAGE>_<REGION> syntax, is changed
1039 /// <param name="sender"></param>
1040 /// <param name="e">A LocaleCountryChangedEventArgs object that contains the key & changed value</param>
1041 public static event EventHandler<LocaleCountryChangedEventArgs> LocaleCountryChanged
1045 if (s_localeCountryChanged == null)
1047 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LocaleCountry, s_localeCountryChangedCallback, IntPtr.Zero);
1048 if (ret != SystemSettingsError.None)
1050 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1053 s_localeCountryChanged += value;
1058 s_localeCountryChanged -= value;
1059 if (s_localeCountryChanged == null)
1061 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LocaleCountry);
1062 if (ret != SystemSettingsError.None)
1064 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1070 private static readonly Interop.Settings.SystemSettingsChangedCallback s_localeLanguageChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1072 string localeLanguage = SystemSettings.LocaleLanguage;
1073 LocaleLanguageChangedEventArgs eventArgs = new LocaleLanguageChangedEventArgs(localeLanguage);
1074 s_localeLanguageChanged?.Invoke(null, eventArgs);
1076 private static event EventHandler<LocaleLanguageChangedEventArgs> s_localeLanguageChanged;
1078 /// LocaleLanguageChanged event is triggered when the current language setting in the <LANGUAGE>_<REGION> syntax, is changed
1080 /// <param name="sender"></param>
1081 /// <param name="e">A LocaleLanguageChangedEventArgs object that contains the key & changed value</param>
1082 public static event EventHandler<LocaleLanguageChangedEventArgs> LocaleLanguageChanged
1086 if (s_localeLanguageChanged == null)
1088 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LocaleLanguage, s_localeLanguageChangedCallback, IntPtr.Zero);
1089 if (ret != SystemSettingsError.None)
1091 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1094 s_localeLanguageChanged += value;
1099 s_localeLanguageChanged -= value;
1100 if (s_localeLanguageChanged == null)
1102 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LocaleLanguage);
1103 if (ret != SystemSettingsError.None)
1105 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1111 private static readonly Interop.Settings.SystemSettingsChangedCallback s_localeTimeFormat24HourChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1113 bool localeTimeFormat24Hour = SystemSettings.LocaleTimeFormat24HourEnabled;
1114 LocaleTimeFormat24HourSettingChangedEventArgs eventArgs = new LocaleTimeFormat24HourSettingChangedEventArgs(localeTimeFormat24Hour);
1115 s_localeTimeFormat24HourChanged?.Invoke(null, eventArgs);
1117 private static event EventHandler<LocaleTimeFormat24HourSettingChangedEventArgs> s_localeTimeFormat24HourChanged;
1119 /// LocaleTimeFormat24HourChanged event is triggered when the time format is changed
1121 /// <param name="sender"></param>
1122 /// <param name="e">A LocaleTimeFormat24HourChangedEventArgs object that contains the key & changed value</param>
1123 public static event EventHandler<LocaleTimeFormat24HourSettingChangedEventArgs> LocaleTimeFormat24HourSettingChanged
1127 if (s_localeTimeFormat24HourChanged == null)
1129 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LocaleTimeFormat24HourEnabled, s_localeTimeFormat24HourChangedCallback, IntPtr.Zero);
1130 if (ret != SystemSettingsError.None)
1132 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1135 s_localeTimeFormat24HourChanged += value;
1140 s_localeTimeFormat24HourChanged -= value;
1141 if (s_localeTimeFormat24HourChanged == null)
1143 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LocaleTimeFormat24HourEnabled);
1144 if (ret != SystemSettingsError.None)
1146 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1152 private static readonly Interop.Settings.SystemSettingsChangedCallback s_localeTimeZoneChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1154 string localeTimeZone = SystemSettings.LocaleTimeZone;
1155 LocaleTimeZoneChangedEventArgs eventArgs = new LocaleTimeZoneChangedEventArgs(localeTimeZone);
1156 s_localeTimeZoneChanged?.Invoke(null, eventArgs);
1158 private static event EventHandler<LocaleTimeZoneChangedEventArgs> s_localeTimeZoneChanged;
1160 /// LocaleTimeZoneChanged event is triggered when the current time zone is changed
1162 /// <param name="sender"></param>
1163 /// <param name="e">A LocaleTimeZoneChangedEventArgs object that contains the key & changed value</param>
1164 public static event EventHandler<LocaleTimeZoneChangedEventArgs> LocaleTimeZoneChanged
1168 if (s_localeTimeZoneChanged == null)
1170 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LocaleTimeZone, s_localeTimeZoneChangedCallback, IntPtr.Zero);
1171 if (ret != SystemSettingsError.None)
1173 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1176 s_localeTimeZoneChanged += value;
1181 s_localeTimeZoneChanged -= value;
1182 if (s_localeTimeZoneChanged == null)
1184 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LocaleTimeZone);
1185 if (ret != SystemSettingsError.None)
1187 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1193 private static readonly Interop.Settings.SystemSettingsChangedCallback s_timeChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1195 //bool motionActivation = SystemSettings.Time;
1196 TimeChangedEventArgs eventArgs = new TimeChangedEventArgs();
1197 s_timeChanged?.Invoke(null, eventArgs);
1199 private static event EventHandler<TimeChangedEventArgs> s_timeChanged;
1201 /// TimeChanged event is triggered when the system time is changed
1203 /// <param name="sender"></param>
1204 /// <param name="e">A TimeChangedEventArgs object that contains the key & changed value</param>
1205 public static event EventHandler<TimeChangedEventArgs> TimeChanged
1209 if (s_timeChanged == null)
1211 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.Time, s_timeChangedCallback, IntPtr.Zero);
1212 if (ret != SystemSettingsError.None)
1214 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1217 s_timeChanged += value;
1222 s_timeChanged -= value;
1223 if (s_timeChanged == null)
1225 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.Time);
1226 if (ret != SystemSettingsError.None)
1228 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1234 private static readonly Interop.Settings.SystemSettingsChangedCallback s_soundLockChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1236 bool soundLock = SystemSettings.SoundLockEnabled;
1237 SoundLockSettingChangedEventArgs eventArgs = new SoundLockSettingChangedEventArgs(soundLock);
1238 s_soundLockChanged?.Invoke(null, eventArgs);
1240 private static event EventHandler<SoundLockSettingChangedEventArgs> s_soundLockChanged;
1242 /// SoundLockChanged event is triggered when the screen lock sound enabled status is changed
1244 /// <param name="sender"></param>
1245 /// <param name="e">A SoundLockChangedEventArgs object that contains the key & changed value</param>
1246 public static event EventHandler<SoundLockSettingChangedEventArgs> SoundLockSettingChanged
1250 if (s_soundLockChanged == null)
1252 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.SoundLockEnabled, s_soundLockChangedCallback, IntPtr.Zero);
1253 if (ret != SystemSettingsError.None)
1255 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1258 s_soundLockChanged += value;
1263 s_soundLockChanged -= value;
1264 if (s_soundLockChanged == null)
1266 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.SoundLockEnabled);
1267 if (ret != SystemSettingsError.None)
1269 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1275 private static readonly Interop.Settings.SystemSettingsChangedCallback s_soundSilentModeChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1277 bool soundSilentMode = SystemSettings.SoundSilentModeEnabled;
1278 SoundSilentModeSettingChangedEventArgs eventArgs = new SoundSilentModeSettingChangedEventArgs(soundSilentMode);
1279 s_soundSilentModeChanged?.Invoke(null, eventArgs);
1281 private static event EventHandler<SoundSilentModeSettingChangedEventArgs> s_soundSilentModeChanged;
1283 /// SoundSilentModeChanged event is triggered when the silent mode status is changed
1285 /// <param name="sender"></param>
1286 /// <param name="e">A SoundSilentModeChangedEventArgs object that contains the key & changed value</param>
1287 public static event EventHandler<SoundSilentModeSettingChangedEventArgs> SoundSilentModeSettingChanged
1291 if (s_soundSilentModeChanged == null)
1293 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.SoundSilentModeEnabled, s_soundSilentModeChangedCallback, IntPtr.Zero);
1294 if (ret != SystemSettingsError.None)
1296 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1299 s_soundSilentModeChanged += value;
1304 s_soundSilentModeChanged -= value;
1305 if (s_soundSilentModeChanged == null)
1307 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.SoundSilentModeEnabled);
1308 if (ret != SystemSettingsError.None)
1310 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1316 private static readonly Interop.Settings.SystemSettingsChangedCallback s_soundTouchChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1318 bool soundTouch = SystemSettings.SoundTouchEnabled;
1319 SoundTouchSettingChangedEventArgs eventArgs = new SoundTouchSettingChangedEventArgs(soundTouch);
1320 s_soundTouchChanged?.Invoke(null, eventArgs);
1322 private static event EventHandler<SoundTouchSettingChangedEventArgs> s_soundTouchChanged;
1324 /// SoundTouchChanged event is triggered when the screen touch sound enabled status is changed
1326 /// <param name="sender"></param>
1327 /// <param name="e">A SoundTouchChangedEventArgs object that contains the key & changed value</param>
1328 public static event EventHandler<SoundTouchSettingChangedEventArgs> SoundTouchSettingChanged
1332 if (s_soundTouchChanged == null)
1334 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.SoundTouchEnabled, s_soundTouchChangedCallback, IntPtr.Zero);
1335 if (ret != SystemSettingsError.None)
1337 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1340 s_soundTouchChanged += value;
1345 s_soundTouchChanged -= value;
1346 if (s_soundTouchChanged == null)
1348 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.SoundTouchEnabled);
1349 if (ret != SystemSettingsError.None)
1351 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1357 private static readonly Interop.Settings.SystemSettingsChangedCallback s_displayScreenRotationAutoChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1359 bool displayScreenRotationAuto = SystemSettings.DisplayScreenRotationAutoEnabled;
1360 DisplayScreenRotationAutoSettingChangedEventArgs eventArgs = new DisplayScreenRotationAutoSettingChangedEventArgs(displayScreenRotationAuto);
1361 s_displayScreenRotationAutoChanged?.Invoke(null, eventArgs);
1363 private static event EventHandler<DisplayScreenRotationAutoSettingChangedEventArgs> s_displayScreenRotationAutoChanged;
1365 /// DisplayScreenRotationAutoChanged event is triggered when the automatic rotation control status is changed
1367 /// <param name="sender"></param>
1368 /// <param name="e">A DisplayScreenRotationAutoChangedEventArgs object that contains the key & changed value</param>
1369 public static event EventHandler<DisplayScreenRotationAutoSettingChangedEventArgs> DisplayScreenRotationAutoSettingChanged
1373 if (s_displayScreenRotationAutoChanged == null)
1375 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.DisplayScreenRotationAutoEnabled, s_displayScreenRotationAutoChangedCallback, IntPtr.Zero);
1376 if (ret != SystemSettingsError.None)
1378 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1381 s_displayScreenRotationAutoChanged += value;
1386 s_displayScreenRotationAutoChanged -= value;
1387 if (s_displayScreenRotationAutoChanged == null)
1389 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.DisplayScreenRotationAutoEnabled);
1390 if (ret != SystemSettingsError.None)
1392 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1398 private static readonly Interop.Settings.SystemSettingsChangedCallback s_deviceNameChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1400 string deviceName = SystemSettings.DeviceName;
1401 DeviceNameChangedEventArgs eventArgs = new DeviceNameChangedEventArgs(deviceName);
1402 s_deviceNameChanged?.Invoke(null, eventArgs);
1404 private static event EventHandler<DeviceNameChangedEventArgs> s_deviceNameChanged;
1406 /// DeviceNameChanged event is triggered when the device name is changed
1408 /// <param name="sender"></param>
1409 /// <param name="e">A DeviceNameChangedEventArgs object that contains the key & changed value</param>
1410 public static event EventHandler<DeviceNameChangedEventArgs> DeviceNameChanged
1414 if (s_deviceNameChanged == null)
1416 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.DeviceName, s_deviceNameChangedCallback, IntPtr.Zero);
1417 if (ret != SystemSettingsError.None)
1419 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1422 s_deviceNameChanged += value;
1427 s_deviceNameChanged -= value;
1428 if (s_deviceNameChanged == null)
1430 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.DeviceName);
1431 if (ret != SystemSettingsError.None)
1433 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1439 private static readonly Interop.Settings.SystemSettingsChangedCallback s_motionSettingChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1441 bool motionEnabled = SystemSettings.MotionEnabled;
1442 MotionSettingChangedEventArgs eventArgs = new MotionSettingChangedEventArgs(motionEnabled);
1443 s_motionSettingChanged?.Invoke(null, eventArgs);
1445 private static event EventHandler<MotionSettingChangedEventArgs> s_motionSettingChanged;
1447 /// MotionSettingChanged event is triggered when the motion feature enabled status is changed
1449 /// <param name="sender"></param>
1450 /// <param name="e">A MotionSettingChangedEventArgs object that contains the key & changed value</param>
1451 public static event EventHandler<MotionSettingChangedEventArgs> MotionSettingChanged
1455 if (s_motionSettingChanged == null)
1457 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.MotionEnabled, s_motionSettingChangedCallback, IntPtr.Zero);
1458 if (ret != SystemSettingsError.None)
1460 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1463 s_motionSettingChanged += value;
1468 s_motionSettingChanged -= value;
1469 if (s_motionSettingChanged == null)
1471 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.MotionEnabled);
1472 if (ret != SystemSettingsError.None)
1474 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1480 private static readonly Interop.Settings.SystemSettingsChangedCallback s_networkWifiNotificationChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1482 bool networkWifiNotification = SystemSettings.NetworkWifiNotificationEnabled;
1483 NetworkWifiNotificationSettingChangedEventArgs eventArgs = new NetworkWifiNotificationSettingChangedEventArgs(networkWifiNotification);
1484 s_networkWifiNotificationChanged?.Invoke(null, eventArgs);
1486 private static event EventHandler<NetworkWifiNotificationSettingChangedEventArgs> s_networkWifiNotificationChanged;
1488 /// NetworkWifiNotificationChanged event is triggered when the Wi-Fi-related notifications enabled status is changed
1490 /// <param name="sender"></param>
1491 /// <param name="e">A NetworkWifiNotificationChangedEventArgs object that contains the key & changed value</param>
1492 public static event EventHandler<NetworkWifiNotificationSettingChangedEventArgs> NetworkWifiNotificationSettingChanged
1496 if (s_networkWifiNotificationChanged == null)
1498 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.NetworkWifiNotificationEnabled, s_networkWifiNotificationChangedCallback, IntPtr.Zero);
1499 if (ret != SystemSettingsError.None)
1501 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1504 s_networkWifiNotificationChanged += value;
1509 s_networkWifiNotificationChanged -= value;
1510 if (s_networkWifiNotificationChanged == null)
1512 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.NetworkWifiNotificationEnabled);
1513 if (ret != SystemSettingsError.None)
1515 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1521 private static readonly Interop.Settings.SystemSettingsChangedCallback s_networkFlightModeChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1523 bool networkFlightMode = SystemSettings.NetworkFlightModeEnabled;
1524 NetworkFlightModeSettingChangedEventArgs eventArgs = new NetworkFlightModeSettingChangedEventArgs(networkFlightMode);
1525 s_networkFlightModeChanged?.Invoke(null, eventArgs);
1527 private static event EventHandler<NetworkFlightModeSettingChangedEventArgs> s_networkFlightModeChanged;
1529 /// NetworkFlightModeChanged event is triggered when the flight mode status is changed
1531 /// <param name="sender"></param>
1532 /// <param name="e">A NetworkFlightModeChangedEventArgs object that contains the key & changed value</param>
1533 public static event EventHandler<NetworkFlightModeSettingChangedEventArgs> NetworkFlightModeSettingChanged
1537 if (s_networkFlightModeChanged == null)
1539 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.NetworkFlightModeEnabled, s_networkFlightModeChangedCallback, IntPtr.Zero);
1540 if (ret != SystemSettingsError.None)
1542 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1545 s_networkFlightModeChanged += value;
1550 s_networkFlightModeChanged -= value;
1551 if (s_networkFlightModeChanged == null)
1553 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.NetworkFlightModeEnabled);
1554 if (ret != SystemSettingsError.None)
1556 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1562 private static readonly Interop.Settings.SystemSettingsChangedCallback s_screenBacklightTimeChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1564 int screenBacklightTime = SystemSettings.ScreenBacklightTime;
1565 ScreenBacklightTimeChangedEventArgs eventArgs = new ScreenBacklightTimeChangedEventArgs(screenBacklightTime);
1566 s_screenBacklightTimeChanged?.Invoke(null, eventArgs);
1568 private static event EventHandler<ScreenBacklightTimeChangedEventArgs> s_screenBacklightTimeChanged;
1570 /// ScreenBacklightTimeChanged event is triggered when the backlight time is changed.
1572 /// <param name="sender"></param>
1573 /// <param name="e">A ScreenBacklightTimeChangedEventArgs object that contains the key & changed value</param>
1574 public static event EventHandler<ScreenBacklightTimeChangedEventArgs> ScreenBacklightTimeChanged
1578 if (s_screenBacklightTimeChanged == null)
1580 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.ScreenBacklightTime, s_screenBacklightTimeChangedCallback, IntPtr.Zero);
1581 if (ret != SystemSettingsError.None)
1583 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1586 s_screenBacklightTimeChanged += value;
1591 s_screenBacklightTimeChanged -= value;
1592 if (s_screenBacklightTimeChanged == null)
1594 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.ScreenBacklightTime);
1595 if (ret != SystemSettingsError.None)
1597 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1603 private static readonly Interop.Settings.SystemSettingsChangedCallback s_soundNotificationChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1605 string soundNotification = SystemSettings.SoundNotification;
1606 SoundNotificationChangedEventArgs eventArgs = new SoundNotificationChangedEventArgs(soundNotification);
1607 s_soundNotificationChanged?.Invoke(null, eventArgs);
1609 private static event EventHandler<SoundNotificationChangedEventArgs> s_soundNotificationChanged;
1611 /// SoundNotificationChanged event is triggered when the file path of the current notification tone set by the user is changed
1613 /// <param name="sender"></param>
1614 /// <param name="e">A SoundNotificationChangedEventArgs object that contains the key & changed value</param>
1615 public static event EventHandler<SoundNotificationChangedEventArgs> SoundNotificationChanged
1619 if (s_soundNotificationChanged == null)
1621 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.SoundNotification, s_soundNotificationChangedCallback, IntPtr.Zero);
1622 if (ret != SystemSettingsError.None)
1624 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1627 s_soundNotificationChanged += value;
1632 s_soundNotificationChanged -= value;
1633 if (s_soundNotificationChanged == null)
1635 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.SoundNotification);
1636 if (ret != SystemSettingsError.None)
1638 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1644 private static readonly Interop.Settings.SystemSettingsChangedCallback s_soundNotificationRepetitionPeriodChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1646 int soundNotificationRepetitionPeriod = SystemSettings.SoundNotificationRepetitionPeriod;
1647 SoundNotificationRepetitionPeriodChangedEventArgs eventArgs = new SoundNotificationRepetitionPeriodChangedEventArgs(soundNotificationRepetitionPeriod);
1648 s_soundNotificationRepetitionPeriodChanged?.Invoke(null, eventArgs);
1650 private static event EventHandler<SoundNotificationRepetitionPeriodChangedEventArgs> s_soundNotificationRepetitionPeriodChanged;
1652 /// SoundNotificationRepetitionPeriodChanged event is triggered when the time period for notification repetitions is changed
1654 /// <param name="sender"></param>
1655 /// <param name="e">A SoundNotificationRepetitionPeriodChangedEventArgs object that contains the key & changed value</param>
1656 public static event EventHandler<SoundNotificationRepetitionPeriodChangedEventArgs> SoundNotificationRepetitionPeriodChanged
1660 if (s_soundNotificationRepetitionPeriodChanged == null)
1662 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.SoundNotificationRepetitionPeriod, s_soundNotificationRepetitionPeriodChangedCallback, IntPtr.Zero);
1663 if (ret != SystemSettingsError.None)
1665 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1668 s_soundNotificationRepetitionPeriodChanged += value;
1673 s_soundNotificationRepetitionPeriodChanged -= value;
1674 if (s_soundNotificationRepetitionPeriodChanged == null)
1676 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.SoundNotificationRepetitionPeriod);
1677 if (ret != SystemSettingsError.None)
1679 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1685 private static readonly Interop.Settings.SystemSettingsChangedCallback s_lockStateChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1687 SystemSettingsIdleLockState lockState = SystemSettings.LockState;
1688 LockStateChangedEventArgs eventArgs = new LockStateChangedEventArgs(lockState);
1689 s_lockStateChanged?.Invoke(null, eventArgs);
1691 private static event EventHandler<LockStateChangedEventArgs> s_lockStateChanged;
1693 /// LockStateChanged event is triggered when the current lock state is changed
1695 /// <param name="sender"></param>
1696 /// <param name="e">A LockStateChangedEventArgs object that contains the key & changed value</param>
1697 public static event EventHandler<LockStateChangedEventArgs> LockStateChanged
1701 if (s_lockStateChanged == null)
1703 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LockState, s_lockStateChangedCallback, IntPtr.Zero);
1704 if (ret != SystemSettingsError.None)
1706 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1709 s_lockStateChanged += value;
1714 s_lockStateChanged -= value;
1715 if (s_lockStateChanged == null)
1717 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LockState);
1718 if (ret != SystemSettingsError.None)
1720 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");