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 the configuration over a system.
25 /// The 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 so on.
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 throw SystemSettingsExceptionFactory.CreateException(res, "unable to get IncomingCallRingtone system setting.");
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 throw SystemSettingsExceptionFactory.CreateException(res, "unable to get WallpaperHomeScreen system setting.");
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 throw SystemSettingsExceptionFactory.CreateException(res, "unable to get WallpaperLockScreen system setting.");
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 throw SystemSettingsExceptionFactory.CreateException(res, "unable to get FontSize system setting.");
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 throw SystemSettingsExceptionFactory.CreateException(res, "unable to get FontType system setting.");
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 throw SystemSettingsExceptionFactory.CreateException(res, "unable to get MotionActivation system setting.");
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 throw SystemSettingsExceptionFactory.CreateException(res, "unable to get EmailAlertRingtone system setting.");
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 throw SystemSettingsExceptionFactory.CreateException(res, "unable to get UsbDebuggingEnabled system setting.");
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 throw SystemSettingsExceptionFactory.CreateException(res, "unable to get Data3GNetworkEnabled system setting.");
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 the lock-screen application package name.
257 public static string LockscreenApp
262 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.LockscreenApp, out pkgName);
263 if (res != SystemSettingsError.None)
265 throw SystemSettingsExceptionFactory.CreateException(res, "unable to get LockscreenApp system setting.");
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 supports 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 throw SystemSettingsExceptionFactory.CreateException(res, "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 throw SystemSettingsExceptionFactory.CreateException(res, "unable to get LocaleCountry system setting.");
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 throw SystemSettingsExceptionFactory.CreateException(res, "unable to get LocaleLanguage system setting.");
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 throw SystemSettingsExceptionFactory.CreateException(res, "unable to get LocaleTimeFormat24Hour system setting.");
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, for example, Pacific/Tahiti.
379 public static string LocaleTimeZone
384 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.LocaleTimeZone, out timeZone);
385 if (res != SystemSettingsError.None)
387 throw SystemSettingsExceptionFactory.CreateException(res, "unable to get LocaleTimeZone system setting.");
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.");
402 /// Once the system changes time, this event occurs to notify the time change.
404 public static int Time
409 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueInt(SystemSettingsKeys.Time, out time);
410 if (res != SystemSettingsError.None)
412 throw SystemSettingsExceptionFactory.CreateException(res, "unable to get Time system setting.");
418 /// Indicates whether the screen lock sound is enabled on the device, for example, the LCD on or off sound.
420 public static bool SoundLockEnabled
424 bool isSoundLockEnabled;
425 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.SoundLockEnabled, out isSoundLockEnabled);
426 if (res != SystemSettingsError.None)
428 throw SystemSettingsExceptionFactory.CreateException(res, "unable to get SoundLock system setting.");
430 return isSoundLockEnabled;
435 /// Indicates whether the device is in the silent mode.
437 public static bool SoundSilentModeEnabled
442 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.SoundSilentModeEnabled, out isSilent);
443 if (res != SystemSettingsError.None)
445 throw SystemSettingsExceptionFactory.CreateException(res, "unable to get SoundSilentMode system setting.");
452 /// Indicates whether the screen touch sound is enabled on the device.
454 public static bool SoundTouchEnabled
458 bool isTouchSoundEnabled;
459 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.SoundTouchEnabled, out isTouchSoundEnabled);
460 if (res != SystemSettingsError.None)
462 throw SystemSettingsExceptionFactory.CreateException(res, "unable to get SoundTouch system setting value.");
464 return isTouchSoundEnabled;
469 /// Indicates whether the rotation control is automatic.
471 public static bool DisplayScreenRotationAutoEnabled
475 bool isRotationAutomatic;
476 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.DisplayScreenRotationAutoEnabled, out isRotationAutomatic);
477 if (res != SystemSettingsError.None)
479 throw SystemSettingsExceptionFactory.CreateException(res, "unable to get DisplayScreenRotationAuto system setting.");
481 return isRotationAutomatic;
486 /// Indicates the device name.
488 public static string DeviceName
493 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.DeviceName, out deviceName);
494 if (res != SystemSettingsError.None)
496 throw SystemSettingsExceptionFactory.CreateException(res, "unable to get DeviceName system setting value.");
502 /// Indicates whether the device user has enabled the motion feature.
504 public static bool MotionEnabled
508 bool isMotionEnabled;
509 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.MotionEnabled, out isMotionEnabled);
510 if (res != SystemSettingsError.None)
512 throw SystemSettingsExceptionFactory.CreateException(res, "unable to get MotionEnabled system setting value.");
514 return isMotionEnabled;
519 /// Indicates whether Wi-Fi related notifications are enabled on the device.
521 public static bool NetworkWifiNotificationEnabled
525 bool isWifiNotificationEnabled;
526 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.NetworkWifiNotificationEnabled, out isWifiNotificationEnabled);
527 if (res != SystemSettingsError.None)
529 throw SystemSettingsExceptionFactory.CreateException(res, "unable to get NetworkWifiNotification system setting.");
531 return isWifiNotificationEnabled;
536 /// Indicates whether the device is in the flight mode.
538 public static bool NetworkFlightModeEnabled
542 bool isFlightModeEnabled;
543 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.NetworkFlightModeEnabled, out isFlightModeEnabled);
544 if (res != SystemSettingsError.None)
546 throw SystemSettingsExceptionFactory.CreateException(res, "unable to get NetworkFlightMode system setting.");
548 return isFlightModeEnabled;
553 /// Indicates the backlight time (in seconds). The following values can be used: 15, 30, 60, 120, 300, and 600.
555 public static int ScreenBacklightTime
560 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueInt(SystemSettingsKeys.ScreenBacklightTime, out backlightTime);
561 if (res != SystemSettingsError.None)
563 throw SystemSettingsExceptionFactory.CreateException(res, "unable to get ScreenBacklightTime system setting.");
565 return backlightTime;
569 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueInt(SystemSettingsKeys.ScreenBacklightTime, value);
570 if (res != SystemSettingsError.None)
572 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set ScreenBacklightTime system setting.");
578 /// Indicates the file path of the current notification tone set by the user.
580 public static string SoundNotification
585 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.SoundNotification, out filePath);
586 if (res != SystemSettingsError.None)
588 throw SystemSettingsExceptionFactory.CreateException(res, "unable to get SoundNotification system setting.");
594 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.SoundNotification, value);
595 if (res != SystemSettingsError.None)
597 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set SoundNotification system setting.");
603 /// Indicates the time period for notification repetitions.
605 public static int SoundNotificationRepetitionPeriod
609 int notificationRepetitionPeriod;
610 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueInt(SystemSettingsKeys.SoundNotificationRepetitionPeriod, out notificationRepetitionPeriod);
611 if (res != SystemSettingsError.None)
613 throw SystemSettingsExceptionFactory.CreateException(res, "unable to get SoundNotificationRepetitionPeriod system setting.");
615 return notificationRepetitionPeriod;
619 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueInt(SystemSettingsKeys.SoundNotificationRepetitionPeriod, value);
620 if (res != SystemSettingsError.None)
622 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set SoundNotificationRepetitionPeriod system setting.");
628 /// Indicates the current lock state.
630 public static SystemSettingsIdleLockState LockState
635 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueInt(SystemSettingsKeys.LockState, out LockState);
636 if (res != SystemSettingsError.None)
638 throw SystemSettingsExceptionFactory.CreateException(res, "unable to get LockState system setting.");
640 return (SystemSettingsIdleLockState)LockState;
644 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueInt(SystemSettingsKeys.LockState, (int)value);
645 if (res != SystemSettingsError.None)
647 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set LockState system setting.");
653 /// The current system ADS ID.
655 public static string AdsId
660 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.AdsId, out adsId);
661 if (res != SystemSettingsError.None)
663 throw SystemSettingsExceptionFactory.CreateException(res, "unable to get AdsId system setting.");
669 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.AdsId, value);
670 if (res != SystemSettingsError.None)
672 throw SystemSettingsExceptionFactory.CreateException(res, "unable to set AdsId system setting.");
679 /// Indicates the time period for notification repetitions.
681 public static SystemSettingsUdsState UltraDataSave
686 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueInt(SystemSettingsKeys.UltraDataSave, out UltraDataSave);
687 if (res != SystemSettingsError.None)
689 throw SystemSettingsExceptionFactory.CreateException(res, "unable to get UltraDataSave system setting.");
691 return (SystemSettingsUdsState)UltraDataSave;
697 private static readonly Interop.Settings.SystemSettingsChangedCallback s_incomingCallRingtoneChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
699 string path = SystemSettings.IncomingCallRingtone;
700 IncomingCallRingtoneChangedEventArgs eventArgs = new IncomingCallRingtoneChangedEventArgs(path);
701 s_incomingCallRingtoneChanged?.Invoke(null, eventArgs);
703 private static event EventHandler<IncomingCallRingtoneChangedEventArgs> s_incomingCallRingtoneChanged;
705 /// The IncomingCallRingtoneChanged event is triggered when the file path of the incoming ringtone is changed.
707 /// <param name="sender"></param>
708 /// <param name="e">The IncomingCallRingtoneChangedEventArgs object that contains the key and the changed value.</param>
709 public static event EventHandler<IncomingCallRingtoneChangedEventArgs> IncomingCallRingtoneChanged
713 if (s_incomingCallRingtoneChanged == null)
715 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.IncomingCallRingtone, s_incomingCallRingtoneChangedCallback, IntPtr.Zero);
716 if (ret != SystemSettingsError.None)
718 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
721 s_incomingCallRingtoneChanged += value;
726 s_incomingCallRingtoneChanged -= value;
727 if (s_incomingCallRingtoneChanged == null)
729 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.IncomingCallRingtone);
730 if (ret != SystemSettingsError.None)
732 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
738 private static readonly Interop.Settings.SystemSettingsChangedCallback s_wallpaperHomeScreenChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
740 string path = SystemSettings.WallpaperHomeScreen;
741 WallpaperHomeScreenChangedEventArgs eventArgs = new WallpaperHomeScreenChangedEventArgs(path);
742 s_wallpaperHomeScreenChanged?.Invoke(null, eventArgs);
744 private static event EventHandler<WallpaperHomeScreenChangedEventArgs> s_wallpaperHomeScreenChanged;
746 /// THe WallpaperHomeScreenChanged event is triggered when the file path of the current home screen wallpaper is changed.
748 /// <param name="sender"></param>
749 /// <param name="e">The WallpaperHomeScreenChangedEventArgs object that contains the key and the changed value.</param>
750 public static event EventHandler<WallpaperHomeScreenChangedEventArgs> WallpaperHomeScreenChanged
754 if (s_wallpaperHomeScreenChanged == null)
756 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.WallpaperHomeScreen, s_wallpaperHomeScreenChangedCallback, IntPtr.Zero);
757 if (ret != SystemSettingsError.None)
759 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
762 s_wallpaperHomeScreenChanged += value;
767 s_wallpaperHomeScreenChanged -= value;
768 if (s_wallpaperHomeScreenChanged == null)
770 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.WallpaperHomeScreen);
771 if (ret != SystemSettingsError.None)
773 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
779 private static readonly Interop.Settings.SystemSettingsChangedCallback s_wallpaperLockScreenChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
781 string path = SystemSettings.WallpaperLockScreen;
782 WallpaperLockScreenChangedEventArgs eventArgs = new WallpaperLockScreenChangedEventArgs(path);
783 s_wallpaperLockScreenChanged?.Invoke(null, eventArgs);
785 private static event EventHandler<WallpaperLockScreenChangedEventArgs> s_wallpaperLockScreenChanged;
787 /// The WallpaperLockScreenChanged event is triggered when the file path of the current lock screen wallpaper is changed.
789 /// <param name="sender"></param>
790 /// <param name="e">The WallpaperLockScreenChangedEventArgs object that contains the key and the changed value.</param>
791 public static event EventHandler<WallpaperLockScreenChangedEventArgs> WallpaperLockScreenChanged
795 if (s_wallpaperLockScreenChanged == null)
797 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.WallpaperLockScreen, s_wallpaperLockScreenChangedCallback, IntPtr.Zero);
798 if (ret != SystemSettingsError.None)
800 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
803 s_wallpaperLockScreenChanged += value;
808 s_wallpaperLockScreenChanged -= value;
809 if (s_wallpaperLockScreenChanged == null)
811 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.WallpaperLockScreen);
812 if (ret != SystemSettingsError.None)
814 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
820 private static readonly Interop.Settings.SystemSettingsChangedCallback s_fontSizeChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
822 SystemSettingsFontSize fontSize = SystemSettings.FontSize;
823 FontSizeChangedEventArgs eventArgs = new FontSizeChangedEventArgs(fontSize);
824 s_fontSizeChanged?.Invoke(null, eventArgs);
826 private static event EventHandler<FontSizeChangedEventArgs> s_fontSizeChanged;
828 /// The FontSizeChanged event is triggered when the current system font size is changed.
830 /// <param name="sender"></param>
831 /// <param name="e">The FontSizeChangedEventArgs object that contains the key and the changed value.</param>
832 public static event EventHandler<FontSizeChangedEventArgs> FontSizeChanged
836 if (s_fontSizeChanged == null)
838 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.FontSize, s_fontSizeChangedCallback, IntPtr.Zero);
839 if (ret != SystemSettingsError.None)
841 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
844 s_fontSizeChanged += value;
849 s_fontSizeChanged -= value;
850 if (s_fontSizeChanged == null)
852 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.FontSize);
853 if (ret != SystemSettingsError.None)
855 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
861 private static readonly Interop.Settings.SystemSettingsChangedCallback s_fontTypeChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
863 string fontType = SystemSettings.FontType;
864 FontTypeChangedEventArgs eventArgs = new FontTypeChangedEventArgs(fontType);
865 s_fontTypeChanged?.Invoke(null, eventArgs);
867 private static event EventHandler<FontTypeChangedEventArgs> s_fontTypeChanged;
869 /// The FontTypeChanged event is triggered when the current system font type is changed.
871 /// <param name="sender"></param>
872 /// <param name="e">The FontTypeChangedEventArgs object that contains the key and the changed value.</param>
873 public static event EventHandler<FontTypeChangedEventArgs> FontTypeChanged
877 if (s_fontTypeChanged == null)
879 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.FontType, s_fontTypeChangedCallback, IntPtr.Zero);
880 if (ret != SystemSettingsError.None)
882 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
885 s_fontTypeChanged += value;
890 s_fontTypeChanged -= value;
891 if (s_fontTypeChanged == null)
893 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.FontType);
894 if (ret != SystemSettingsError.None)
896 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
902 private static readonly Interop.Settings.SystemSettingsChangedCallback s_motionActivationChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
904 bool motionActivation = SystemSettings.MotionActivationEnabled;
905 MotionActivationSettingChangedEventArgs eventArgs = new MotionActivationSettingChangedEventArgs(motionActivation);
906 s_motionActivationChanged?.Invoke(null, eventArgs);
908 private static event EventHandler<MotionActivationSettingChangedEventArgs> s_motionActivationChanged;
910 /// The MotionActivationChanged event is triggered when the motion service status is changed.
912 /// <param name="sender"></param>
913 /// <param name="e">The MotionActivationChangedEventArgs object that contains the key and the changed value.</param>
914 public static event EventHandler<MotionActivationSettingChangedEventArgs> MotionActivationSettingChanged
918 if (s_motionActivationChanged == null)
920 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.MotionActivationEnabled, s_motionActivationChangedCallback, IntPtr.Zero);
921 if (ret != SystemSettingsError.None)
923 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
926 s_motionActivationChanged += value;
931 s_motionActivationChanged -= value;
932 if (s_motionActivationChanged == null)
934 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.MotionActivationEnabled);
935 if (ret != SystemSettingsError.None)
937 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
943 private static readonly Interop.Settings.SystemSettingsChangedCallback s_emailAlertRingtoneChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
945 string emailAlertRingtone = SystemSettings.EmailAlertRingtone;
946 EmailAlertRingtoneChangedEventArgs eventArgs = new EmailAlertRingtoneChangedEventArgs(emailAlertRingtone);
947 s_emailAlertRingtoneChanged?.Invoke(null, eventArgs);
949 private static event EventHandler<EmailAlertRingtoneChangedEventArgs> s_emailAlertRingtoneChanged;
951 /// The EmailAlertRingtoneChanged event is triggered when the file path of the current email alert ringtone is changed.
953 /// <param name="sender"></param>
954 /// <param name="e">The EmailAlertRingtoneChangedEventArgs object that contains the key and the changed value.</param>
955 public static event EventHandler<EmailAlertRingtoneChangedEventArgs> EmailAlertRingtoneChanged
959 if (s_emailAlertRingtoneChanged == null)
961 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.EmailAlertRingtone, s_emailAlertRingtoneChangedCallback, IntPtr.Zero);
962 if (ret != SystemSettingsError.None)
964 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
967 s_emailAlertRingtoneChanged += value;
972 s_emailAlertRingtoneChanged -= value;
973 if (s_emailAlertRingtoneChanged == null)
975 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.EmailAlertRingtone);
976 if (ret != SystemSettingsError.None)
978 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
984 private static readonly Interop.Settings.SystemSettingsChangedCallback s_usbDebuggingSettingChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
986 bool usbDebuggingEnabled = SystemSettings.UsbDebuggingEnabled;
987 UsbDebuggingSettingChangedEventArgs eventArgs = new UsbDebuggingSettingChangedEventArgs(usbDebuggingEnabled);
988 s_usbDebuggingSettingChanged?.Invoke(null, eventArgs);
990 private static event EventHandler<UsbDebuggingSettingChangedEventArgs> s_usbDebuggingSettingChanged;
992 /// The UsbDebuggingSettingChangedEventArgs event is triggered when the USB debugging status is changed.
994 /// <param name="sender"></param>
995 /// <param name="e">The UsbDebuggingSettingChangedEventArgs object that contains the key and the changed value.</param>
996 public static event EventHandler<UsbDebuggingSettingChangedEventArgs> UsbDebuggingSettingChanged
1000 if (s_usbDebuggingSettingChanged == null)
1002 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.UsbDebuggingEnabled, s_usbDebuggingSettingChangedCallback, IntPtr.Zero);
1003 if (ret != SystemSettingsError.None)
1005 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1008 s_usbDebuggingSettingChanged += value;
1013 s_usbDebuggingSettingChanged -= value;
1014 if (s_usbDebuggingSettingChanged == null)
1016 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.UsbDebuggingEnabled);
1017 if (ret != SystemSettingsError.None)
1019 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1025 private static readonly Interop.Settings.SystemSettingsChangedCallback s_data3GNetworkSettingChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1027 bool data3GEnabled = SystemSettings.Data3GNetworkEnabled;
1028 Data3GNetworkSettingChangedEventArgs eventArgs = new Data3GNetworkSettingChangedEventArgs(data3GEnabled);
1029 s_data3GNetworkSettingChanged?.Invoke(null, eventArgs);
1031 private static event EventHandler<Data3GNetworkSettingChangedEventArgs> s_data3GNetworkSettingChanged;
1033 /// The Data3GNetworkSettingChanged event is triggered when the 3G data network status is changed.
1035 /// <param name="sender"></param>
1036 /// <param name="e">The Data3GNetworkSettingChangedEventArgs object that contains the key and the changed value.</param>
1037 public static event EventHandler<Data3GNetworkSettingChangedEventArgs> Data3GNetworkSettingChanged
1041 if (s_data3GNetworkSettingChanged == null)
1043 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.Data3GNetworkEnabled, s_data3GNetworkSettingChangedCallback, IntPtr.Zero);
1044 if (ret != SystemSettingsError.None)
1046 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1049 s_data3GNetworkSettingChanged += value;
1054 s_data3GNetworkSettingChanged -= value;
1055 if (s_data3GNetworkSettingChanged == null)
1057 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.Data3GNetworkEnabled);
1058 if (ret != SystemSettingsError.None)
1060 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1066 private static readonly Interop.Settings.SystemSettingsChangedCallback s_lockscreenAppChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1068 string lockScreenApp = SystemSettings.LockscreenApp;
1069 LockscreenAppChangedEventArgs eventArgs = new LockscreenAppChangedEventArgs(lockScreenApp);
1070 s_lockscreenAppChanged?.Invoke(null, eventArgs);
1072 private static event EventHandler<LockscreenAppChangedEventArgs> s_lockscreenAppChanged;
1074 /// The LockscreenAppChanged event is triggered when the lockscreen application package name is changed.
1076 /// <param name="sender"></param>
1077 /// <param name="e">The LockscreenAppChangedEventArgs object that contains the key and the changed value.</param>
1078 public static event EventHandler<LockscreenAppChangedEventArgs> LockscreenAppChanged
1082 if (s_lockscreenAppChanged == null)
1084 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LockscreenApp, s_lockscreenAppChangedCallback, IntPtr.Zero);
1085 if (ret != SystemSettingsError.None)
1087 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1090 s_lockscreenAppChanged += value;
1095 s_lockscreenAppChanged -= value;
1096 if (s_lockscreenAppChanged == null)
1098 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LockscreenApp);
1099 if (ret != SystemSettingsError.None)
1101 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1107 private static readonly Interop.Settings.SystemSettingsChangedCallback s_localeCountryChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1109 string localeCountry = SystemSettings.LocaleCountry;
1110 LocaleCountryChangedEventArgs eventArgs = new LocaleCountryChangedEventArgs(localeCountry);
1111 s_localeCountryChanged?.Invoke(null, eventArgs);
1113 private static event EventHandler<LocaleCountryChangedEventArgs> s_localeCountryChanged;
1115 /// The LocaleCountryChanged event is triggered when the current country setting in the <LANGUAGE>_<REGION> syntax, is changed.
1117 /// <param name="sender"></param>
1118 /// <param name="e">The LocaleCountryChangedEventArgs object that contains the key and the changed value.</param>
1119 public static event EventHandler<LocaleCountryChangedEventArgs> LocaleCountryChanged
1123 if (s_localeCountryChanged == null)
1125 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LocaleCountry, s_localeCountryChangedCallback, IntPtr.Zero);
1126 if (ret != SystemSettingsError.None)
1128 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1131 s_localeCountryChanged += value;
1136 s_localeCountryChanged -= value;
1137 if (s_localeCountryChanged == null)
1139 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LocaleCountry);
1140 if (ret != SystemSettingsError.None)
1142 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1148 private static readonly Interop.Settings.SystemSettingsChangedCallback s_localeLanguageChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1150 string localeLanguage = SystemSettings.LocaleLanguage;
1151 LocaleLanguageChangedEventArgs eventArgs = new LocaleLanguageChangedEventArgs(localeLanguage);
1152 s_localeLanguageChanged?.Invoke(null, eventArgs);
1154 private static event EventHandler<LocaleLanguageChangedEventArgs> s_localeLanguageChanged;
1156 /// The LocaleLanguageChanged event is triggered when the current language setting in the <LANGUAGE>_<REGION> syntax, is changed.
1158 /// <param name="sender"></param>
1159 /// <param name="e">The LocaleLanguageChangedEventArgs object that contains the key and the changed value.</param>
1160 public static event EventHandler<LocaleLanguageChangedEventArgs> LocaleLanguageChanged
1164 if (s_localeLanguageChanged == null)
1166 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LocaleLanguage, s_localeLanguageChangedCallback, IntPtr.Zero);
1167 if (ret != SystemSettingsError.None)
1169 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1172 s_localeLanguageChanged += value;
1177 s_localeLanguageChanged -= value;
1178 if (s_localeLanguageChanged == null)
1180 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LocaleLanguage);
1181 if (ret != SystemSettingsError.None)
1183 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1189 private static readonly Interop.Settings.SystemSettingsChangedCallback s_localeTimeFormat24HourChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1191 bool localeTimeFormat24Hour = SystemSettings.LocaleTimeFormat24HourEnabled;
1192 LocaleTimeFormat24HourSettingChangedEventArgs eventArgs = new LocaleTimeFormat24HourSettingChangedEventArgs(localeTimeFormat24Hour);
1193 s_localeTimeFormat24HourChanged?.Invoke(null, eventArgs);
1195 private static event EventHandler<LocaleTimeFormat24HourSettingChangedEventArgs> s_localeTimeFormat24HourChanged;
1197 /// The LocaleTimeFormat24HourChanged event is triggered when the time format is changed.
1199 /// <param name="sender"></param>
1200 /// <param name="e">The LocaleTimeFormat24HourChangedEventArgs object that contains the key and the changed value.</param>
1201 public static event EventHandler<LocaleTimeFormat24HourSettingChangedEventArgs> LocaleTimeFormat24HourSettingChanged
1205 if (s_localeTimeFormat24HourChanged == null)
1207 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LocaleTimeFormat24HourEnabled, s_localeTimeFormat24HourChangedCallback, IntPtr.Zero);
1208 if (ret != SystemSettingsError.None)
1210 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1213 s_localeTimeFormat24HourChanged += value;
1218 s_localeTimeFormat24HourChanged -= value;
1219 if (s_localeTimeFormat24HourChanged == null)
1221 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LocaleTimeFormat24HourEnabled);
1222 if (ret != SystemSettingsError.None)
1224 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1230 private static readonly Interop.Settings.SystemSettingsChangedCallback s_localeTimeZoneChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1232 string localeTimeZone = SystemSettings.LocaleTimeZone;
1233 LocaleTimeZoneChangedEventArgs eventArgs = new LocaleTimeZoneChangedEventArgs(localeTimeZone);
1234 s_localeTimeZoneChanged?.Invoke(null, eventArgs);
1236 private static event EventHandler<LocaleTimeZoneChangedEventArgs> s_localeTimeZoneChanged;
1238 /// The LocaleTimeZoneChanged event is triggered when the current time zone is changed.
1240 /// <param name="sender"></param>
1241 /// <param name="e">The LocaleTimeZoneChangedEventArgs object that contains the key and the changed value.</param>
1242 public static event EventHandler<LocaleTimeZoneChangedEventArgs> LocaleTimeZoneChanged
1246 if (s_localeTimeZoneChanged == null)
1248 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LocaleTimeZone, s_localeTimeZoneChangedCallback, IntPtr.Zero);
1249 if (ret != SystemSettingsError.None)
1251 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1254 s_localeTimeZoneChanged += value;
1259 s_localeTimeZoneChanged -= value;
1260 if (s_localeTimeZoneChanged == null)
1262 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LocaleTimeZone);
1263 if (ret != SystemSettingsError.None)
1265 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1271 private static readonly Interop.Settings.SystemSettingsChangedCallback s_timeChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1274 int time = SystemSettings.Time;
1275 TimeChangedEventArgs eventArgs = new TimeChangedEventArgs(time);
1276 s_timeChanged?.Invoke(null, eventArgs);
1278 private static event EventHandler<TimeChangedEventArgs> s_timeChanged;
1280 /// The TimeChanged event is triggered when the system time is changed.
1282 /// <param name="sender"></param>
1283 /// <param name="e">The TimeChangedEventArgs object that contains the key and the changed value.</param>
1284 public static event EventHandler<TimeChangedEventArgs> TimeChanged
1288 if (s_timeChanged == null)
1290 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.Time, s_timeChangedCallback, IntPtr.Zero);
1291 if (ret != SystemSettingsError.None)
1293 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1296 s_timeChanged += value;
1301 s_timeChanged -= value;
1302 if (s_timeChanged == null)
1304 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.Time);
1305 if (ret != SystemSettingsError.None)
1307 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1313 private static readonly Interop.Settings.SystemSettingsChangedCallback s_soundLockChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1315 bool soundLock = SystemSettings.SoundLockEnabled;
1316 SoundLockSettingChangedEventArgs eventArgs = new SoundLockSettingChangedEventArgs(soundLock);
1317 s_soundLockChanged?.Invoke(null, eventArgs);
1319 private static event EventHandler<SoundLockSettingChangedEventArgs> s_soundLockChanged;
1321 /// The SoundLockChanged event is triggered when the screen lock sound enabled status is changed.
1323 /// <param name="sender"></param>
1324 /// <param name="e">The SoundLockChangedEventArgs object that contains the key and the changed value.</param>
1325 public static event EventHandler<SoundLockSettingChangedEventArgs> SoundLockSettingChanged
1329 if (s_soundLockChanged == null)
1331 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.SoundLockEnabled, s_soundLockChangedCallback, IntPtr.Zero);
1332 if (ret != SystemSettingsError.None)
1334 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1337 s_soundLockChanged += value;
1342 s_soundLockChanged -= value;
1343 if (s_soundLockChanged == null)
1345 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.SoundLockEnabled);
1346 if (ret != SystemSettingsError.None)
1348 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1354 private static readonly Interop.Settings.SystemSettingsChangedCallback s_soundSilentModeChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1356 bool soundSilentMode = SystemSettings.SoundSilentModeEnabled;
1357 SoundSilentModeSettingChangedEventArgs eventArgs = new SoundSilentModeSettingChangedEventArgs(soundSilentMode);
1358 s_soundSilentModeChanged?.Invoke(null, eventArgs);
1360 private static event EventHandler<SoundSilentModeSettingChangedEventArgs> s_soundSilentModeChanged;
1362 /// The SoundSilentModeChanged event is triggered when the silent mode status is changed.
1364 /// <param name="sender"></param>
1365 /// <param name="e">The SoundSilentModeChangedEventArgs object that contains the key and the changed value.</param>
1366 public static event EventHandler<SoundSilentModeSettingChangedEventArgs> SoundSilentModeSettingChanged
1370 if (s_soundSilentModeChanged == null)
1372 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.SoundSilentModeEnabled, s_soundSilentModeChangedCallback, IntPtr.Zero);
1373 if (ret != SystemSettingsError.None)
1375 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1378 s_soundSilentModeChanged += value;
1383 s_soundSilentModeChanged -= value;
1384 if (s_soundSilentModeChanged == null)
1386 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.SoundSilentModeEnabled);
1387 if (ret != SystemSettingsError.None)
1389 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1395 private static readonly Interop.Settings.SystemSettingsChangedCallback s_soundTouchChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1397 bool soundTouch = SystemSettings.SoundTouchEnabled;
1398 SoundTouchSettingChangedEventArgs eventArgs = new SoundTouchSettingChangedEventArgs(soundTouch);
1399 s_soundTouchChanged?.Invoke(null, eventArgs);
1401 private static event EventHandler<SoundTouchSettingChangedEventArgs> s_soundTouchChanged;
1403 /// THe SoundTouchChanged event is triggered when the screen touch sound enabled status is changed.
1405 /// <param name="sender"></param>
1406 /// <param name="e">The SoundTouchChangedEventArgs object that contains the key and the changed value.</param>
1407 public static event EventHandler<SoundTouchSettingChangedEventArgs> SoundTouchSettingChanged
1411 if (s_soundTouchChanged == null)
1413 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.SoundTouchEnabled, s_soundTouchChangedCallback, IntPtr.Zero);
1414 if (ret != SystemSettingsError.None)
1416 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1419 s_soundTouchChanged += value;
1424 s_soundTouchChanged -= value;
1425 if (s_soundTouchChanged == null)
1427 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.SoundTouchEnabled);
1428 if (ret != SystemSettingsError.None)
1430 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1436 private static readonly Interop.Settings.SystemSettingsChangedCallback s_displayScreenRotationAutoChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1438 bool displayScreenRotationAuto = SystemSettings.DisplayScreenRotationAutoEnabled;
1439 DisplayScreenRotationAutoSettingChangedEventArgs eventArgs = new DisplayScreenRotationAutoSettingChangedEventArgs(displayScreenRotationAuto);
1440 s_displayScreenRotationAutoChanged?.Invoke(null, eventArgs);
1442 private static event EventHandler<DisplayScreenRotationAutoSettingChangedEventArgs> s_displayScreenRotationAutoChanged;
1444 /// The DisplayScreenRotationAutoChanged event is triggered when the automatic rotation control status is changed.
1446 /// <param name="sender"></param>
1447 /// <param name="e">The DisplayScreenRotationAutoChangedEventArgs object that contains the key and the changed value.</param>
1448 public static event EventHandler<DisplayScreenRotationAutoSettingChangedEventArgs> DisplayScreenRotationAutoSettingChanged
1452 if (s_displayScreenRotationAutoChanged == null)
1454 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.DisplayScreenRotationAutoEnabled, s_displayScreenRotationAutoChangedCallback, IntPtr.Zero);
1455 if (ret != SystemSettingsError.None)
1457 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1460 s_displayScreenRotationAutoChanged += value;
1465 s_displayScreenRotationAutoChanged -= value;
1466 if (s_displayScreenRotationAutoChanged == null)
1468 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.DisplayScreenRotationAutoEnabled);
1469 if (ret != SystemSettingsError.None)
1471 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1477 private static readonly Interop.Settings.SystemSettingsChangedCallback s_deviceNameChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1479 string deviceName = SystemSettings.DeviceName;
1480 DeviceNameChangedEventArgs eventArgs = new DeviceNameChangedEventArgs(deviceName);
1481 s_deviceNameChanged?.Invoke(null, eventArgs);
1483 private static event EventHandler<DeviceNameChangedEventArgs> s_deviceNameChanged;
1485 /// The DeviceNameChanged event is triggered when the device name is changed.
1487 /// <param name="sender"></param>
1488 /// <param name="e">The DeviceNameChangedEventArgs object that contains the key and the changed value.</param>
1489 public static event EventHandler<DeviceNameChangedEventArgs> DeviceNameChanged
1493 if (s_deviceNameChanged == null)
1495 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.DeviceName, s_deviceNameChangedCallback, IntPtr.Zero);
1496 if (ret != SystemSettingsError.None)
1498 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1501 s_deviceNameChanged += value;
1506 s_deviceNameChanged -= value;
1507 if (s_deviceNameChanged == null)
1509 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.DeviceName);
1510 if (ret != SystemSettingsError.None)
1512 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1518 private static readonly Interop.Settings.SystemSettingsChangedCallback s_motionSettingChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1520 bool motionEnabled = SystemSettings.MotionEnabled;
1521 MotionSettingChangedEventArgs eventArgs = new MotionSettingChangedEventArgs(motionEnabled);
1522 s_motionSettingChanged?.Invoke(null, eventArgs);
1524 private static event EventHandler<MotionSettingChangedEventArgs> s_motionSettingChanged;
1526 /// The MotionSettingChanged event is triggered when the motion feature enabled status is changed.
1528 /// <param name="sender"></param>
1529 /// <param name="e">The MotionSettingChangedEventArgs object that contains the key and the changed value.</param>
1530 public static event EventHandler<MotionSettingChangedEventArgs> MotionSettingChanged
1534 if (s_motionSettingChanged == null)
1536 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.MotionEnabled, s_motionSettingChangedCallback, IntPtr.Zero);
1537 if (ret != SystemSettingsError.None)
1539 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1542 s_motionSettingChanged += value;
1547 s_motionSettingChanged -= value;
1548 if (s_motionSettingChanged == null)
1550 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.MotionEnabled);
1551 if (ret != SystemSettingsError.None)
1553 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1559 private static readonly Interop.Settings.SystemSettingsChangedCallback s_networkWifiNotificationChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1561 bool networkWifiNotification = SystemSettings.NetworkWifiNotificationEnabled;
1562 NetworkWifiNotificationSettingChangedEventArgs eventArgs = new NetworkWifiNotificationSettingChangedEventArgs(networkWifiNotification);
1563 s_networkWifiNotificationChanged?.Invoke(null, eventArgs);
1565 private static event EventHandler<NetworkWifiNotificationSettingChangedEventArgs> s_networkWifiNotificationChanged;
1567 /// The NetworkWifiNotificationChanged event is triggered when the WiFi-related notifications enabled status is changed.
1569 /// <param name="sender"></param>
1570 /// <param name="e">The NetworkWifiNotificationChangedEventArgs object that contains the key and the changed value.</param>
1571 public static event EventHandler<NetworkWifiNotificationSettingChangedEventArgs> NetworkWifiNotificationSettingChanged
1575 if (s_networkWifiNotificationChanged == null)
1577 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.NetworkWifiNotificationEnabled, s_networkWifiNotificationChangedCallback, IntPtr.Zero);
1578 if (ret != SystemSettingsError.None)
1580 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1583 s_networkWifiNotificationChanged += value;
1588 s_networkWifiNotificationChanged -= value;
1589 if (s_networkWifiNotificationChanged == null)
1591 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.NetworkWifiNotificationEnabled);
1592 if (ret != SystemSettingsError.None)
1594 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1600 private static readonly Interop.Settings.SystemSettingsChangedCallback s_networkFlightModeChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1602 bool networkFlightMode = SystemSettings.NetworkFlightModeEnabled;
1603 NetworkFlightModeSettingChangedEventArgs eventArgs = new NetworkFlightModeSettingChangedEventArgs(networkFlightMode);
1604 s_networkFlightModeChanged?.Invoke(null, eventArgs);
1606 private static event EventHandler<NetworkFlightModeSettingChangedEventArgs> s_networkFlightModeChanged;
1608 /// The NetworkFlightModeChanged event is triggered when the flight mode status is changed.
1610 /// <param name="sender"></param>
1611 /// <param name="e">The NetworkFlightModeChangedEventArgs object that contains the key and the changed value.</param>
1612 public static event EventHandler<NetworkFlightModeSettingChangedEventArgs> NetworkFlightModeSettingChanged
1616 if (s_networkFlightModeChanged == null)
1618 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.NetworkFlightModeEnabled, s_networkFlightModeChangedCallback, IntPtr.Zero);
1619 if (ret != SystemSettingsError.None)
1621 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1624 s_networkFlightModeChanged += value;
1629 s_networkFlightModeChanged -= value;
1630 if (s_networkFlightModeChanged == null)
1632 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.NetworkFlightModeEnabled);
1633 if (ret != SystemSettingsError.None)
1635 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1641 private static readonly Interop.Settings.SystemSettingsChangedCallback s_screenBacklightTimeChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1643 int screenBacklightTime = SystemSettings.ScreenBacklightTime;
1644 ScreenBacklightTimeChangedEventArgs eventArgs = new ScreenBacklightTimeChangedEventArgs(screenBacklightTime);
1645 s_screenBacklightTimeChanged?.Invoke(null, eventArgs);
1647 private static event EventHandler<ScreenBacklightTimeChangedEventArgs> s_screenBacklightTimeChanged;
1649 /// THe ScreenBacklightTimeChanged event is triggered when the backlight time is changed.
1651 /// <param name="sender"></param>
1652 /// <param name="e">The ScreenBacklightTimeChangedEventArgs object that contains the key and the changed value.</param>
1653 public static event EventHandler<ScreenBacklightTimeChangedEventArgs> ScreenBacklightTimeChanged
1657 if (s_screenBacklightTimeChanged == null)
1659 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.ScreenBacklightTime, s_screenBacklightTimeChangedCallback, IntPtr.Zero);
1660 if (ret != SystemSettingsError.None)
1662 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1665 s_screenBacklightTimeChanged += value;
1670 s_screenBacklightTimeChanged -= value;
1671 if (s_screenBacklightTimeChanged == null)
1673 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.ScreenBacklightTime);
1674 if (ret != SystemSettingsError.None)
1676 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1682 private static readonly Interop.Settings.SystemSettingsChangedCallback s_soundNotificationChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1684 string soundNotification = SystemSettings.SoundNotification;
1685 SoundNotificationChangedEventArgs eventArgs = new SoundNotificationChangedEventArgs(soundNotification);
1686 s_soundNotificationChanged?.Invoke(null, eventArgs);
1688 private static event EventHandler<SoundNotificationChangedEventArgs> s_soundNotificationChanged;
1690 /// The SoundNotificationChanged event is triggered when the file path of the current notification tone set by the user is changed.
1692 /// <param name="sender"></param>
1693 /// <param name="e">The SoundNotificationChangedEventArgs object that contains the key and the changed value.</param>
1694 public static event EventHandler<SoundNotificationChangedEventArgs> SoundNotificationChanged
1698 if (s_soundNotificationChanged == null)
1700 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.SoundNotification, s_soundNotificationChangedCallback, IntPtr.Zero);
1701 if (ret != SystemSettingsError.None)
1703 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1706 s_soundNotificationChanged += value;
1711 s_soundNotificationChanged -= value;
1712 if (s_soundNotificationChanged == null)
1714 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.SoundNotification);
1715 if (ret != SystemSettingsError.None)
1717 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1723 private static readonly Interop.Settings.SystemSettingsChangedCallback s_soundNotificationRepetitionPeriodChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1725 int soundNotificationRepetitionPeriod = SystemSettings.SoundNotificationRepetitionPeriod;
1726 SoundNotificationRepetitionPeriodChangedEventArgs eventArgs = new SoundNotificationRepetitionPeriodChangedEventArgs(soundNotificationRepetitionPeriod);
1727 s_soundNotificationRepetitionPeriodChanged?.Invoke(null, eventArgs);
1729 private static event EventHandler<SoundNotificationRepetitionPeriodChangedEventArgs> s_soundNotificationRepetitionPeriodChanged;
1731 /// The SoundNotificationRepetitionPeriodChanged event is triggered when the time period for notification repetitions is changed.
1733 /// <param name="sender"></param>
1734 /// <param name="e">The SoundNotificationRepetitionPeriodChangedEventArgs object that contains the key and the changed value.</param>
1735 public static event EventHandler<SoundNotificationRepetitionPeriodChangedEventArgs> SoundNotificationRepetitionPeriodChanged
1739 if (s_soundNotificationRepetitionPeriodChanged == null)
1741 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.SoundNotificationRepetitionPeriod, s_soundNotificationRepetitionPeriodChangedCallback, IntPtr.Zero);
1742 if (ret != SystemSettingsError.None)
1744 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1747 s_soundNotificationRepetitionPeriodChanged += value;
1752 s_soundNotificationRepetitionPeriodChanged -= value;
1753 if (s_soundNotificationRepetitionPeriodChanged == null)
1755 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.SoundNotificationRepetitionPeriod);
1756 if (ret != SystemSettingsError.None)
1758 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1764 private static readonly Interop.Settings.SystemSettingsChangedCallback s_lockStateChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1766 SystemSettingsIdleLockState lockState = SystemSettings.LockState;
1767 LockStateChangedEventArgs eventArgs = new LockStateChangedEventArgs(lockState);
1768 s_lockStateChanged?.Invoke(null, eventArgs);
1770 private static event EventHandler<LockStateChangedEventArgs> s_lockStateChanged;
1772 /// The LockStateChanged event is triggered when the current lock state is changed.
1774 /// <param name="sender"></param>
1775 /// <param name="e">The LockStateChangedEventArgs object that contains the key and the changed value.</param>
1776 public static event EventHandler<LockStateChangedEventArgs> LockStateChanged
1780 if (s_lockStateChanged == null)
1782 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LockState, s_lockStateChangedCallback, IntPtr.Zero);
1783 if (ret != SystemSettingsError.None)
1785 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1788 s_lockStateChanged += value;
1793 s_lockStateChanged -= value;
1794 if (s_lockStateChanged == null)
1796 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LockState);
1797 if (ret != SystemSettingsError.None)
1799 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1805 private static readonly Interop.Settings.SystemSettingsChangedCallback s_adsIdChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1807 string adsId = SystemSettings.AdsId;
1808 AdsIdChangedEventArgs eventArgs = new AdsIdChangedEventArgs(adsId);
1809 s_adsIdChanged?.Invoke(null, eventArgs);
1811 private static event EventHandler<AdsIdChangedEventArgs> s_adsIdChanged;
1813 /// The AdsIdChanged event is triggered when the current ADS ID state is changed.
1815 /// <param name="sender"></param>
1816 /// <param name="e">The AdsIdChangedEventArgs object that contains the key and the changed value.</param>
1817 public static event EventHandler<AdsIdChangedEventArgs> AdsIdChanged
1821 if (s_adsIdChanged == null)
1823 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.AdsId, s_adsIdChangedCallback, IntPtr.Zero);
1824 if (ret != SystemSettingsError.None)
1826 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1829 s_adsIdChanged += value;
1834 s_adsIdChanged -= value;
1835 if (s_adsIdChanged == null)
1837 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.AdsId);
1838 if (ret != SystemSettingsError.None)
1840 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1846 private static readonly Interop.Settings.SystemSettingsChangedCallback s_ultraDataSaveChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1848 SystemSettingsUdsState ultraDataSave = SystemSettings.UltraDataSave;
1849 UltraDataSaveChangedEventArgs eventArgs = new UltraDataSaveChangedEventArgs(ultraDataSave);
1850 s_ultraDataSaveChanged?.Invoke(null, eventArgs);
1852 private static event EventHandler<UltraDataSaveChangedEventArgs> s_ultraDataSaveChanged;
1854 /// The UltraDataSaveChanged event is triggered when the current Ultra Data Save state is changed.
1856 /// <param name="sender"></param>
1857 /// <param name="e">The UltraDataSaveChangedEventArgs object that contains the key and the changed value.</param>
1858 public static event EventHandler<UltraDataSaveChangedEventArgs> UltraDataSaveChanged
1862 if (s_ultraDataSaveChanged == null)
1864 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.UltraDataSave, s_ultraDataSaveChangedCallback, IntPtr.Zero);
1865 if (ret != SystemSettingsError.None)
1867 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1870 s_ultraDataSaveChanged += value;
1875 s_ultraDataSaveChanged -= value;
1876 if (s_ultraDataSaveChanged == null)
1878 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.UltraDataSave);
1879 if (ret != SystemSettingsError.None)
1881 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1887 private static readonly Interop.Settings.SystemSettingsChangedCallback s_ultraDataSavePackageListChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1889 string ultraDataSavePackageList = "None";
1890 UltraDataSavePackageListChangedEventArgs eventArgs = new UltraDataSavePackageListChangedEventArgs(ultraDataSavePackageList);
1891 s_ultraDataSavePackageListChanged?.Invoke(null, eventArgs);
1893 private static event EventHandler<UltraDataSavePackageListChangedEventArgs> s_ultraDataSavePackageListChanged;
1895 /// The UltraDataSavePackageListChanged event is triggered when the current ADS ID state is changed.
1897 /// <param name="sender"></param>
1898 /// <param name="e">The UltraDataSavePackageListChangedEventArgs object that contains the key and the changed value.</param>
1899 public static event EventHandler<UltraDataSavePackageListChangedEventArgs> UltraDataSavePackageListChanged
1903 if (s_ultraDataSavePackageListChanged == null)
1905 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.UltraDataSavePackageList, s_ultraDataSavePackageListChangedCallback, IntPtr.Zero);
1906 if (ret != SystemSettingsError.None)
1908 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1911 s_ultraDataSavePackageListChanged += value;
1916 s_ultraDataSavePackageListChanged -= value;
1917 if (s_ultraDataSavePackageListChanged == null)
1919 SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.UltraDataSavePackageList);
1920 if (ret != SystemSettingsError.None)
1922 throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");