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.");
636 /// The current system ADS ID
638 public static string AdsId
643 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.AdsId, out adsId);
644 if (res != SystemSettingsError.None)
646 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get AdsId system setting value.");
652 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.AdsId, value);
653 if (res != SystemSettingsError.None)
655 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set AdsId system setting.");
662 /// Indicates the time period for notification repetitions.
664 public static SystemSettingsUdsState UltraDataSave
669 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueInt(SystemSettingsKeys.UltraDataSave, out UltraDataSave);
670 if (res != SystemSettingsError.None)
672 Log.Warn(SystemSettingsExceptionFactory.LogTag, "unable to get UltraDataSave system setting value.");
674 return (SystemSettingsUdsState)UltraDataSave;
680 private static readonly Interop.Settings.SystemSettingsChangedCallback s_incomingCallRingtoneChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
682 string path = SystemSettings.IncomingCallRingtone;
683 IncomingCallRingtoneChangedEventArgs eventArgs = new IncomingCallRingtoneChangedEventArgs(path);
684 s_incomingCallRingtoneChanged?.Invoke(null, eventArgs);
686 private static event EventHandler<IncomingCallRingtoneChangedEventArgs> s_incomingCallRingtoneChanged;
688 /// IncomingCallRingtoneChanged event is triggered when the file path of the incoming ringtone is changed
690 /// <param name="sender"></param>
691 /// <param name="e">A IncomingCallRingtoneChangedEventArgs object that contains the key & changed value</param>
692 public static event EventHandler<IncomingCallRingtoneChangedEventArgs> IncomingCallRingtoneChanged
696 if (s_incomingCallRingtoneChanged == null)
698 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.IncomingCallRingtone, s_incomingCallRingtoneChangedCallback, IntPtr.Zero);
699 if (ret != SystemSettingsError.None)
701 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
704 s_incomingCallRingtoneChanged += value;
709 s_incomingCallRingtoneChanged -= value;
710 if (s_incomingCallRingtoneChanged == null)
712 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.IncomingCallRingtone);
713 if (ret != SystemSettingsError.None)
715 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
721 private static readonly Interop.Settings.SystemSettingsChangedCallback s_wallpaperHomeScreenChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
723 string path = SystemSettings.WallpaperHomeScreen;
724 WallpaperHomeScreenChangedEventArgs eventArgs = new WallpaperHomeScreenChangedEventArgs(path);
725 s_wallpaperHomeScreenChanged?.Invoke(null, eventArgs);
727 private static event EventHandler<WallpaperHomeScreenChangedEventArgs> s_wallpaperHomeScreenChanged;
729 /// WallpaperHomeScreenChanged event is triggered when the file path of the current home screen wallpaper is changed
731 /// <param name="sender"></param>
732 /// <param name="e">A WallpaperHomeScreenChangedEventArgs object that contains the key & changed value</param>
733 public static event EventHandler<WallpaperHomeScreenChangedEventArgs> WallpaperHomeScreenChanged
737 if (s_wallpaperHomeScreenChanged == null)
739 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.WallpaperHomeScreen, s_wallpaperHomeScreenChangedCallback, IntPtr.Zero);
740 if (ret != SystemSettingsError.None)
742 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
745 s_wallpaperHomeScreenChanged += value;
750 s_wallpaperHomeScreenChanged -= value;
751 if (s_wallpaperHomeScreenChanged == null)
753 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.WallpaperHomeScreen);
754 if (ret != SystemSettingsError.None)
756 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
762 private static readonly Interop.Settings.SystemSettingsChangedCallback s_wallpaperLockScreenChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
764 string path = SystemSettings.WallpaperLockScreen;
765 WallpaperLockScreenChangedEventArgs eventArgs = new WallpaperLockScreenChangedEventArgs(path);
766 s_wallpaperLockScreenChanged?.Invoke(null, eventArgs);
768 private static event EventHandler<WallpaperLockScreenChangedEventArgs> s_wallpaperLockScreenChanged;
770 /// WallpaperLockScreenChanged event is triggered when the file path of the current lock screen wallpaper is changed
772 /// <param name="sender"></param>
773 /// <param name="e">A WallpaperLockScreenChangedEventArgs object that contains the key & changed value</param>
774 public static event EventHandler<WallpaperLockScreenChangedEventArgs> WallpaperLockScreenChanged
778 if (s_wallpaperLockScreenChanged == null)
780 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.WallpaperLockScreen, s_wallpaperLockScreenChangedCallback, IntPtr.Zero);
781 if (ret != SystemSettingsError.None)
783 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
786 s_wallpaperLockScreenChanged += value;
791 s_wallpaperLockScreenChanged -= value;
792 if (s_wallpaperLockScreenChanged == null)
794 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.WallpaperLockScreen);
795 if (ret != SystemSettingsError.None)
797 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
803 private static readonly Interop.Settings.SystemSettingsChangedCallback s_fontSizeChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
805 SystemSettingsFontSize fontSize = SystemSettings.FontSize;
806 FontSizeChangedEventArgs eventArgs = new FontSizeChangedEventArgs(fontSize);
807 s_fontSizeChanged?.Invoke(null, eventArgs);
809 private static event EventHandler<FontSizeChangedEventArgs> s_fontSizeChanged;
811 /// FontSizeChanged event is triggered when the current system font size is changed
813 /// <param name="sender"></param>
814 /// <param name="e">A FontSizeChangedEventArgs object that contains the key & changed value</param>
815 public static event EventHandler<FontSizeChangedEventArgs> FontSizeChanged
819 if (s_fontSizeChanged == null)
821 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.FontSize, s_fontSizeChangedCallback, IntPtr.Zero);
822 if (ret != SystemSettingsError.None)
824 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
827 s_fontSizeChanged += value;
832 s_fontSizeChanged -= value;
833 if (s_fontSizeChanged == null)
835 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.FontSize);
836 if (ret != SystemSettingsError.None)
838 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
844 private static readonly Interop.Settings.SystemSettingsChangedCallback s_fontTypeChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
846 string fontType = SystemSettings.FontType;
847 FontTypeChangedEventArgs eventArgs = new FontTypeChangedEventArgs(fontType);
848 s_fontTypeChanged?.Invoke(null, eventArgs);
850 private static event EventHandler<FontTypeChangedEventArgs> s_fontTypeChanged;
852 /// FontTypeChanged event is triggered when the current system font type is changed
854 /// <param name="sender"></param>
855 /// <param name="e">A FontTypeChangedEventArgs object that contains the key & changed value</param>
856 public static event EventHandler<FontTypeChangedEventArgs> FontTypeChanged
860 if (s_fontTypeChanged == null)
862 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.FontType, s_fontTypeChangedCallback, IntPtr.Zero);
863 if (ret != SystemSettingsError.None)
865 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
868 s_fontTypeChanged += value;
873 s_fontTypeChanged -= value;
874 if (s_fontTypeChanged == null)
876 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.FontType);
877 if (ret != SystemSettingsError.None)
879 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
885 private static readonly Interop.Settings.SystemSettingsChangedCallback s_motionActivationChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
887 bool motionActivation = SystemSettings.MotionActivationEnabled;
888 MotionActivationSettingChangedEventArgs eventArgs = new MotionActivationSettingChangedEventArgs(motionActivation);
889 s_motionActivationChanged?.Invoke(null, eventArgs);
891 private static event EventHandler<MotionActivationSettingChangedEventArgs> s_motionActivationChanged;
893 /// MotionActivationChanged event is triggered when the motion service status is changed
895 /// <param name="sender"></param>
896 /// <param name="e">A MotionActivationChangedEventArgs object that contains the key & changed value</param>
897 public static event EventHandler<MotionActivationSettingChangedEventArgs> MotionActivationSettingChanged
901 if (s_motionActivationChanged == null)
903 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.MotionActivationEnabled, s_motionActivationChangedCallback, IntPtr.Zero);
904 if (ret != SystemSettingsError.None)
906 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
909 s_motionActivationChanged += value;
914 s_motionActivationChanged -= value;
915 if (s_motionActivationChanged == null)
917 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.MotionActivationEnabled);
918 if (ret != SystemSettingsError.None)
920 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
926 private static readonly Interop.Settings.SystemSettingsChangedCallback s_emailAlertRingtoneChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
928 string emailAlertRingtone = SystemSettings.EmailAlertRingtone;
929 EmailAlertRingtoneChangedEventArgs eventArgs = new EmailAlertRingtoneChangedEventArgs(emailAlertRingtone);
930 s_emailAlertRingtoneChanged?.Invoke(null, eventArgs);
932 private static event EventHandler<EmailAlertRingtoneChangedEventArgs> s_emailAlertRingtoneChanged;
934 /// EmailAlertRingtoneChanged event is triggered when the file path of the current email alert ringtone is changed
936 /// <param name="sender"></param>
937 /// <param name="e">A EmailAlertRingtoneChangedEventArgs object that contains the key & changed value</param>
938 public static event EventHandler<EmailAlertRingtoneChangedEventArgs> EmailAlertRingtoneChanged
942 if (s_emailAlertRingtoneChanged == null)
944 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.EmailAlertRingtone, s_emailAlertRingtoneChangedCallback, IntPtr.Zero);
945 if (ret != SystemSettingsError.None)
947 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
950 s_emailAlertRingtoneChanged += value;
955 s_emailAlertRingtoneChanged -= value;
956 if (s_emailAlertRingtoneChanged == null)
958 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.EmailAlertRingtone);
959 if (ret != SystemSettingsError.None)
961 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
967 private static readonly Interop.Settings.SystemSettingsChangedCallback s_usbDebuggingSettingChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
969 bool usbDebuggingEnabled = SystemSettings.UsbDebuggingEnabled;
970 UsbDebuggingSettingChangedEventArgs eventArgs = new UsbDebuggingSettingChangedEventArgs(usbDebuggingEnabled);
971 s_usbDebuggingSettingChanged?.Invoke(null, eventArgs);
973 private static event EventHandler<UsbDebuggingSettingChangedEventArgs> s_usbDebuggingSettingChanged;
975 /// UsbDebuggingSettingChangedEventArgs event is triggered when the USB debugging status is changed
977 /// <param name="sender"></param>
978 /// <param name="e">A UsbDebuggingSettingChangedEventArgs object that contains the key & changed value</param>
979 public static event EventHandler<UsbDebuggingSettingChangedEventArgs> UsbDebuggingSettingChanged
983 if (s_usbDebuggingSettingChanged == null)
985 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.UsbDebuggingEnabled, s_usbDebuggingSettingChangedCallback, IntPtr.Zero);
986 if (ret != SystemSettingsError.None)
988 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
991 s_usbDebuggingSettingChanged += value;
996 s_usbDebuggingSettingChanged -= value;
997 if (s_usbDebuggingSettingChanged == null)
999 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.UsbDebuggingEnabled);
1000 if (ret != SystemSettingsError.None)
1002 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1008 private static readonly Interop.Settings.SystemSettingsChangedCallback s_data3GNetworkSettingChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1010 bool data3GEnabled = SystemSettings.Data3GNetworkEnabled;
1011 Data3GNetworkSettingChangedEventArgs eventArgs = new Data3GNetworkSettingChangedEventArgs(data3GEnabled);
1012 s_data3GNetworkSettingChanged?.Invoke(null, eventArgs);
1014 private static event EventHandler<Data3GNetworkSettingChangedEventArgs> s_data3GNetworkSettingChanged;
1016 /// Data3GNetworkSettingChanged event is triggered when the 3G data network status is changed
1018 /// <param name="sender"></param>
1019 /// <param name="e">A Data3GNetworkSettingChangedEventArgs object that contains the key & changed value</param>
1020 public static event EventHandler<Data3GNetworkSettingChangedEventArgs> Data3GNetworkSettingChanged
1024 if (s_data3GNetworkSettingChanged == null)
1026 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.Data3GNetworkEnabled, s_data3GNetworkSettingChangedCallback, IntPtr.Zero);
1027 if (ret != SystemSettingsError.None)
1029 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1032 s_data3GNetworkSettingChanged += value;
1037 s_data3GNetworkSettingChanged -= value;
1038 if (s_data3GNetworkSettingChanged == null)
1040 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.Data3GNetworkEnabled);
1041 if (ret != SystemSettingsError.None)
1043 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1049 private static readonly Interop.Settings.SystemSettingsChangedCallback s_lockscreenAppChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1051 string lockScreenApp = SystemSettings.LockscreenApp;
1052 LockscreenAppChangedEventArgs eventArgs = new LockscreenAppChangedEventArgs(lockScreenApp);
1053 s_lockscreenAppChanged?.Invoke(null, eventArgs);
1055 private static event EventHandler<LockscreenAppChangedEventArgs> s_lockscreenAppChanged;
1057 /// LockscreenAppChanged event is triggered when the lockscreen app pkg name is changed
1059 /// <param name="sender"></param>
1060 /// <param name="e">A LockscreenAppChangedEventArgs object that contains the key & changed value</param>
1061 public static event EventHandler<LockscreenAppChangedEventArgs> LockscreenAppChanged
1065 if (s_lockscreenAppChanged == null)
1067 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LockscreenApp, s_lockscreenAppChangedCallback, IntPtr.Zero);
1068 if (ret != SystemSettingsError.None)
1070 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1073 s_lockscreenAppChanged += value;
1078 s_lockscreenAppChanged -= value;
1079 if (s_lockscreenAppChanged == null)
1081 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LockscreenApp);
1082 if (ret != SystemSettingsError.None)
1084 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1090 private static readonly Interop.Settings.SystemSettingsChangedCallback s_localeCountryChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1092 string localeCountry = SystemSettings.LocaleCountry;
1093 LocaleCountryChangedEventArgs eventArgs = new LocaleCountryChangedEventArgs(localeCountry);
1094 s_localeCountryChanged?.Invoke(null, eventArgs);
1096 private static event EventHandler<LocaleCountryChangedEventArgs> s_localeCountryChanged;
1098 /// LocaleCountryChanged event is triggered when the current country setting in the \<LANGUAGE\>_\<REGION\> syntax, is changed
1100 /// <param name="sender"></param>
1101 /// <param name="e">A LocaleCountryChangedEventArgs object that contains the key & changed value</param>
1102 public static event EventHandler<LocaleCountryChangedEventArgs> LocaleCountryChanged
1106 if (s_localeCountryChanged == null)
1108 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LocaleCountry, s_localeCountryChangedCallback, IntPtr.Zero);
1109 if (ret != SystemSettingsError.None)
1111 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1114 s_localeCountryChanged += value;
1119 s_localeCountryChanged -= value;
1120 if (s_localeCountryChanged == null)
1122 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LocaleCountry);
1123 if (ret != SystemSettingsError.None)
1125 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1131 private static readonly Interop.Settings.SystemSettingsChangedCallback s_localeLanguageChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1133 string localeLanguage = SystemSettings.LocaleLanguage;
1134 LocaleLanguageChangedEventArgs eventArgs = new LocaleLanguageChangedEventArgs(localeLanguage);
1135 s_localeLanguageChanged?.Invoke(null, eventArgs);
1137 private static event EventHandler<LocaleLanguageChangedEventArgs> s_localeLanguageChanged;
1139 /// LocaleLanguageChanged event is triggered when the current language setting in the \<LANGUAGE\>_\<REGION\> syntax, is changed
1141 /// <param name="sender"></param>
1142 /// <param name="e">A LocaleLanguageChangedEventArgs object that contains the key & changed value</param>
1143 public static event EventHandler<LocaleLanguageChangedEventArgs> LocaleLanguageChanged
1147 if (s_localeLanguageChanged == null)
1149 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LocaleLanguage, s_localeLanguageChangedCallback, IntPtr.Zero);
1150 if (ret != SystemSettingsError.None)
1152 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1155 s_localeLanguageChanged += value;
1160 s_localeLanguageChanged -= value;
1161 if (s_localeLanguageChanged == null)
1163 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LocaleLanguage);
1164 if (ret != SystemSettingsError.None)
1166 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1172 private static readonly Interop.Settings.SystemSettingsChangedCallback s_localeTimeFormat24HourChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1174 bool localeTimeFormat24Hour = SystemSettings.LocaleTimeFormat24HourEnabled;
1175 LocaleTimeFormat24HourSettingChangedEventArgs eventArgs = new LocaleTimeFormat24HourSettingChangedEventArgs(localeTimeFormat24Hour);
1176 s_localeTimeFormat24HourChanged?.Invoke(null, eventArgs);
1178 private static event EventHandler<LocaleTimeFormat24HourSettingChangedEventArgs> s_localeTimeFormat24HourChanged;
1180 /// LocaleTimeFormat24HourChanged event is triggered when the time format is changed
1182 /// <param name="sender"></param>
1183 /// <param name="e">A LocaleTimeFormat24HourChangedEventArgs object that contains the key & changed value</param>
1184 public static event EventHandler<LocaleTimeFormat24HourSettingChangedEventArgs> LocaleTimeFormat24HourSettingChanged
1188 if (s_localeTimeFormat24HourChanged == null)
1190 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LocaleTimeFormat24HourEnabled, s_localeTimeFormat24HourChangedCallback, IntPtr.Zero);
1191 if (ret != SystemSettingsError.None)
1193 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1196 s_localeTimeFormat24HourChanged += value;
1201 s_localeTimeFormat24HourChanged -= value;
1202 if (s_localeTimeFormat24HourChanged == null)
1204 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LocaleTimeFormat24HourEnabled);
1205 if (ret != SystemSettingsError.None)
1207 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1213 private static readonly Interop.Settings.SystemSettingsChangedCallback s_localeTimeZoneChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1215 string localeTimeZone = SystemSettings.LocaleTimeZone;
1216 LocaleTimeZoneChangedEventArgs eventArgs = new LocaleTimeZoneChangedEventArgs(localeTimeZone);
1217 s_localeTimeZoneChanged?.Invoke(null, eventArgs);
1219 private static event EventHandler<LocaleTimeZoneChangedEventArgs> s_localeTimeZoneChanged;
1221 /// LocaleTimeZoneChanged event is triggered when the current time zone is changed
1223 /// <param name="sender"></param>
1224 /// <param name="e">A LocaleTimeZoneChangedEventArgs object that contains the key & changed value</param>
1225 public static event EventHandler<LocaleTimeZoneChangedEventArgs> LocaleTimeZoneChanged
1229 if (s_localeTimeZoneChanged == null)
1231 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LocaleTimeZone, s_localeTimeZoneChangedCallback, IntPtr.Zero);
1232 if (ret != SystemSettingsError.None)
1234 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1237 s_localeTimeZoneChanged += value;
1242 s_localeTimeZoneChanged -= value;
1243 if (s_localeTimeZoneChanged == null)
1245 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LocaleTimeZone);
1246 if (ret != SystemSettingsError.None)
1248 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1254 private static readonly Interop.Settings.SystemSettingsChangedCallback s_timeChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1256 //bool motionActivation = SystemSettings.Time;
1257 TimeChangedEventArgs eventArgs = new TimeChangedEventArgs();
1258 s_timeChanged?.Invoke(null, eventArgs);
1260 private static event EventHandler<TimeChangedEventArgs> s_timeChanged;
1262 /// TimeChanged event is triggered when the system time is changed
1264 /// <param name="sender"></param>
1265 /// <param name="e">A TimeChangedEventArgs object that contains the key & changed value</param>
1266 public static event EventHandler<TimeChangedEventArgs> TimeChanged
1270 if (s_timeChanged == null)
1272 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.Time, s_timeChangedCallback, IntPtr.Zero);
1273 if (ret != SystemSettingsError.None)
1275 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1278 s_timeChanged += value;
1283 s_timeChanged -= value;
1284 if (s_timeChanged == null)
1286 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.Time);
1287 if (ret != SystemSettingsError.None)
1289 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1295 private static readonly Interop.Settings.SystemSettingsChangedCallback s_soundLockChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1297 bool soundLock = SystemSettings.SoundLockEnabled;
1298 SoundLockSettingChangedEventArgs eventArgs = new SoundLockSettingChangedEventArgs(soundLock);
1299 s_soundLockChanged?.Invoke(null, eventArgs);
1301 private static event EventHandler<SoundLockSettingChangedEventArgs> s_soundLockChanged;
1303 /// SoundLockChanged event is triggered when the screen lock sound enabled status is changed
1305 /// <param name="sender"></param>
1306 /// <param name="e">A SoundLockChangedEventArgs object that contains the key & changed value</param>
1307 public static event EventHandler<SoundLockSettingChangedEventArgs> SoundLockSettingChanged
1311 if (s_soundLockChanged == null)
1313 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.SoundLockEnabled, s_soundLockChangedCallback, IntPtr.Zero);
1314 if (ret != SystemSettingsError.None)
1316 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1319 s_soundLockChanged += value;
1324 s_soundLockChanged -= value;
1325 if (s_soundLockChanged == null)
1327 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.SoundLockEnabled);
1328 if (ret != SystemSettingsError.None)
1330 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1336 private static readonly Interop.Settings.SystemSettingsChangedCallback s_soundSilentModeChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1338 bool soundSilentMode = SystemSettings.SoundSilentModeEnabled;
1339 SoundSilentModeSettingChangedEventArgs eventArgs = new SoundSilentModeSettingChangedEventArgs(soundSilentMode);
1340 s_soundSilentModeChanged?.Invoke(null, eventArgs);
1342 private static event EventHandler<SoundSilentModeSettingChangedEventArgs> s_soundSilentModeChanged;
1344 /// SoundSilentModeChanged event is triggered when the silent mode status is changed
1346 /// <param name="sender"></param>
1347 /// <param name="e">A SoundSilentModeChangedEventArgs object that contains the key & changed value</param>
1348 public static event EventHandler<SoundSilentModeSettingChangedEventArgs> SoundSilentModeSettingChanged
1352 if (s_soundSilentModeChanged == null)
1354 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.SoundSilentModeEnabled, s_soundSilentModeChangedCallback, IntPtr.Zero);
1355 if (ret != SystemSettingsError.None)
1357 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1360 s_soundSilentModeChanged += value;
1365 s_soundSilentModeChanged -= value;
1366 if (s_soundSilentModeChanged == null)
1368 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.SoundSilentModeEnabled);
1369 if (ret != SystemSettingsError.None)
1371 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1377 private static readonly Interop.Settings.SystemSettingsChangedCallback s_soundTouchChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1379 bool soundTouch = SystemSettings.SoundTouchEnabled;
1380 SoundTouchSettingChangedEventArgs eventArgs = new SoundTouchSettingChangedEventArgs(soundTouch);
1381 s_soundTouchChanged?.Invoke(null, eventArgs);
1383 private static event EventHandler<SoundTouchSettingChangedEventArgs> s_soundTouchChanged;
1385 /// SoundTouchChanged event is triggered when the screen touch sound enabled status is changed
1387 /// <param name="sender"></param>
1388 /// <param name="e">A SoundTouchChangedEventArgs object that contains the key & changed value</param>
1389 public static event EventHandler<SoundTouchSettingChangedEventArgs> SoundTouchSettingChanged
1393 if (s_soundTouchChanged == null)
1395 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.SoundTouchEnabled, s_soundTouchChangedCallback, IntPtr.Zero);
1396 if (ret != SystemSettingsError.None)
1398 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1401 s_soundTouchChanged += value;
1406 s_soundTouchChanged -= value;
1407 if (s_soundTouchChanged == null)
1409 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.SoundTouchEnabled);
1410 if (ret != SystemSettingsError.None)
1412 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1418 private static readonly Interop.Settings.SystemSettingsChangedCallback s_displayScreenRotationAutoChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1420 bool displayScreenRotationAuto = SystemSettings.DisplayScreenRotationAutoEnabled;
1421 DisplayScreenRotationAutoSettingChangedEventArgs eventArgs = new DisplayScreenRotationAutoSettingChangedEventArgs(displayScreenRotationAuto);
1422 s_displayScreenRotationAutoChanged?.Invoke(null, eventArgs);
1424 private static event EventHandler<DisplayScreenRotationAutoSettingChangedEventArgs> s_displayScreenRotationAutoChanged;
1426 /// DisplayScreenRotationAutoChanged event is triggered when the automatic rotation control status is changed
1428 /// <param name="sender"></param>
1429 /// <param name="e">A DisplayScreenRotationAutoChangedEventArgs object that contains the key & changed value</param>
1430 public static event EventHandler<DisplayScreenRotationAutoSettingChangedEventArgs> DisplayScreenRotationAutoSettingChanged
1434 if (s_displayScreenRotationAutoChanged == null)
1436 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.DisplayScreenRotationAutoEnabled, s_displayScreenRotationAutoChangedCallback, IntPtr.Zero);
1437 if (ret != SystemSettingsError.None)
1439 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1442 s_displayScreenRotationAutoChanged += value;
1447 s_displayScreenRotationAutoChanged -= value;
1448 if (s_displayScreenRotationAutoChanged == null)
1450 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.DisplayScreenRotationAutoEnabled);
1451 if (ret != SystemSettingsError.None)
1453 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1459 private static readonly Interop.Settings.SystemSettingsChangedCallback s_deviceNameChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1461 string deviceName = SystemSettings.DeviceName;
1462 DeviceNameChangedEventArgs eventArgs = new DeviceNameChangedEventArgs(deviceName);
1463 s_deviceNameChanged?.Invoke(null, eventArgs);
1465 private static event EventHandler<DeviceNameChangedEventArgs> s_deviceNameChanged;
1467 /// DeviceNameChanged event is triggered when the device name is changed
1469 /// <param name="sender"></param>
1470 /// <param name="e">A DeviceNameChangedEventArgs object that contains the key & changed value</param>
1471 public static event EventHandler<DeviceNameChangedEventArgs> DeviceNameChanged
1475 if (s_deviceNameChanged == null)
1477 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.DeviceName, s_deviceNameChangedCallback, IntPtr.Zero);
1478 if (ret != SystemSettingsError.None)
1480 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1483 s_deviceNameChanged += value;
1488 s_deviceNameChanged -= value;
1489 if (s_deviceNameChanged == null)
1491 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.DeviceName);
1492 if (ret != SystemSettingsError.None)
1494 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1500 private static readonly Interop.Settings.SystemSettingsChangedCallback s_motionSettingChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1502 bool motionEnabled = SystemSettings.MotionEnabled;
1503 MotionSettingChangedEventArgs eventArgs = new MotionSettingChangedEventArgs(motionEnabled);
1504 s_motionSettingChanged?.Invoke(null, eventArgs);
1506 private static event EventHandler<MotionSettingChangedEventArgs> s_motionSettingChanged;
1508 /// MotionSettingChanged event is triggered when the motion feature enabled status is changed
1510 /// <param name="sender"></param>
1511 /// <param name="e">A MotionSettingChangedEventArgs object that contains the key & changed value</param>
1512 public static event EventHandler<MotionSettingChangedEventArgs> MotionSettingChanged
1516 if (s_motionSettingChanged == null)
1518 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.MotionEnabled, s_motionSettingChangedCallback, IntPtr.Zero);
1519 if (ret != SystemSettingsError.None)
1521 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1524 s_motionSettingChanged += value;
1529 s_motionSettingChanged -= value;
1530 if (s_motionSettingChanged == null)
1532 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.MotionEnabled);
1533 if (ret != SystemSettingsError.None)
1535 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1541 private static readonly Interop.Settings.SystemSettingsChangedCallback s_networkWifiNotificationChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1543 bool networkWifiNotification = SystemSettings.NetworkWifiNotificationEnabled;
1544 NetworkWifiNotificationSettingChangedEventArgs eventArgs = new NetworkWifiNotificationSettingChangedEventArgs(networkWifiNotification);
1545 s_networkWifiNotificationChanged?.Invoke(null, eventArgs);
1547 private static event EventHandler<NetworkWifiNotificationSettingChangedEventArgs> s_networkWifiNotificationChanged;
1549 /// NetworkWifiNotificationChanged event is triggered when the Wi-Fi-related notifications enabled status is changed
1551 /// <param name="sender"></param>
1552 /// <param name="e">A NetworkWifiNotificationChangedEventArgs object that contains the key & changed value</param>
1553 public static event EventHandler<NetworkWifiNotificationSettingChangedEventArgs> NetworkWifiNotificationSettingChanged
1557 if (s_networkWifiNotificationChanged == null)
1559 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.NetworkWifiNotificationEnabled, s_networkWifiNotificationChangedCallback, IntPtr.Zero);
1560 if (ret != SystemSettingsError.None)
1562 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1565 s_networkWifiNotificationChanged += value;
1570 s_networkWifiNotificationChanged -= value;
1571 if (s_networkWifiNotificationChanged == null)
1573 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.NetworkWifiNotificationEnabled);
1574 if (ret != SystemSettingsError.None)
1576 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1582 private static readonly Interop.Settings.SystemSettingsChangedCallback s_networkFlightModeChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1584 bool networkFlightMode = SystemSettings.NetworkFlightModeEnabled;
1585 NetworkFlightModeSettingChangedEventArgs eventArgs = new NetworkFlightModeSettingChangedEventArgs(networkFlightMode);
1586 s_networkFlightModeChanged?.Invoke(null, eventArgs);
1588 private static event EventHandler<NetworkFlightModeSettingChangedEventArgs> s_networkFlightModeChanged;
1590 /// NetworkFlightModeChanged event is triggered when the flight mode status is changed
1592 /// <param name="sender"></param>
1593 /// <param name="e">A NetworkFlightModeChangedEventArgs object that contains the key & changed value</param>
1594 public static event EventHandler<NetworkFlightModeSettingChangedEventArgs> NetworkFlightModeSettingChanged
1598 if (s_networkFlightModeChanged == null)
1600 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.NetworkFlightModeEnabled, s_networkFlightModeChangedCallback, IntPtr.Zero);
1601 if (ret != SystemSettingsError.None)
1603 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1606 s_networkFlightModeChanged += value;
1611 s_networkFlightModeChanged -= value;
1612 if (s_networkFlightModeChanged == null)
1614 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.NetworkFlightModeEnabled);
1615 if (ret != SystemSettingsError.None)
1617 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1623 private static readonly Interop.Settings.SystemSettingsChangedCallback s_screenBacklightTimeChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1625 int screenBacklightTime = SystemSettings.ScreenBacklightTime;
1626 ScreenBacklightTimeChangedEventArgs eventArgs = new ScreenBacklightTimeChangedEventArgs(screenBacklightTime);
1627 s_screenBacklightTimeChanged?.Invoke(null, eventArgs);
1629 private static event EventHandler<ScreenBacklightTimeChangedEventArgs> s_screenBacklightTimeChanged;
1631 /// ScreenBacklightTimeChanged event is triggered when the backlight time is changed.
1633 /// <param name="sender"></param>
1634 /// <param name="e">A ScreenBacklightTimeChangedEventArgs object that contains the key & changed value</param>
1635 public static event EventHandler<ScreenBacklightTimeChangedEventArgs> ScreenBacklightTimeChanged
1639 if (s_screenBacklightTimeChanged == null)
1641 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.ScreenBacklightTime, s_screenBacklightTimeChangedCallback, IntPtr.Zero);
1642 if (ret != SystemSettingsError.None)
1644 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1647 s_screenBacklightTimeChanged += value;
1652 s_screenBacklightTimeChanged -= value;
1653 if (s_screenBacklightTimeChanged == null)
1655 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.ScreenBacklightTime);
1656 if (ret != SystemSettingsError.None)
1658 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1664 private static readonly Interop.Settings.SystemSettingsChangedCallback s_soundNotificationChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1666 string soundNotification = SystemSettings.SoundNotification;
1667 SoundNotificationChangedEventArgs eventArgs = new SoundNotificationChangedEventArgs(soundNotification);
1668 s_soundNotificationChanged?.Invoke(null, eventArgs);
1670 private static event EventHandler<SoundNotificationChangedEventArgs> s_soundNotificationChanged;
1672 /// SoundNotificationChanged event is triggered when the file path of the current notification tone set by the user is changed
1674 /// <param name="sender"></param>
1675 /// <param name="e">A SoundNotificationChangedEventArgs object that contains the key & changed value</param>
1676 public static event EventHandler<SoundNotificationChangedEventArgs> SoundNotificationChanged
1680 if (s_soundNotificationChanged == null)
1682 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.SoundNotification, s_soundNotificationChangedCallback, IntPtr.Zero);
1683 if (ret != SystemSettingsError.None)
1685 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1688 s_soundNotificationChanged += value;
1693 s_soundNotificationChanged -= value;
1694 if (s_soundNotificationChanged == null)
1696 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.SoundNotification);
1697 if (ret != SystemSettingsError.None)
1699 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1705 private static readonly Interop.Settings.SystemSettingsChangedCallback s_soundNotificationRepetitionPeriodChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1707 int soundNotificationRepetitionPeriod = SystemSettings.SoundNotificationRepetitionPeriod;
1708 SoundNotificationRepetitionPeriodChangedEventArgs eventArgs = new SoundNotificationRepetitionPeriodChangedEventArgs(soundNotificationRepetitionPeriod);
1709 s_soundNotificationRepetitionPeriodChanged?.Invoke(null, eventArgs);
1711 private static event EventHandler<SoundNotificationRepetitionPeriodChangedEventArgs> s_soundNotificationRepetitionPeriodChanged;
1713 /// SoundNotificationRepetitionPeriodChanged event is triggered when the time period for notification repetitions is changed
1715 /// <param name="sender"></param>
1716 /// <param name="e">A SoundNotificationRepetitionPeriodChangedEventArgs object that contains the key & changed value</param>
1717 public static event EventHandler<SoundNotificationRepetitionPeriodChangedEventArgs> SoundNotificationRepetitionPeriodChanged
1721 if (s_soundNotificationRepetitionPeriodChanged == null)
1723 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.SoundNotificationRepetitionPeriod, s_soundNotificationRepetitionPeriodChangedCallback, IntPtr.Zero);
1724 if (ret != SystemSettingsError.None)
1726 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1729 s_soundNotificationRepetitionPeriodChanged += value;
1734 s_soundNotificationRepetitionPeriodChanged -= value;
1735 if (s_soundNotificationRepetitionPeriodChanged == null)
1737 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.SoundNotificationRepetitionPeriod);
1738 if (ret != SystemSettingsError.None)
1740 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1746 private static readonly Interop.Settings.SystemSettingsChangedCallback s_lockStateChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1748 SystemSettingsIdleLockState lockState = SystemSettings.LockState;
1749 LockStateChangedEventArgs eventArgs = new LockStateChangedEventArgs(lockState);
1750 s_lockStateChanged?.Invoke(null, eventArgs);
1752 private static event EventHandler<LockStateChangedEventArgs> s_lockStateChanged;
1754 /// LockStateChanged event is triggered when the current lock state is changed
1756 /// <param name="sender"></param>
1757 /// <param name="e">A LockStateChangedEventArgs object that contains the key & changed value</param>
1758 public static event EventHandler<LockStateChangedEventArgs> LockStateChanged
1762 if (s_lockStateChanged == null)
1764 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LockState, s_lockStateChangedCallback, IntPtr.Zero);
1765 if (ret != SystemSettingsError.None)
1767 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1770 s_lockStateChanged += value;
1775 s_lockStateChanged -= value;
1776 if (s_lockStateChanged == null)
1778 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LockState);
1779 if (ret != SystemSettingsError.None)
1781 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1787 private static readonly Interop.Settings.SystemSettingsChangedCallback s_adsIdChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1789 string adsId = SystemSettings.AdsId;
1790 AdsIdChangedEventArgs eventArgs = new AdsIdChangedEventArgs(adsId);
1791 s_adsIdChanged?.Invoke(null, eventArgs);
1793 private static event EventHandler<AdsIdChangedEventArgs> s_adsIdChanged;
1795 /// AdsIdChanged event is triggered when the current ADS ID state is changed
1797 /// <param name="sender"></param>
1798 /// <param name="e">A AdsIdChangedEventArgs object that contains the key & changed value</param>
1799 public static event EventHandler<AdsIdChangedEventArgs> AdsIdChanged
1803 if (s_adsIdChanged == null)
1805 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.AdsId, s_adsIdChangedCallback, IntPtr.Zero);
1806 if (ret != SystemSettingsError.None)
1808 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1811 s_adsIdChanged += value;
1816 s_adsIdChanged -= value;
1817 if (s_adsIdChanged == null)
1819 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.AdsId);
1820 if (ret != SystemSettingsError.None)
1822 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1828 private static readonly Interop.Settings.SystemSettingsChangedCallback s_ultraDataSaveChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1830 SystemSettingsUdsState ultraDataSave = SystemSettings.UltraDataSave;
1831 UltraDataSaveChangedEventArgs eventArgs = new UltraDataSaveChangedEventArgs(ultraDataSave);
1832 s_ultraDataSaveChanged?.Invoke(null, eventArgs);
1834 private static event EventHandler<UltraDataSaveChangedEventArgs> s_ultraDataSaveChanged;
1836 /// UltraDataSaveChanged event is triggered when the current Ultra Data Save state is changed
1838 /// <param name="sender"></param>
1839 /// <param name="e">A UltraDataSaveChangedEventArgs object that contains the key & changed value</param>
1840 public static event EventHandler<UltraDataSaveChangedEventArgs> UltraDataSaveChanged
1844 if (s_ultraDataSaveChanged == null)
1846 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.UltraDataSave, s_ultraDataSaveChangedCallback, IntPtr.Zero);
1847 if (ret != SystemSettingsError.None)
1849 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1852 s_ultraDataSaveChanged += value;
1857 s_ultraDataSaveChanged -= value;
1858 if (s_ultraDataSaveChanged == null)
1860 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.UltraDataSave);
1861 if (ret != SystemSettingsError.None)
1863 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1869 private static readonly Interop.Settings.SystemSettingsChangedCallback s_ultraDataSavePackageListChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1871 string ultraDataSavePackageList = "None";
1872 UltraDataSavePackageListChangedEventArgs eventArgs = new UltraDataSavePackageListChangedEventArgs(ultraDataSavePackageList);
1873 s_ultraDataSavePackageListChanged?.Invoke(null, eventArgs);
1875 private static event EventHandler<UltraDataSavePackageListChangedEventArgs> s_ultraDataSavePackageListChanged;
1877 /// UltraDataSavePackageListChanged event is triggered when the current ADS ID state is changed
1879 /// <param name="sender"></param>
1880 /// <param name="e">A UltraDataSavePackageListChangedEventArgs object that contains the key & changed value</param>
1881 public static event EventHandler<UltraDataSavePackageListChangedEventArgs> UltraDataSavePackageListChanged
1885 if (s_ultraDataSavePackageListChanged == null)
1887 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.UltraDataSavePackageList, s_ultraDataSavePackageListChangedCallback, IntPtr.Zero);
1888 if (ret != SystemSettingsError.None)
1890 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1893 s_ultraDataSavePackageListChanged += value;
1898 s_ultraDataSavePackageListChanged -= value;
1899 if (s_ultraDataSavePackageListChanged == null)
1901 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.UltraDataSavePackageList);
1902 if (ret != SystemSettingsError.None)
1904 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");