2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 namespace Tizen.System
22 /// The System Settings API provides APIs for sharing configuration over a system
25 /// System Settings API provides functions for getting the system configuration related to user preferences.
26 /// The main features of the System Settings API include accessing system-wide configurations, such as ringtones, wallpapers, and etc
28 public static class SystemSettings
31 /// The file path of the current ringtone
33 public static string IncomingCallRingtone
38 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.IncomingCallRingtone, out filePath);
39 if (res != SystemSettingsError.None)
41 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get IncomingCallRingtone system setting value.");
47 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.IncomingCallRingtone, value);
48 if (res != SystemSettingsError.None)
50 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set IncomingCallRingtone system setting.");
56 /// The file path of the current home screen wallpaper
58 public static string WallpaperHomeScreen
63 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.WallpaperHomeScreen, out filePath);
64 if (res != SystemSettingsError.None)
66 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get WallpaperHomeScreen system setting value.");
72 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.WallpaperHomeScreen, value);
73 if (res != SystemSettingsError.None)
75 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set WallpaperHomeScreen system setting.");
81 /// The file path of the current lock screen wallpaper
83 public static string WallpaperLockScreen
88 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.WallpaperLockScreen, out filePath);
89 if (res != SystemSettingsError.None)
91 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get WallpaperLockScreen system setting value.");
97 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.WallpaperLockScreen, value);
98 if (res != SystemSettingsError.None)
100 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set WallpaperLockScreen system setting.");
106 /// The current system font size
108 public static SystemSettingsFontSize FontSize
113 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueInt(SystemSettingsKeys.FontSize, out fontSize);
114 if (res != SystemSettingsError.None)
116 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get FontSize system setting value.");
118 return (SystemSettingsFontSize)fontSize;
122 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueInt(SystemSettingsKeys.FontSize, (int)value);
123 if (res != SystemSettingsError.None)
125 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set FontSize system setting.");
131 /// The current system font type
133 public static string FontType
138 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.FontType, out fontType);
139 if (res != SystemSettingsError.None)
141 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get FontType system setting value.");
147 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.FontType, value);
148 if (res != SystemSettingsError.None)
150 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set FontType system setting.");
156 /// Indicates whether the motion service is activated
158 public static bool MotionActivationEnabled
162 bool isMotionServiceActivated;
163 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.MotionActivationEnabled, out isMotionServiceActivated);
164 if (res != SystemSettingsError.None)
166 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get MotionActivation system setting value.");
168 return isMotionServiceActivated;
172 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueBool(SystemSettingsKeys.MotionActivationEnabled, value);
173 if (res != SystemSettingsError.None)
175 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set MotionActivation system setting.");
181 /// The file path of the current email alert ringtone
183 public static string EmailAlertRingtone
188 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.EmailAlertRingtone, out filePath);
189 if (res != SystemSettingsError.None)
191 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get EmailAlertRingtone system setting value.");
197 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.EmailAlertRingtone, value);
198 if (res != SystemSettingsError.None)
200 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set EmailAlertRingtone system setting.");
205 /// Indicates whether the USB debugging is enabled
207 public static bool UsbDebuggingEnabled
211 bool isusbDebuggingEnabled;
212 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.UsbDebuggingEnabled, out isusbDebuggingEnabled);
213 if (res != SystemSettingsError.None)
215 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get UsbDebuggingEnabled system setting value.");
217 return isusbDebuggingEnabled;
221 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueBool(SystemSettingsKeys.UsbDebuggingEnabled, value);
222 if (res != SystemSettingsError.None)
224 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set UsbDebuggingEnabled system setting.");
230 /// Indicates whether the 3G data network is enabled
232 public static bool Data3GNetworkEnabled
236 bool is3GDataEnabled;
237 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.Data3GNetworkEnabled, out is3GDataEnabled);
238 if (res != SystemSettingsError.None)
240 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get Data3GNetworkEnabled system setting value.");
242 return is3GDataEnabled;
246 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueBool(SystemSettingsKeys.Data3GNetworkEnabled, value);
247 if (res != SystemSettingsError.None)
249 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set Data3GNetworkEnabled system setting.");
255 /// Indicates lockscreen app pkg name
257 public static string LockscreenApp
262 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.LockscreenApp, out pkgName);
263 if (res != SystemSettingsError.None)
265 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get LockscreenApp system setting value.");
271 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.LockscreenApp, value);
272 if (res != SystemSettingsError.None)
274 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set LockscreenApp system setting.");
280 /// The current system default font type (only support Get)
282 public static string DefaultFontType
286 string defaultFontType;
287 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.DefaultFontType, out defaultFontType);
288 if (res != SystemSettingsError.None)
290 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get DefaultFontType system setting value.");
292 return defaultFontType;
297 /// Indicates the current country setting in the \<LANGUAGE\>_\<REGION\> syntax.
298 /// The country setting is in the ISO 639-2 format,
299 /// and the region setting is in the ISO 3166-1 alpha-2 format
301 public static string LocaleCountry
305 string countrySetting;
306 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.LocaleCountry, out countrySetting);
307 if (res != SystemSettingsError.None)
309 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get LocaleCountry system setting value.");
311 return countrySetting;
315 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.LocaleCountry, value);
316 if (res != SystemSettingsError.None)
318 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set LocaleCountry system setting.");
324 /// Indicates the current language setting in the \<LANGUAGE\>_\<REGION\> syntax.
325 /// The language setting is in the ISO 639-2 format
326 /// and the region setting is in the ISO 3166-1 alpha-2 format.
328 public static string LocaleLanguage
332 string languageSetting;
333 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.LocaleLanguage, out languageSetting);
334 if (res != SystemSettingsError.None)
336 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get LocaleLanguage system setting value.");
338 return languageSetting;
342 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.LocaleLanguage, value);
343 if (res != SystemSettingsError.None)
345 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set LocaleLanguage system setting.");
351 /// Indicates whether the 24-hour clock is used.
352 /// If the value is false, the 12-hour clock is used.
354 public static bool LocaleTimeFormat24HourEnabled
359 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.LocaleTimeFormat24HourEnabled, out is24HrFormat);
360 if (res != SystemSettingsError.None)
362 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get LocaleTimeFormat24Hour system setting value.");
368 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueBool(SystemSettingsKeys.LocaleTimeFormat24HourEnabled, value);
369 if (res != SystemSettingsError.None)
371 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set LocaleTimeFormat24Hour system setting.");
377 /// Indicates the current time zone. Eg. "Pacific/Tahiti"
379 public static string LocaleTimeZone
384 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.LocaleTimeZone, out timeZone);
385 if (res != SystemSettingsError.None)
387 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get LocaleTimeZone system setting value.");
393 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.LocaleTimeZone, value);
394 if (res != SystemSettingsError.None)
396 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set LocaleTimeZone system setting.");
401 /// Indicates whether the screen lock sound is enabled on the device. ex) LCD on/off sound
403 public static bool SoundLockEnabled
407 bool isSoundLockEnabled;
408 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.SoundLockEnabled, out isSoundLockEnabled);
409 if (res != SystemSettingsError.None)
411 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get SoundLock system setting value.");
413 return isSoundLockEnabled;
418 /// Indicates whether the device is in the silent mode.
420 public static bool SoundSilentModeEnabled
425 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.SoundSilentModeEnabled, out isSilent);
426 if (res != SystemSettingsError.None)
428 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get SoundSilentMode system setting value.");
435 /// Indicates whether the screen touch sound is enabled on the device.
437 public static bool SoundTouchEnabled
441 bool isTouchSoundEnabled;
442 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.SoundTouchEnabled, out isTouchSoundEnabled);
443 if (res != SystemSettingsError.None)
445 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get SoundTouch system setting value.");
447 return isTouchSoundEnabled;
452 /// Indicates whether rotation control is automatic.
454 public static bool DisplayScreenRotationAutoEnabled
458 bool isRotationAutomatic;
459 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.DisplayScreenRotationAutoEnabled, out isRotationAutomatic);
460 if (res != SystemSettingsError.None)
462 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get DisplayScreenRotationAuto system setting value.");
464 return isRotationAutomatic;
469 /// Indicates device name.
471 public static string DeviceName
476 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.DeviceName, out deviceName);
477 if (res != SystemSettingsError.None)
479 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get DeviceName system setting value.");
485 /// Indicates whether the device user has enabled motion feature.
487 public static bool MotionEnabled
491 bool isMotionEnabled;
492 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.MotionEnabled, out isMotionEnabled);
493 if (res != SystemSettingsError.None)
495 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get MotionEnabled system setting value.");
497 return isMotionEnabled;
502 /// Indicates whether Wi-Fi-related notifications are enabled on the device.
504 public static bool NetworkWifiNotificationEnabled
508 bool isWifiNotificationEnabled;
509 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.NetworkWifiNotificationEnabled, out isWifiNotificationEnabled);
510 if (res != SystemSettingsError.None)
512 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get NetworkWifiNotification system setting value.");
514 return isWifiNotificationEnabled;
519 /// Indicates whether the device is in the flight mode.
521 public static bool NetworkFlightModeEnabled
525 bool isFlightModeEnabled;
526 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.NetworkFlightModeEnabled, out isFlightModeEnabled);
527 if (res != SystemSettingsError.None)
529 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get NetworkFlightMode system setting value.");
531 return isFlightModeEnabled;
536 /// Indicates the backlight time (in seconds). The following values can be used: 15, 30, 60, 120, 300, and 600.
538 public static int ScreenBacklightTime
543 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueInt(SystemSettingsKeys.ScreenBacklightTime, out backlightTime);
544 if (res != SystemSettingsError.None)
546 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get ScreenBacklightTime system setting value.");
548 return backlightTime;
552 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueInt(SystemSettingsKeys.ScreenBacklightTime, value);
553 if (res != SystemSettingsError.None)
555 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set ScreenBacklightTime system setting.");
561 /// Indicates the file path of the current notification tone set by the user.
563 public static string SoundNotification
568 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.SoundNotification, out filePath);
569 if (res != SystemSettingsError.None)
571 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get SoundNotification system setting value.");
577 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.SoundNotification, value);
578 if (res != SystemSettingsError.None)
580 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set SoundNotification system setting.");
586 /// Indicates the time period for notification repetitions.
588 public static int SoundNotificationRepetitionPeriod
592 int notificationRepetitionPeriod;
593 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueInt(SystemSettingsKeys.SoundNotificationRepetitionPeriod, out notificationRepetitionPeriod);
594 if (res != SystemSettingsError.None)
596 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get SoundNotificationRepetitionPeriod system setting value.");
598 return notificationRepetitionPeriod;
602 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueInt(SystemSettingsKeys.SoundNotificationRepetitionPeriod, value);
603 if (res != SystemSettingsError.None)
605 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set SoundNotificationRepetitionPeriod system setting.");
611 /// Indicates the current lock state
613 public static SystemSettingsIdleLockState LockState
618 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueInt(SystemSettingsKeys.LockState, out LockState);
619 if (res != SystemSettingsError.None)
621 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get LockState system setting value.");
623 return (SystemSettingsIdleLockState)LockState;
627 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueInt(SystemSettingsKeys.LockState, (int)value);
628 if (res != SystemSettingsError.None)
630 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set LockState system setting.");
635 private static readonly Interop.Settings.SystemSettingsChangedCallback s_incomingCallRingtoneChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
637 string path = SystemSettings.IncomingCallRingtone;
638 IncomingCallRingtoneChangedEventArgs eventArgs = new IncomingCallRingtoneChangedEventArgs(path);
639 s_incomingCallRingtoneChanged?.Invoke(null, eventArgs);
641 private static event EventHandler<IncomingCallRingtoneChangedEventArgs> s_incomingCallRingtoneChanged;
643 /// IncomingCallRingtoneChanged event is triggered when the file path of the incoming ringtone is changed
645 /// <param name="sender"></param>
646 /// <param name="e">A IncomingCallRingtoneChangedEventArgs object that contains the key & changed value</param>
647 public static event EventHandler<IncomingCallRingtoneChangedEventArgs> IncomingCallRingtoneChanged
651 if (s_incomingCallRingtoneChanged == null)
653 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.IncomingCallRingtone, s_incomingCallRingtoneChangedCallback, IntPtr.Zero);
654 if (ret != SystemSettingsError.None)
656 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
659 s_incomingCallRingtoneChanged += value;
664 s_incomingCallRingtoneChanged -= value;
665 if (s_incomingCallRingtoneChanged == null)
667 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.IncomingCallRingtone);
668 if (ret != SystemSettingsError.None)
670 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
676 private static readonly Interop.Settings.SystemSettingsChangedCallback s_wallpaperHomeScreenChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
678 string path = SystemSettings.WallpaperHomeScreen;
679 WallpaperHomeScreenChangedEventArgs eventArgs = new WallpaperHomeScreenChangedEventArgs(path);
680 s_wallpaperHomeScreenChanged?.Invoke(null, eventArgs);
682 private static event EventHandler<WallpaperHomeScreenChangedEventArgs> s_wallpaperHomeScreenChanged;
684 /// WallpaperHomeScreenChanged event is triggered when the file path of the current home screen wallpaper is changed
686 /// <param name="sender"></param>
687 /// <param name="e">A WallpaperHomeScreenChangedEventArgs object that contains the key & changed value</param>
688 public static event EventHandler<WallpaperHomeScreenChangedEventArgs> WallpaperHomeScreenChanged
692 if (s_wallpaperHomeScreenChanged == null)
694 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.WallpaperHomeScreen, s_wallpaperHomeScreenChangedCallback, IntPtr.Zero);
695 if (ret != SystemSettingsError.None)
697 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
700 s_wallpaperHomeScreenChanged += value;
705 s_wallpaperHomeScreenChanged -= value;
706 if (s_wallpaperHomeScreenChanged == null)
708 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.WallpaperHomeScreen);
709 if (ret != SystemSettingsError.None)
711 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
717 private static readonly Interop.Settings.SystemSettingsChangedCallback s_wallpaperLockScreenChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
719 string path = SystemSettings.WallpaperLockScreen;
720 WallpaperLockScreenChangedEventArgs eventArgs = new WallpaperLockScreenChangedEventArgs(path);
721 s_wallpaperLockScreenChanged?.Invoke(null, eventArgs);
723 private static event EventHandler<WallpaperLockScreenChangedEventArgs> s_wallpaperLockScreenChanged;
725 /// WallpaperLockScreenChanged event is triggered when the file path of the current lock screen wallpaper is changed
727 /// <param name="sender"></param>
728 /// <param name="e">A WallpaperLockScreenChangedEventArgs object that contains the key & changed value</param>
729 public static event EventHandler<WallpaperLockScreenChangedEventArgs> WallpaperLockScreenChanged
733 if (s_wallpaperLockScreenChanged == null)
735 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.WallpaperLockScreen, s_wallpaperLockScreenChangedCallback, IntPtr.Zero);
736 if (ret != SystemSettingsError.None)
738 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
741 s_wallpaperLockScreenChanged += value;
746 s_wallpaperLockScreenChanged -= value;
747 if (s_wallpaperLockScreenChanged == null)
749 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.WallpaperLockScreen);
750 if (ret != SystemSettingsError.None)
752 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
758 private static readonly Interop.Settings.SystemSettingsChangedCallback s_fontSizeChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
760 SystemSettingsFontSize fontSize = SystemSettings.FontSize;
761 FontSizeChangedEventArgs eventArgs = new FontSizeChangedEventArgs(fontSize);
762 s_fontSizeChanged?.Invoke(null, eventArgs);
764 private static event EventHandler<FontSizeChangedEventArgs> s_fontSizeChanged;
766 /// FontSizeChanged event is triggered when the current system font size is changed
768 /// <param name="sender"></param>
769 /// <param name="e">A FontSizeChangedEventArgs object that contains the key & changed value</param>
770 public static event EventHandler<FontSizeChangedEventArgs> FontSizeChanged
774 if (s_fontSizeChanged == null)
776 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.FontSize, s_fontSizeChangedCallback, IntPtr.Zero);
777 if (ret != SystemSettingsError.None)
779 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
782 s_fontSizeChanged += value;
787 s_fontSizeChanged -= value;
788 if (s_fontSizeChanged == null)
790 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.FontSize);
791 if (ret != SystemSettingsError.None)
793 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
799 private static readonly Interop.Settings.SystemSettingsChangedCallback s_fontTypeChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
801 string fontType = SystemSettings.FontType;
802 FontTypeChangedEventArgs eventArgs = new FontTypeChangedEventArgs(fontType);
803 s_fontTypeChanged?.Invoke(null, eventArgs);
805 private static event EventHandler<FontTypeChangedEventArgs> s_fontTypeChanged;
807 /// FontTypeChanged event is triggered when the current system font type is changed
809 /// <param name="sender"></param>
810 /// <param name="e">A FontTypeChangedEventArgs object that contains the key & changed value</param>
811 public static event EventHandler<FontTypeChangedEventArgs> FontTypeChanged
815 if (s_fontTypeChanged == null)
817 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.FontType, s_fontTypeChangedCallback, IntPtr.Zero);
818 if (ret != SystemSettingsError.None)
820 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
823 s_fontTypeChanged += value;
828 s_fontTypeChanged -= value;
829 if (s_fontTypeChanged == null)
831 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.FontType);
832 if (ret != SystemSettingsError.None)
834 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
840 private static readonly Interop.Settings.SystemSettingsChangedCallback s_motionActivationChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
842 bool motionActivation = SystemSettings.MotionActivationEnabled;
843 MotionActivationSettingChangedEventArgs eventArgs = new MotionActivationSettingChangedEventArgs(motionActivation);
844 s_motionActivationChanged?.Invoke(null, eventArgs);
846 private static event EventHandler<MotionActivationSettingChangedEventArgs> s_motionActivationChanged;
848 /// MotionActivationChanged event is triggered when the motion service status is changed
850 /// <param name="sender"></param>
851 /// <param name="e">A MotionActivationChangedEventArgs object that contains the key & changed value</param>
852 public static event EventHandler<MotionActivationSettingChangedEventArgs> MotionActivationSettingChanged
856 if (s_motionActivationChanged == null)
858 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.MotionActivationEnabled, s_motionActivationChangedCallback, IntPtr.Zero);
859 if (ret != SystemSettingsError.None)
861 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
864 s_motionActivationChanged += value;
869 s_motionActivationChanged -= value;
870 if (s_motionActivationChanged == null)
872 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.MotionActivationEnabled);
873 if (ret != SystemSettingsError.None)
875 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
881 private static readonly Interop.Settings.SystemSettingsChangedCallback s_emailAlertRingtoneChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
883 string emailAlertRingtone = SystemSettings.EmailAlertRingtone;
884 EmailAlertRingtoneChangedEventArgs eventArgs = new EmailAlertRingtoneChangedEventArgs(emailAlertRingtone);
885 s_emailAlertRingtoneChanged?.Invoke(null, eventArgs);
887 private static event EventHandler<EmailAlertRingtoneChangedEventArgs> s_emailAlertRingtoneChanged;
889 /// EmailAlertRingtoneChanged event is triggered when the file path of the current email alert ringtone is changed
891 /// <param name="sender"></param>
892 /// <param name="e">A EmailAlertRingtoneChangedEventArgs object that contains the key & changed value</param>
893 public static event EventHandler<EmailAlertRingtoneChangedEventArgs> EmailAlertRingtoneChanged
897 if (s_emailAlertRingtoneChanged == null)
899 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.EmailAlertRingtone, s_emailAlertRingtoneChangedCallback, IntPtr.Zero);
900 if (ret != SystemSettingsError.None)
902 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
905 s_emailAlertRingtoneChanged += value;
910 s_emailAlertRingtoneChanged -= value;
911 if (s_emailAlertRingtoneChanged == null)
913 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.EmailAlertRingtone);
914 if (ret != SystemSettingsError.None)
916 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
922 private static readonly Interop.Settings.SystemSettingsChangedCallback s_usbDebuggingSettingChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
924 bool usbDebuggingEnabled = SystemSettings.UsbDebuggingEnabled;
925 UsbDebuggingSettingChangedEventArgs eventArgs = new UsbDebuggingSettingChangedEventArgs(usbDebuggingEnabled);
926 s_usbDebuggingSettingChanged?.Invoke(null, eventArgs);
928 private static event EventHandler<UsbDebuggingSettingChangedEventArgs> s_usbDebuggingSettingChanged;
930 /// UsbDebuggingSettingChangedEventArgs event is triggered when the USB debugging status is changed
932 /// <param name="sender"></param>
933 /// <param name="e">A UsbDebuggingSettingChangedEventArgs object that contains the key & changed value</param>
934 public static event EventHandler<UsbDebuggingSettingChangedEventArgs> UsbDebuggingSettingChanged
938 if (s_usbDebuggingSettingChanged == null)
940 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.UsbDebuggingEnabled, s_usbDebuggingSettingChangedCallback, IntPtr.Zero);
941 if (ret != SystemSettingsError.None)
943 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
946 s_usbDebuggingSettingChanged += value;
951 s_usbDebuggingSettingChanged -= value;
952 if (s_usbDebuggingSettingChanged == null)
954 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.UsbDebuggingEnabled);
955 if (ret != SystemSettingsError.None)
957 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
963 private static readonly Interop.Settings.SystemSettingsChangedCallback s_data3GNetworkSettingChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
965 bool data3GEnabled = SystemSettings.Data3GNetworkEnabled;
966 Data3GNetworkSettingChangedEventArgs eventArgs = new Data3GNetworkSettingChangedEventArgs(data3GEnabled);
967 s_data3GNetworkSettingChanged?.Invoke(null, eventArgs);
969 private static event EventHandler<Data3GNetworkSettingChangedEventArgs> s_data3GNetworkSettingChanged;
971 /// Data3GNetworkSettingChanged event is triggered when the 3G data network status is changed
973 /// <param name="sender"></param>
974 /// <param name="e">A Data3GNetworkSettingChangedEventArgs object that contains the key & changed value</param>
975 public static event EventHandler<Data3GNetworkSettingChangedEventArgs> Data3GNetworkSettingChanged
979 if (s_data3GNetworkSettingChanged == null)
981 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.Data3GNetworkEnabled, s_data3GNetworkSettingChangedCallback, IntPtr.Zero);
982 if (ret != SystemSettingsError.None)
984 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
987 s_data3GNetworkSettingChanged += value;
992 s_data3GNetworkSettingChanged -= value;
993 if (s_data3GNetworkSettingChanged == null)
995 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.Data3GNetworkEnabled);
996 if (ret != SystemSettingsError.None)
998 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1004 private static readonly Interop.Settings.SystemSettingsChangedCallback s_lockscreenAppChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1006 string lockScreenApp = SystemSettings.LockscreenApp;
1007 LockscreenAppChangedEventArgs eventArgs = new LockscreenAppChangedEventArgs(lockScreenApp);
1008 s_lockscreenAppChanged?.Invoke(null, eventArgs);
1010 private static event EventHandler<LockscreenAppChangedEventArgs> s_lockscreenAppChanged;
1012 /// LockscreenAppChanged event is triggered when the lockscreen app pkg name is changed
1014 /// <param name="sender"></param>
1015 /// <param name="e">A LockscreenAppChangedEventArgs object that contains the key & changed value</param>
1016 public static event EventHandler<LockscreenAppChangedEventArgs> LockscreenAppChanged
1020 if (s_lockscreenAppChanged == null)
1022 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LockscreenApp, s_lockscreenAppChangedCallback, IntPtr.Zero);
1023 if (ret != SystemSettingsError.None)
1025 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1028 s_lockscreenAppChanged += value;
1033 s_lockscreenAppChanged -= value;
1034 if (s_lockscreenAppChanged == null)
1036 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LockscreenApp);
1037 if (ret != SystemSettingsError.None)
1039 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1045 private static readonly Interop.Settings.SystemSettingsChangedCallback s_localeCountryChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1047 string localeCountry = SystemSettings.LocaleCountry;
1048 LocaleCountryChangedEventArgs eventArgs = new LocaleCountryChangedEventArgs(localeCountry);
1049 s_localeCountryChanged?.Invoke(null, eventArgs);
1051 private static event EventHandler<LocaleCountryChangedEventArgs> s_localeCountryChanged;
1053 /// LocaleCountryChanged event is triggered when the current country setting in the \<LANGUAGE\>_\<REGION\> syntax, is changed
1055 /// <param name="sender"></param>
1056 /// <param name="e">A LocaleCountryChangedEventArgs object that contains the key & changed value</param>
1057 public static event EventHandler<LocaleCountryChangedEventArgs> LocaleCountryChanged
1061 if (s_localeCountryChanged == null)
1063 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LocaleCountry, s_localeCountryChangedCallback, IntPtr.Zero);
1064 if (ret != SystemSettingsError.None)
1066 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1069 s_localeCountryChanged += value;
1074 s_localeCountryChanged -= value;
1075 if (s_localeCountryChanged == null)
1077 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LocaleCountry);
1078 if (ret != SystemSettingsError.None)
1080 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1086 private static readonly Interop.Settings.SystemSettingsChangedCallback s_localeLanguageChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1088 string localeLanguage = SystemSettings.LocaleLanguage;
1089 LocaleLanguageChangedEventArgs eventArgs = new LocaleLanguageChangedEventArgs(localeLanguage);
1090 s_localeLanguageChanged?.Invoke(null, eventArgs);
1092 private static event EventHandler<LocaleLanguageChangedEventArgs> s_localeLanguageChanged;
1094 /// LocaleLanguageChanged event is triggered when the current language setting in the \<LANGUAGE\>_\<REGION\> syntax, is changed
1096 /// <param name="sender"></param>
1097 /// <param name="e">A LocaleLanguageChangedEventArgs object that contains the key & changed value</param>
1098 public static event EventHandler<LocaleLanguageChangedEventArgs> LocaleLanguageChanged
1102 if (s_localeLanguageChanged == null)
1104 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LocaleLanguage, s_localeLanguageChangedCallback, IntPtr.Zero);
1105 if (ret != SystemSettingsError.None)
1107 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1110 s_localeLanguageChanged += value;
1115 s_localeLanguageChanged -= value;
1116 if (s_localeLanguageChanged == null)
1118 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LocaleLanguage);
1119 if (ret != SystemSettingsError.None)
1121 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1127 private static readonly Interop.Settings.SystemSettingsChangedCallback s_localeTimeFormat24HourChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1129 bool localeTimeFormat24Hour = SystemSettings.LocaleTimeFormat24HourEnabled;
1130 LocaleTimeFormat24HourSettingChangedEventArgs eventArgs = new LocaleTimeFormat24HourSettingChangedEventArgs(localeTimeFormat24Hour);
1131 s_localeTimeFormat24HourChanged?.Invoke(null, eventArgs);
1133 private static event EventHandler<LocaleTimeFormat24HourSettingChangedEventArgs> s_localeTimeFormat24HourChanged;
1135 /// LocaleTimeFormat24HourChanged event is triggered when the time format is changed
1137 /// <param name="sender"></param>
1138 /// <param name="e">A LocaleTimeFormat24HourChangedEventArgs object that contains the key & changed value</param>
1139 public static event EventHandler<LocaleTimeFormat24HourSettingChangedEventArgs> LocaleTimeFormat24HourSettingChanged
1143 if (s_localeTimeFormat24HourChanged == null)
1145 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LocaleTimeFormat24HourEnabled, s_localeTimeFormat24HourChangedCallback, IntPtr.Zero);
1146 if (ret != SystemSettingsError.None)
1148 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1151 s_localeTimeFormat24HourChanged += value;
1156 s_localeTimeFormat24HourChanged -= value;
1157 if (s_localeTimeFormat24HourChanged == null)
1159 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LocaleTimeFormat24HourEnabled);
1160 if (ret != SystemSettingsError.None)
1162 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1168 private static readonly Interop.Settings.SystemSettingsChangedCallback s_localeTimeZoneChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1170 string localeTimeZone = SystemSettings.LocaleTimeZone;
1171 LocaleTimeZoneChangedEventArgs eventArgs = new LocaleTimeZoneChangedEventArgs(localeTimeZone);
1172 s_localeTimeZoneChanged?.Invoke(null, eventArgs);
1174 private static event EventHandler<LocaleTimeZoneChangedEventArgs> s_localeTimeZoneChanged;
1176 /// LocaleTimeZoneChanged event is triggered when the current time zone is changed
1178 /// <param name="sender"></param>
1179 /// <param name="e">A LocaleTimeZoneChangedEventArgs object that contains the key & changed value</param>
1180 public static event EventHandler<LocaleTimeZoneChangedEventArgs> LocaleTimeZoneChanged
1184 if (s_localeTimeZoneChanged == null)
1186 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LocaleTimeZone, s_localeTimeZoneChangedCallback, IntPtr.Zero);
1187 if (ret != SystemSettingsError.None)
1189 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1192 s_localeTimeZoneChanged += value;
1197 s_localeTimeZoneChanged -= value;
1198 if (s_localeTimeZoneChanged == null)
1200 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LocaleTimeZone);
1201 if (ret != SystemSettingsError.None)
1203 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1209 private static readonly Interop.Settings.SystemSettingsChangedCallback s_timeChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1211 //bool motionActivation = SystemSettings.Time;
1212 TimeChangedEventArgs eventArgs = new TimeChangedEventArgs();
1213 s_timeChanged?.Invoke(null, eventArgs);
1215 private static event EventHandler<TimeChangedEventArgs> s_timeChanged;
1217 /// TimeChanged event is triggered when the system time is changed
1219 /// <param name="sender"></param>
1220 /// <param name="e">A TimeChangedEventArgs object that contains the key & changed value</param>
1221 public static event EventHandler<TimeChangedEventArgs> TimeChanged
1225 if (s_timeChanged == null)
1227 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.Time, s_timeChangedCallback, IntPtr.Zero);
1228 if (ret != SystemSettingsError.None)
1230 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1233 s_timeChanged += value;
1238 s_timeChanged -= value;
1239 if (s_timeChanged == null)
1241 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.Time);
1242 if (ret != SystemSettingsError.None)
1244 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1250 private static readonly Interop.Settings.SystemSettingsChangedCallback s_soundLockChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1252 bool soundLock = SystemSettings.SoundLockEnabled;
1253 SoundLockSettingChangedEventArgs eventArgs = new SoundLockSettingChangedEventArgs(soundLock);
1254 s_soundLockChanged?.Invoke(null, eventArgs);
1256 private static event EventHandler<SoundLockSettingChangedEventArgs> s_soundLockChanged;
1258 /// SoundLockChanged event is triggered when the screen lock sound enabled status is changed
1260 /// <param name="sender"></param>
1261 /// <param name="e">A SoundLockChangedEventArgs object that contains the key & changed value</param>
1262 public static event EventHandler<SoundLockSettingChangedEventArgs> SoundLockSettingChanged
1266 if (s_soundLockChanged == null)
1268 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.SoundLockEnabled, s_soundLockChangedCallback, IntPtr.Zero);
1269 if (ret != SystemSettingsError.None)
1271 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1274 s_soundLockChanged += value;
1279 s_soundLockChanged -= value;
1280 if (s_soundLockChanged == null)
1282 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.SoundLockEnabled);
1283 if (ret != SystemSettingsError.None)
1285 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1291 private static readonly Interop.Settings.SystemSettingsChangedCallback s_soundSilentModeChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1293 bool soundSilentMode = SystemSettings.SoundSilentModeEnabled;
1294 SoundSilentModeSettingChangedEventArgs eventArgs = new SoundSilentModeSettingChangedEventArgs(soundSilentMode);
1295 s_soundSilentModeChanged?.Invoke(null, eventArgs);
1297 private static event EventHandler<SoundSilentModeSettingChangedEventArgs> s_soundSilentModeChanged;
1299 /// SoundSilentModeChanged event is triggered when the silent mode status is changed
1301 /// <param name="sender"></param>
1302 /// <param name="e">A SoundSilentModeChangedEventArgs object that contains the key & changed value</param>
1303 public static event EventHandler<SoundSilentModeSettingChangedEventArgs> SoundSilentModeSettingChanged
1307 if (s_soundSilentModeChanged == null)
1309 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.SoundSilentModeEnabled, s_soundSilentModeChangedCallback, IntPtr.Zero);
1310 if (ret != SystemSettingsError.None)
1312 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1315 s_soundSilentModeChanged += value;
1320 s_soundSilentModeChanged -= value;
1321 if (s_soundSilentModeChanged == null)
1323 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.SoundSilentModeEnabled);
1324 if (ret != SystemSettingsError.None)
1326 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1332 private static readonly Interop.Settings.SystemSettingsChangedCallback s_soundTouchChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1334 bool soundTouch = SystemSettings.SoundTouchEnabled;
1335 SoundTouchSettingChangedEventArgs eventArgs = new SoundTouchSettingChangedEventArgs(soundTouch);
1336 s_soundTouchChanged?.Invoke(null, eventArgs);
1338 private static event EventHandler<SoundTouchSettingChangedEventArgs> s_soundTouchChanged;
1340 /// SoundTouchChanged event is triggered when the screen touch sound enabled status is changed
1342 /// <param name="sender"></param>
1343 /// <param name="e">A SoundTouchChangedEventArgs object that contains the key & changed value</param>
1344 public static event EventHandler<SoundTouchSettingChangedEventArgs> SoundTouchSettingChanged
1348 if (s_soundTouchChanged == null)
1350 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.SoundTouchEnabled, s_soundTouchChangedCallback, IntPtr.Zero);
1351 if (ret != SystemSettingsError.None)
1353 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1356 s_soundTouchChanged += value;
1361 s_soundTouchChanged -= value;
1362 if (s_soundTouchChanged == null)
1364 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.SoundTouchEnabled);
1365 if (ret != SystemSettingsError.None)
1367 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1373 private static readonly Interop.Settings.SystemSettingsChangedCallback s_displayScreenRotationAutoChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1375 bool displayScreenRotationAuto = SystemSettings.DisplayScreenRotationAutoEnabled;
1376 DisplayScreenRotationAutoSettingChangedEventArgs eventArgs = new DisplayScreenRotationAutoSettingChangedEventArgs(displayScreenRotationAuto);
1377 s_displayScreenRotationAutoChanged?.Invoke(null, eventArgs);
1379 private static event EventHandler<DisplayScreenRotationAutoSettingChangedEventArgs> s_displayScreenRotationAutoChanged;
1381 /// DisplayScreenRotationAutoChanged event is triggered when the automatic rotation control status is changed
1383 /// <param name="sender"></param>
1384 /// <param name="e">A DisplayScreenRotationAutoChangedEventArgs object that contains the key & changed value</param>
1385 public static event EventHandler<DisplayScreenRotationAutoSettingChangedEventArgs> DisplayScreenRotationAutoSettingChanged
1389 if (s_displayScreenRotationAutoChanged == null)
1391 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.DisplayScreenRotationAutoEnabled, s_displayScreenRotationAutoChangedCallback, IntPtr.Zero);
1392 if (ret != SystemSettingsError.None)
1394 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1397 s_displayScreenRotationAutoChanged += value;
1402 s_displayScreenRotationAutoChanged -= value;
1403 if (s_displayScreenRotationAutoChanged == null)
1405 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.DisplayScreenRotationAutoEnabled);
1406 if (ret != SystemSettingsError.None)
1408 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1414 private static readonly Interop.Settings.SystemSettingsChangedCallback s_deviceNameChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1416 string deviceName = SystemSettings.DeviceName;
1417 DeviceNameChangedEventArgs eventArgs = new DeviceNameChangedEventArgs(deviceName);
1418 s_deviceNameChanged?.Invoke(null, eventArgs);
1420 private static event EventHandler<DeviceNameChangedEventArgs> s_deviceNameChanged;
1422 /// DeviceNameChanged event is triggered when the device name is changed
1424 /// <param name="sender"></param>
1425 /// <param name="e">A DeviceNameChangedEventArgs object that contains the key & changed value</param>
1426 public static event EventHandler<DeviceNameChangedEventArgs> DeviceNameChanged
1430 if (s_deviceNameChanged == null)
1432 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.DeviceName, s_deviceNameChangedCallback, IntPtr.Zero);
1433 if (ret != SystemSettingsError.None)
1435 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1438 s_deviceNameChanged += value;
1443 s_deviceNameChanged -= value;
1444 if (s_deviceNameChanged == null)
1446 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.DeviceName);
1447 if (ret != SystemSettingsError.None)
1449 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1455 private static readonly Interop.Settings.SystemSettingsChangedCallback s_motionSettingChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1457 bool motionEnabled = SystemSettings.MotionEnabled;
1458 MotionSettingChangedEventArgs eventArgs = new MotionSettingChangedEventArgs(motionEnabled);
1459 s_motionSettingChanged?.Invoke(null, eventArgs);
1461 private static event EventHandler<MotionSettingChangedEventArgs> s_motionSettingChanged;
1463 /// MotionSettingChanged event is triggered when the motion feature enabled status is changed
1465 /// <param name="sender"></param>
1466 /// <param name="e">A MotionSettingChangedEventArgs object that contains the key & changed value</param>
1467 public static event EventHandler<MotionSettingChangedEventArgs> MotionSettingChanged
1471 if (s_motionSettingChanged == null)
1473 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.MotionEnabled, s_motionSettingChangedCallback, IntPtr.Zero);
1474 if (ret != SystemSettingsError.None)
1476 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1479 s_motionSettingChanged += value;
1484 s_motionSettingChanged -= value;
1485 if (s_motionSettingChanged == null)
1487 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.MotionEnabled);
1488 if (ret != SystemSettingsError.None)
1490 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1496 private static readonly Interop.Settings.SystemSettingsChangedCallback s_networkWifiNotificationChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1498 bool networkWifiNotification = SystemSettings.NetworkWifiNotificationEnabled;
1499 NetworkWifiNotificationSettingChangedEventArgs eventArgs = new NetworkWifiNotificationSettingChangedEventArgs(networkWifiNotification);
1500 s_networkWifiNotificationChanged?.Invoke(null, eventArgs);
1502 private static event EventHandler<NetworkWifiNotificationSettingChangedEventArgs> s_networkWifiNotificationChanged;
1504 /// NetworkWifiNotificationChanged event is triggered when the Wi-Fi-related notifications enabled status is changed
1506 /// <param name="sender"></param>
1507 /// <param name="e">A NetworkWifiNotificationChangedEventArgs object that contains the key & changed value</param>
1508 public static event EventHandler<NetworkWifiNotificationSettingChangedEventArgs> NetworkWifiNotificationSettingChanged
1512 if (s_networkWifiNotificationChanged == null)
1514 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.NetworkWifiNotificationEnabled, s_networkWifiNotificationChangedCallback, IntPtr.Zero);
1515 if (ret != SystemSettingsError.None)
1517 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1520 s_networkWifiNotificationChanged += value;
1525 s_networkWifiNotificationChanged -= value;
1526 if (s_networkWifiNotificationChanged == null)
1528 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.NetworkWifiNotificationEnabled);
1529 if (ret != SystemSettingsError.None)
1531 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1537 private static readonly Interop.Settings.SystemSettingsChangedCallback s_networkFlightModeChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1539 bool networkFlightMode = SystemSettings.NetworkFlightModeEnabled;
1540 NetworkFlightModeSettingChangedEventArgs eventArgs = new NetworkFlightModeSettingChangedEventArgs(networkFlightMode);
1541 s_networkFlightModeChanged?.Invoke(null, eventArgs);
1543 private static event EventHandler<NetworkFlightModeSettingChangedEventArgs> s_networkFlightModeChanged;
1545 /// NetworkFlightModeChanged event is triggered when the flight mode status is changed
1547 /// <param name="sender"></param>
1548 /// <param name="e">A NetworkFlightModeChangedEventArgs object that contains the key & changed value</param>
1549 public static event EventHandler<NetworkFlightModeSettingChangedEventArgs> NetworkFlightModeSettingChanged
1553 if (s_networkFlightModeChanged == null)
1555 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.NetworkFlightModeEnabled, s_networkFlightModeChangedCallback, IntPtr.Zero);
1556 if (ret != SystemSettingsError.None)
1558 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1561 s_networkFlightModeChanged += value;
1566 s_networkFlightModeChanged -= value;
1567 if (s_networkFlightModeChanged == null)
1569 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.NetworkFlightModeEnabled);
1570 if (ret != SystemSettingsError.None)
1572 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1578 private static readonly Interop.Settings.SystemSettingsChangedCallback s_screenBacklightTimeChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1580 int screenBacklightTime = SystemSettings.ScreenBacklightTime;
1581 ScreenBacklightTimeChangedEventArgs eventArgs = new ScreenBacklightTimeChangedEventArgs(screenBacklightTime);
1582 s_screenBacklightTimeChanged?.Invoke(null, eventArgs);
1584 private static event EventHandler<ScreenBacklightTimeChangedEventArgs> s_screenBacklightTimeChanged;
1586 /// ScreenBacklightTimeChanged event is triggered when the backlight time is changed.
1588 /// <param name="sender"></param>
1589 /// <param name="e">A ScreenBacklightTimeChangedEventArgs object that contains the key & changed value</param>
1590 public static event EventHandler<ScreenBacklightTimeChangedEventArgs> ScreenBacklightTimeChanged
1594 if (s_screenBacklightTimeChanged == null)
1596 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.ScreenBacklightTime, s_screenBacklightTimeChangedCallback, IntPtr.Zero);
1597 if (ret != SystemSettingsError.None)
1599 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1602 s_screenBacklightTimeChanged += value;
1607 s_screenBacklightTimeChanged -= value;
1608 if (s_screenBacklightTimeChanged == null)
1610 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.ScreenBacklightTime);
1611 if (ret != SystemSettingsError.None)
1613 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1619 private static readonly Interop.Settings.SystemSettingsChangedCallback s_soundNotificationChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1621 string soundNotification = SystemSettings.SoundNotification;
1622 SoundNotificationChangedEventArgs eventArgs = new SoundNotificationChangedEventArgs(soundNotification);
1623 s_soundNotificationChanged?.Invoke(null, eventArgs);
1625 private static event EventHandler<SoundNotificationChangedEventArgs> s_soundNotificationChanged;
1627 /// SoundNotificationChanged event is triggered when the file path of the current notification tone set by the user is changed
1629 /// <param name="sender"></param>
1630 /// <param name="e">A SoundNotificationChangedEventArgs object that contains the key & changed value</param>
1631 public static event EventHandler<SoundNotificationChangedEventArgs> SoundNotificationChanged
1635 if (s_soundNotificationChanged == null)
1637 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.SoundNotification, s_soundNotificationChangedCallback, IntPtr.Zero);
1638 if (ret != SystemSettingsError.None)
1640 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1643 s_soundNotificationChanged += value;
1648 s_soundNotificationChanged -= value;
1649 if (s_soundNotificationChanged == null)
1651 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.SoundNotification);
1652 if (ret != SystemSettingsError.None)
1654 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1660 private static readonly Interop.Settings.SystemSettingsChangedCallback s_soundNotificationRepetitionPeriodChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1662 int soundNotificationRepetitionPeriod = SystemSettings.SoundNotificationRepetitionPeriod;
1663 SoundNotificationRepetitionPeriodChangedEventArgs eventArgs = new SoundNotificationRepetitionPeriodChangedEventArgs(soundNotificationRepetitionPeriod);
1664 s_soundNotificationRepetitionPeriodChanged?.Invoke(null, eventArgs);
1666 private static event EventHandler<SoundNotificationRepetitionPeriodChangedEventArgs> s_soundNotificationRepetitionPeriodChanged;
1668 /// SoundNotificationRepetitionPeriodChanged event is triggered when the time period for notification repetitions is changed
1670 /// <param name="sender"></param>
1671 /// <param name="e">A SoundNotificationRepetitionPeriodChangedEventArgs object that contains the key & changed value</param>
1672 public static event EventHandler<SoundNotificationRepetitionPeriodChangedEventArgs> SoundNotificationRepetitionPeriodChanged
1676 if (s_soundNotificationRepetitionPeriodChanged == null)
1678 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.SoundNotificationRepetitionPeriod, s_soundNotificationRepetitionPeriodChangedCallback, IntPtr.Zero);
1679 if (ret != SystemSettingsError.None)
1681 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1684 s_soundNotificationRepetitionPeriodChanged += value;
1689 s_soundNotificationRepetitionPeriodChanged -= value;
1690 if (s_soundNotificationRepetitionPeriodChanged == null)
1692 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.SoundNotificationRepetitionPeriod);
1693 if (ret != SystemSettingsError.None)
1695 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1701 private static readonly Interop.Settings.SystemSettingsChangedCallback s_lockStateChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1703 SystemSettingsIdleLockState lockState = SystemSettings.LockState;
1704 LockStateChangedEventArgs eventArgs = new LockStateChangedEventArgs(lockState);
1705 s_lockStateChanged?.Invoke(null, eventArgs);
1707 private static event EventHandler<LockStateChangedEventArgs> s_lockStateChanged;
1709 /// LockStateChanged event is triggered when the current lock state is changed
1711 /// <param name="sender"></param>
1712 /// <param name="e">A LockStateChangedEventArgs object that contains the key & changed value</param>
1713 public static event EventHandler<LockStateChangedEventArgs> LockStateChanged
1717 if (s_lockStateChanged == null)
1719 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LockState, s_lockStateChangedCallback, IntPtr.Zero);
1720 if (ret != SystemSettingsError.None)
1722 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1725 s_lockStateChanged += value;
1730 s_lockStateChanged -= value;
1731 if (s_lockStateChanged == null)
1733 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LockState);
1734 if (ret != SystemSettingsError.None)
1736 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");