Fixed comment for doxygen.
[platform/core/csapi/system-settings.git] / Tizen.System.SystemSettings / Tizen.System.SystemSettings / SystemSettings.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 using System;
18
19 namespace Tizen.System
20 {
21     /// <summary>
22     /// The System Settings API provides APIs for sharing configuration over a system
23     /// </summary>
24     /// <remarks>
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
27     /// </remarks>
28     public static class SystemSettings
29     {
30         /// <summary>
31         /// The file path of the current ringtone
32         /// </summary>
33         public static string IncomingCallRingtone
34         {
35             get
36             {
37                 string filePath;
38                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.IncomingCallRingtone, out filePath);
39                 if (res != SystemSettingsError.None)
40                 {
41                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to get IncomingCallRingtone system setting.");
42                 }
43                 return filePath;
44             }
45             set
46             {
47                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.IncomingCallRingtone, value);
48                 if (res != SystemSettingsError.None)
49                 {
50                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to set IncomingCallRingtone system setting.");
51                 }
52             }
53         }
54
55         /// <summary>
56         /// The file path of the current home screen wallpaper
57         /// </summary>
58         public static string WallpaperHomeScreen
59         {
60             get
61             {
62                 string filePath;
63                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.WallpaperHomeScreen, out filePath);
64                 if (res != SystemSettingsError.None)
65                 {
66                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to get WallpaperHomeScreen system setting.");
67                 }
68                 return filePath;
69             }
70             set
71             {
72                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.WallpaperHomeScreen, value);
73                 if (res != SystemSettingsError.None)
74                 {
75                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to set WallpaperHomeScreen system setting.");
76                 }
77             }
78         }
79
80         /// <summary>
81         /// The file path of the current lock screen wallpaper
82         /// </summary>
83         public static string WallpaperLockScreen
84         {
85             get
86             {
87                 string filePath;
88                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.WallpaperLockScreen, out filePath);
89                 if (res != SystemSettingsError.None)
90                 {
91                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to get WallpaperLockScreen system setting.");
92                 }
93                 return filePath;
94             }
95             set
96             {
97                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.WallpaperLockScreen, value);
98                 if (res != SystemSettingsError.None)
99                 {
100                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to set WallpaperLockScreen system setting.");
101                 }
102             }
103         }
104
105         /// <summary>
106         /// The current system font size
107         /// </summary>
108         public static SystemSettingsFontSize FontSize
109         {
110             get
111             {
112                 int fontSize;
113                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueInt(SystemSettingsKeys.FontSize, out fontSize);
114                 if (res != SystemSettingsError.None)
115                 {
116                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to get FontSize system setting.");
117                 }
118                 return (SystemSettingsFontSize)fontSize;
119             }
120             set
121             {
122                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueInt(SystemSettingsKeys.FontSize, (int)value);
123                 if (res != SystemSettingsError.None)
124                 {
125                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to set FontSize system setting.");
126                 }
127             }
128         }
129
130         /// <summary>
131         /// The current system font type
132         /// </summary>
133         public static string FontType
134         {
135             get
136             {
137                 string fontType;
138                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.FontType, out fontType);
139                 if (res != SystemSettingsError.None)
140                 {
141                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to get FontType system setting.");
142                 }
143                 return fontType;
144             }
145             set
146             {
147                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.FontType, value);
148                 if (res != SystemSettingsError.None)
149                 {
150                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to set FontType system setting.");
151                 }
152             }
153         }
154
155         /// <summary>
156         /// Indicates whether the motion service is activated
157         /// </summary>
158         public static bool MotionActivationEnabled
159         {
160             get
161             {
162                 bool isMotionServiceActivated;
163                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.MotionActivationEnabled, out isMotionServiceActivated);
164                 if (res != SystemSettingsError.None)
165                 {
166                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to get MotionActivation system setting.");
167                 }
168                 return isMotionServiceActivated;
169             }
170             set
171             {
172                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueBool(SystemSettingsKeys.MotionActivationEnabled, value);
173                 if (res != SystemSettingsError.None)
174                 {
175                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to set MotionActivation system setting.");
176                 }
177             }
178         }
179
180         /// <summary>
181         /// The file path of the current email alert ringtone
182         /// </summary>
183         public static string EmailAlertRingtone
184         {
185             get
186             {
187                 string filePath;
188                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.EmailAlertRingtone, out filePath);
189                 if (res != SystemSettingsError.None)
190                 {
191                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to get EmailAlertRingtone system setting.");
192                 }
193                 return filePath;
194             }
195             set
196             {
197                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.EmailAlertRingtone, value);
198                 if (res != SystemSettingsError.None)
199                 {
200                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to set EmailAlertRingtone system setting.");
201                 }
202             }
203         }
204         /// <summary>
205         /// Indicates whether the USB debugging is enabled
206         /// </summary>
207         public static bool UsbDebuggingEnabled
208         {
209             get
210             {
211                 bool isusbDebuggingEnabled;
212                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.UsbDebuggingEnabled, out isusbDebuggingEnabled);
213                 if (res != SystemSettingsError.None)
214                 {
215                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to get UsbDebuggingEnabled system setting.");
216                 }
217                 return isusbDebuggingEnabled;
218             }
219             set
220             {
221                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueBool(SystemSettingsKeys.UsbDebuggingEnabled, value);
222                 if (res != SystemSettingsError.None)
223                 {
224                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to set UsbDebuggingEnabled system setting.");
225                 }
226             }
227         }
228
229         /// <summary>
230         /// Indicates whether the 3G data network is enabled
231         /// </summary>
232         public static bool Data3GNetworkEnabled
233         {
234             get
235             {
236                 bool is3GDataEnabled;
237                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.Data3GNetworkEnabled, out is3GDataEnabled);
238                 if (res != SystemSettingsError.None)
239                 {
240                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to get Data3GNetworkEnabled system setting.");
241                 }
242                 return is3GDataEnabled;
243             }
244             set
245             {
246                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueBool(SystemSettingsKeys.Data3GNetworkEnabled, value);
247                 if (res != SystemSettingsError.None)
248                 {
249                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to set Data3GNetworkEnabled system setting.");
250                 }
251             }
252         }
253
254         /// <summary>
255         /// Indicates lockscreen app pkg name
256         /// </summary>
257         public static string LockscreenApp
258         {
259             get
260             {
261                 string pkgName;
262                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.LockscreenApp, out pkgName);
263                 if (res != SystemSettingsError.None)
264                 {
265                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to get LockscreenApp system setting.");
266                 }
267                 return pkgName;
268             }
269             set
270             {
271                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.LockscreenApp, value);
272                 if (res != SystemSettingsError.None)
273                 {
274                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to set LockscreenApp system setting.");
275                 }
276             }
277         }
278
279         /// <summary>
280         /// The current system default font type (only support Get)
281         /// </summary>
282         public static string DefaultFontType
283         {
284             get
285             {
286                 string defaultFontType;
287                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.DefaultFontType, out defaultFontType);
288                 if (res != SystemSettingsError.None)
289                 {
290                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to get DefaultFontType system setting value.");
291                 }
292                 return defaultFontType;
293             }
294         }
295
296         /// <summary>
297         /// Indicates the current country setting in the &lt;LANGUAGE&gt;_&lt;REGION&gt; 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
300         /// </summary>
301         public static string LocaleCountry
302         {
303             get
304             {
305                 string countrySetting;
306                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.LocaleCountry, out countrySetting);
307                 if (res != SystemSettingsError.None)
308                 {
309                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to get LocaleCountry system setting.");
310                 }
311                 return countrySetting;
312             }
313             set
314             {
315                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.LocaleCountry, value);
316                 if (res != SystemSettingsError.None)
317                 {
318                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to set LocaleCountry system setting.");
319                 }
320             }
321         }
322
323         /// <summary>
324         /// Indicates the current language setting in the &lt;LANGUAGE&gt;_&lt;REGION&gt; 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.
327         /// </summary>
328         public static string LocaleLanguage
329         {
330             get
331             {
332                 string languageSetting;
333                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.LocaleLanguage, out languageSetting);
334                 if (res != SystemSettingsError.None)
335                 {
336                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to get LocaleLanguage system setting.");
337                 }
338                 return languageSetting;
339             }
340             set
341             {
342                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.LocaleLanguage, value);
343                 if (res != SystemSettingsError.None)
344                 {
345                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to set LocaleLanguage system setting.");
346                 }
347             }
348         }
349
350         /// <summary>
351         /// Indicates whether the 24-hour clock is used.
352         /// If the value is false, the 12-hour clock is used.
353         /// </summary>
354         public static bool LocaleTimeFormat24HourEnabled
355         {
356             get
357             {
358                 bool is24HrFormat;
359                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.LocaleTimeFormat24HourEnabled, out is24HrFormat);
360                 if (res != SystemSettingsError.None)
361                 {
362                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to get LocaleTimeFormat24Hour system setting.");
363                 }
364                 return is24HrFormat;
365             }
366             set
367             {
368                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueBool(SystemSettingsKeys.LocaleTimeFormat24HourEnabled, value);
369                 if (res != SystemSettingsError.None)
370                 {
371                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to set LocaleTimeFormat24Hour system setting.");
372                 }
373             }
374         }
375
376         /// <summary>
377         /// Indicates the current time zone. Eg. "Pacific/Tahiti"
378         /// </summary>
379         public static string LocaleTimeZone
380         {
381             get
382             {
383                 string timeZone;
384                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.LocaleTimeZone, out timeZone);
385                 if (res != SystemSettingsError.None)
386                 {
387                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to get LocaleTimeZone system setting.");
388                 }
389                 return timeZone;
390             }
391             set
392             {
393                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.LocaleTimeZone, value);
394                 if (res != SystemSettingsError.None)
395                 {
396                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to set LocaleTimeZone system setting.");
397                 }
398             }
399         }
400
401         /// <summary>
402         /// Once System changes time, this event occurs to notify time change.
403         /// </summary>
404         public static int Time
405         {
406             get
407             {
408                 int time;
409                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueInt(SystemSettingsKeys.Time, out time);
410                 if (res != SystemSettingsError.None)
411                 {
412                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to get Time system setting.");
413                 }
414                 return time;
415             }
416         }
417         /// <summary>
418         /// Indicates whether the screen lock sound is enabled on the device. ex) LCD on/off sound
419         /// </summary>
420         public static bool SoundLockEnabled
421         {
422             get
423             {
424                 bool isSoundLockEnabled;
425                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.SoundLockEnabled, out isSoundLockEnabled);
426                 if (res != SystemSettingsError.None)
427                 {
428                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to get SoundLock system setting.");
429                 }
430                 return isSoundLockEnabled;
431             }
432         }
433
434         /// <summary>
435         /// Indicates whether the device is in the silent mode.
436         /// </summary>
437         public static bool SoundSilentModeEnabled
438         {
439             get
440             {
441                 bool isSilent;
442                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.SoundSilentModeEnabled, out isSilent);
443                 if (res != SystemSettingsError.None)
444                 {
445                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to get SoundSilentMode system setting.");
446                 }
447                 return isSilent;
448             }
449         }
450
451         /// <summary>
452         /// Indicates whether the screen touch sound is enabled on the device.
453         /// </summary>
454         public static bool SoundTouchEnabled
455         {
456             get
457             {
458                 bool isTouchSoundEnabled;
459                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.SoundTouchEnabled, out isTouchSoundEnabled);
460                 if (res != SystemSettingsError.None)
461                 {
462                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to get SoundTouch system setting value.");
463                 }
464                 return isTouchSoundEnabled;
465             }
466         }
467
468         /// <summary>
469         /// Indicates whether rotation control is automatic.
470         /// </summary>
471         public static bool DisplayScreenRotationAutoEnabled
472         {
473             get
474             {
475                 bool isRotationAutomatic;
476                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.DisplayScreenRotationAutoEnabled, out isRotationAutomatic);
477                 if (res != SystemSettingsError.None)
478                 {
479                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to get DisplayScreenRotationAuto system setting.");
480                 }
481                 return isRotationAutomatic;
482             }
483         }
484
485         /// <summary>
486         /// Indicates device name.
487         /// </summary>
488         public static string DeviceName
489         {
490             get
491             {
492                 string deviceName;
493                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.DeviceName, out deviceName);
494                 if (res != SystemSettingsError.None)
495                 {
496                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to get DeviceName system setting value.");
497                 }
498                 return deviceName;
499             }
500         }
501         /// <summary>
502         /// Indicates whether the device user has enabled motion feature.
503         /// </summary>
504         public static bool MotionEnabled
505         {
506             get
507             {
508                 bool isMotionEnabled;
509                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.MotionEnabled, out isMotionEnabled);
510                 if (res != SystemSettingsError.None)
511                 {
512                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to get MotionEnabled system setting value.");
513                 }
514                 return isMotionEnabled;
515             }
516         }
517
518         /// <summary>
519         /// Indicates whether Wi-Fi-related notifications are enabled on the device.
520         /// </summary>
521         public static bool NetworkWifiNotificationEnabled
522         {
523             get
524             {
525                 bool isWifiNotificationEnabled;
526                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.NetworkWifiNotificationEnabled, out isWifiNotificationEnabled);
527                 if (res != SystemSettingsError.None)
528                 {
529                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to get NetworkWifiNotification system setting.");
530                 }
531                 return isWifiNotificationEnabled;
532             }
533         }
534
535         /// <summary>
536         /// Indicates whether the device is in the flight mode.
537         /// </summary>
538         public static bool NetworkFlightModeEnabled
539         {
540             get
541             {
542                 bool isFlightModeEnabled;
543                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.NetworkFlightModeEnabled, out isFlightModeEnabled);
544                 if (res != SystemSettingsError.None)
545                 {
546                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to get NetworkFlightMode system setting.");
547                 }
548                 return isFlightModeEnabled;
549             }
550         }
551
552         /// <summary>
553         /// Indicates the backlight time (in seconds). The following values can be used: 15, 30, 60, 120, 300, and 600.
554         /// </summary>
555         public static int ScreenBacklightTime
556         {
557             get
558             {
559                 int backlightTime;
560                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueInt(SystemSettingsKeys.ScreenBacklightTime, out backlightTime);
561                 if (res != SystemSettingsError.None)
562                 {
563                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to get ScreenBacklightTime system setting.");
564                 }
565                 return backlightTime;
566             }
567             set
568             {
569                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueInt(SystemSettingsKeys.ScreenBacklightTime, value);
570                 if (res != SystemSettingsError.None)
571                 {
572                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to set ScreenBacklightTime system setting.");
573                 }
574             }
575         }
576
577         /// <summary>
578         /// Indicates the file path of the current notification tone set by the user.
579         /// </summary>
580         public static string SoundNotification
581         {
582             get
583             {
584                 string filePath;
585                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.SoundNotification, out filePath);
586                 if (res != SystemSettingsError.None)
587                 {
588                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to get SoundNotification system setting.");
589                 }
590                 return filePath;
591             }
592             set
593             {
594                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.SoundNotification, value);
595                 if (res != SystemSettingsError.None)
596                 {
597                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to set SoundNotification system setting.");
598                 }
599             }
600         }
601
602         /// <summary>
603         /// Indicates the time period for notification repetitions.
604         /// </summary>
605         public static int SoundNotificationRepetitionPeriod
606         {
607             get
608             {
609                 int notificationRepetitionPeriod;
610                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueInt(SystemSettingsKeys.SoundNotificationRepetitionPeriod, out notificationRepetitionPeriod);
611                 if (res != SystemSettingsError.None)
612                 {
613                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to get SoundNotificationRepetitionPeriod system setting.");
614                 }
615                 return notificationRepetitionPeriod;
616             }
617             set
618             {
619                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueInt(SystemSettingsKeys.SoundNotificationRepetitionPeriod, value);
620                 if (res != SystemSettingsError.None)
621                 {
622                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to set SoundNotificationRepetitionPeriod system setting.");
623                 }
624             }
625         }
626
627         /// <summary>
628         /// Indicates the current lock state
629         /// </summary>
630         public static SystemSettingsIdleLockState LockState
631         {
632             get
633             {
634                 int LockState;
635                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueInt(SystemSettingsKeys.LockState, out LockState);
636                 if (res != SystemSettingsError.None)
637                 {
638                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to get LockState system setting.");
639                 }
640                 return (SystemSettingsIdleLockState)LockState;
641             }
642             set
643             {
644                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueInt(SystemSettingsKeys.LockState, (int)value);
645                 if (res != SystemSettingsError.None)
646                 {
647                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to set LockState system setting.");
648                 }
649             }
650         }
651
652         /// <summary>
653         /// The current system ADS ID
654         /// </summary>
655         public static string AdsId
656         {
657             get
658             {
659                 string adsId;
660                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.AdsId, out adsId);
661                 if (res != SystemSettingsError.None)
662                 {
663                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to get AdsId system setting.");
664                 }
665                 return adsId;
666             }
667             set
668             {
669                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.AdsId, value);
670                 if (res != SystemSettingsError.None)
671                 {
672                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to set AdsId system setting.");
673                 }
674             }
675         }
676
677
678         /// <summary>
679         /// Indicates the time period for notification repetitions.
680         /// </summary>
681         public static SystemSettingsUdsState UltraDataSave
682         {
683             get
684             {
685                 int UltraDataSave;
686                 SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueInt(SystemSettingsKeys.UltraDataSave, out UltraDataSave);
687                 if (res != SystemSettingsError.None)
688                 {
689                     throw SystemSettingsExceptionFactory.CreateException(res, "unable to get UltraDataSave system setting.");
690                 }
691                 return (SystemSettingsUdsState)UltraDataSave;
692             }
693         }
694
695
696
697         private static readonly Interop.Settings.SystemSettingsChangedCallback s_incomingCallRingtoneChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
698         {
699             string path = SystemSettings.IncomingCallRingtone;
700             IncomingCallRingtoneChangedEventArgs eventArgs = new IncomingCallRingtoneChangedEventArgs(path);
701             s_incomingCallRingtoneChanged?.Invoke(null, eventArgs);
702         };
703         private static event EventHandler<IncomingCallRingtoneChangedEventArgs> s_incomingCallRingtoneChanged;
704         /// <summary>
705         /// IncomingCallRingtoneChanged event is triggered when the file path of the incoming ringtone is changed
706         /// </summary>
707         /// <param name="sender"></param>
708         /// <param name="e">A IncomingCallRingtoneChangedEventArgs object that contains the key & changed value</param>
709         public static event EventHandler<IncomingCallRingtoneChangedEventArgs> IncomingCallRingtoneChanged
710         {
711             add
712             {
713                 if (s_incomingCallRingtoneChanged == null)
714                 {
715                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.IncomingCallRingtone, s_incomingCallRingtoneChangedCallback, IntPtr.Zero);
716                     if (ret != SystemSettingsError.None)
717                     {
718                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
719                     }
720                 }
721                 s_incomingCallRingtoneChanged += value;
722             }
723
724             remove
725             {
726                 s_incomingCallRingtoneChanged -= value;
727                 if (s_incomingCallRingtoneChanged == null)
728                 {
729                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.IncomingCallRingtone);
730                     if (ret != SystemSettingsError.None)
731                     {
732                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
733                     }
734                 }
735             }
736         }
737
738         private static readonly Interop.Settings.SystemSettingsChangedCallback s_wallpaperHomeScreenChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
739         {
740             string path = SystemSettings.WallpaperHomeScreen;
741             WallpaperHomeScreenChangedEventArgs eventArgs = new WallpaperHomeScreenChangedEventArgs(path);
742             s_wallpaperHomeScreenChanged?.Invoke(null, eventArgs);
743         };
744         private static event EventHandler<WallpaperHomeScreenChangedEventArgs> s_wallpaperHomeScreenChanged;
745         /// <summary>
746         /// WallpaperHomeScreenChanged event is triggered when the file path of the current home screen wallpaper is changed
747         /// </summary>
748         /// <param name="sender"></param>
749         /// <param name="e">A WallpaperHomeScreenChangedEventArgs object that contains the key & changed value</param>
750         public static event EventHandler<WallpaperHomeScreenChangedEventArgs> WallpaperHomeScreenChanged
751         {
752             add
753             {
754                 if (s_wallpaperHomeScreenChanged == null)
755                 {
756                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.WallpaperHomeScreen, s_wallpaperHomeScreenChangedCallback, IntPtr.Zero);
757                     if (ret != SystemSettingsError.None)
758                     {
759                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
760                     }
761                 }
762                 s_wallpaperHomeScreenChanged += value;
763             }
764
765             remove
766             {
767                 s_wallpaperHomeScreenChanged -= value;
768                 if (s_wallpaperHomeScreenChanged == null)
769                 {
770                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.WallpaperHomeScreen);
771                     if (ret != SystemSettingsError.None)
772                     {
773                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
774                     }
775                 }
776             }
777         }
778
779         private static readonly Interop.Settings.SystemSettingsChangedCallback s_wallpaperLockScreenChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
780         {
781             string path = SystemSettings.WallpaperLockScreen;
782             WallpaperLockScreenChangedEventArgs eventArgs = new WallpaperLockScreenChangedEventArgs(path);
783             s_wallpaperLockScreenChanged?.Invoke(null, eventArgs);
784         };
785         private static event EventHandler<WallpaperLockScreenChangedEventArgs> s_wallpaperLockScreenChanged;
786         /// <summary>
787         /// WallpaperLockScreenChanged event is triggered when the file path of the current lock screen wallpaper is changed
788         /// </summary>
789         /// <param name="sender"></param>
790         /// <param name="e">A WallpaperLockScreenChangedEventArgs object that contains the key & changed value</param>
791         public static event EventHandler<WallpaperLockScreenChangedEventArgs> WallpaperLockScreenChanged
792         {
793             add
794             {
795                 if (s_wallpaperLockScreenChanged == null)
796                 {
797                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.WallpaperLockScreen, s_wallpaperLockScreenChangedCallback, IntPtr.Zero);
798                     if (ret != SystemSettingsError.None)
799                     {
800                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
801                     }
802                 }
803                 s_wallpaperLockScreenChanged += value;
804             }
805
806             remove
807             {
808                 s_wallpaperLockScreenChanged -= value;
809                 if (s_wallpaperLockScreenChanged == null)
810                 {
811                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.WallpaperLockScreen);
812                     if (ret != SystemSettingsError.None)
813                     {
814                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
815                     }
816                 }
817             }
818         }
819
820         private static readonly Interop.Settings.SystemSettingsChangedCallback s_fontSizeChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
821         {
822             SystemSettingsFontSize fontSize = SystemSettings.FontSize;
823             FontSizeChangedEventArgs eventArgs = new FontSizeChangedEventArgs(fontSize);
824             s_fontSizeChanged?.Invoke(null, eventArgs);
825         };
826         private static event EventHandler<FontSizeChangedEventArgs> s_fontSizeChanged;
827         /// <summary>
828         /// FontSizeChanged event is triggered when the current system font size is changed
829         /// </summary>
830         /// <param name="sender"></param>
831         /// <param name="e">A FontSizeChangedEventArgs object that contains the key & changed value</param>
832         public static event EventHandler<FontSizeChangedEventArgs> FontSizeChanged
833         {
834             add
835             {
836                 if (s_fontSizeChanged == null)
837                 {
838                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.FontSize, s_fontSizeChangedCallback, IntPtr.Zero);
839                     if (ret != SystemSettingsError.None)
840                     {
841                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
842                     }
843                 }
844                 s_fontSizeChanged += value;
845             }
846
847             remove
848             {
849                 s_fontSizeChanged -= value;
850                 if (s_fontSizeChanged == null)
851                 {
852                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.FontSize);
853                     if (ret != SystemSettingsError.None)
854                     {
855                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
856                     }
857                 }
858             }
859         }
860
861         private static readonly Interop.Settings.SystemSettingsChangedCallback s_fontTypeChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
862         {
863             string fontType = SystemSettings.FontType;
864             FontTypeChangedEventArgs eventArgs = new FontTypeChangedEventArgs(fontType);
865             s_fontTypeChanged?.Invoke(null, eventArgs);
866         };
867         private static event EventHandler<FontTypeChangedEventArgs> s_fontTypeChanged;
868         /// <summary>
869         /// FontTypeChanged event is triggered when the current system font type is changed
870         /// </summary>
871         /// <param name="sender"></param>
872         /// <param name="e">A FontTypeChangedEventArgs object that contains the key & changed value</param>
873         public static event EventHandler<FontTypeChangedEventArgs> FontTypeChanged
874         {
875             add
876             {
877                 if (s_fontTypeChanged == null)
878                 {
879                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.FontType, s_fontTypeChangedCallback, IntPtr.Zero);
880                     if (ret != SystemSettingsError.None)
881                     {
882                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
883                     }
884                 }
885                 s_fontTypeChanged += value;
886             }
887
888             remove
889             {
890                 s_fontTypeChanged -= value;
891                 if (s_fontTypeChanged == null)
892                 {
893                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.FontType);
894                     if (ret != SystemSettingsError.None)
895                     {
896                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
897                     }
898                 }
899             }
900         }
901
902         private static readonly Interop.Settings.SystemSettingsChangedCallback s_motionActivationChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
903         {
904             bool motionActivation = SystemSettings.MotionActivationEnabled;
905             MotionActivationSettingChangedEventArgs eventArgs = new MotionActivationSettingChangedEventArgs(motionActivation);
906             s_motionActivationChanged?.Invoke(null, eventArgs);
907         };
908         private static event EventHandler<MotionActivationSettingChangedEventArgs> s_motionActivationChanged;
909         /// <summary>
910         /// MotionActivationChanged event is triggered when the motion service status is changed
911         /// </summary>
912         /// <param name="sender"></param>
913         /// <param name="e">A MotionActivationChangedEventArgs object that contains the key & changed value</param>
914         public static event EventHandler<MotionActivationSettingChangedEventArgs> MotionActivationSettingChanged
915         {
916             add
917             {
918                 if (s_motionActivationChanged == null)
919                 {
920                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.MotionActivationEnabled, s_motionActivationChangedCallback, IntPtr.Zero);
921                     if (ret != SystemSettingsError.None)
922                     {
923                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
924                     }
925                 }
926                 s_motionActivationChanged += value;
927             }
928
929             remove
930             {
931                 s_motionActivationChanged -= value;
932                 if (s_motionActivationChanged == null)
933                 {
934                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.MotionActivationEnabled);
935                     if (ret != SystemSettingsError.None)
936                     {
937                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
938                     }
939                 }
940             }
941         }
942
943         private static readonly Interop.Settings.SystemSettingsChangedCallback s_emailAlertRingtoneChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
944         {
945             string emailAlertRingtone = SystemSettings.EmailAlertRingtone;
946             EmailAlertRingtoneChangedEventArgs eventArgs = new EmailAlertRingtoneChangedEventArgs(emailAlertRingtone);
947             s_emailAlertRingtoneChanged?.Invoke(null, eventArgs);
948         };
949         private static event EventHandler<EmailAlertRingtoneChangedEventArgs> s_emailAlertRingtoneChanged;
950         /// <summary>
951         /// EmailAlertRingtoneChanged event is triggered when the file path of the current email alert ringtone is changed
952         /// </summary>
953         /// <param name="sender"></param>
954         /// <param name="e">A EmailAlertRingtoneChangedEventArgs object that contains the key & changed value</param>
955         public static event EventHandler<EmailAlertRingtoneChangedEventArgs> EmailAlertRingtoneChanged
956         {
957             add
958             {
959                 if (s_emailAlertRingtoneChanged == null)
960                 {
961                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.EmailAlertRingtone, s_emailAlertRingtoneChangedCallback, IntPtr.Zero);
962                     if (ret != SystemSettingsError.None)
963                     {
964                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
965                     }
966                 }
967                 s_emailAlertRingtoneChanged += value;
968             }
969
970             remove
971             {
972                 s_emailAlertRingtoneChanged -= value;
973                 if (s_emailAlertRingtoneChanged == null)
974                 {
975                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.EmailAlertRingtone);
976                     if (ret != SystemSettingsError.None)
977                     {
978                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
979                     }
980                 }
981             }
982         }
983
984         private static readonly Interop.Settings.SystemSettingsChangedCallback s_usbDebuggingSettingChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
985         {
986             bool usbDebuggingEnabled = SystemSettings.UsbDebuggingEnabled;
987             UsbDebuggingSettingChangedEventArgs eventArgs = new UsbDebuggingSettingChangedEventArgs(usbDebuggingEnabled);
988             s_usbDebuggingSettingChanged?.Invoke(null, eventArgs);
989         };
990         private static event EventHandler<UsbDebuggingSettingChangedEventArgs> s_usbDebuggingSettingChanged;
991         /// <summary>
992         /// UsbDebuggingSettingChangedEventArgs event is triggered when the USB debugging status is changed
993         /// </summary>
994         /// <param name="sender"></param>
995         /// <param name="e">A UsbDebuggingSettingChangedEventArgs object that contains the key & changed value</param>
996         public static event EventHandler<UsbDebuggingSettingChangedEventArgs> UsbDebuggingSettingChanged
997         {
998             add
999             {
1000                 if (s_usbDebuggingSettingChanged == null)
1001                 {
1002                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.UsbDebuggingEnabled, s_usbDebuggingSettingChangedCallback, IntPtr.Zero);
1003                     if (ret != SystemSettingsError.None)
1004                     {
1005                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1006                     }
1007                 }
1008                 s_usbDebuggingSettingChanged += value;
1009             }
1010
1011             remove
1012             {
1013                 s_usbDebuggingSettingChanged -= value;
1014                 if (s_usbDebuggingSettingChanged == null)
1015                 {
1016                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.UsbDebuggingEnabled);
1017                     if (ret != SystemSettingsError.None)
1018                     {
1019                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1020                     }
1021                 }
1022             }
1023         }
1024
1025         private static readonly Interop.Settings.SystemSettingsChangedCallback s_data3GNetworkSettingChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1026         {
1027             bool data3GEnabled = SystemSettings.Data3GNetworkEnabled;
1028             Data3GNetworkSettingChangedEventArgs eventArgs = new Data3GNetworkSettingChangedEventArgs(data3GEnabled);
1029             s_data3GNetworkSettingChanged?.Invoke(null, eventArgs);
1030         };
1031         private static event EventHandler<Data3GNetworkSettingChangedEventArgs> s_data3GNetworkSettingChanged;
1032         /// <summary>
1033         /// Data3GNetworkSettingChanged event is triggered when the 3G data network status is changed
1034         /// </summary>
1035         /// <param name="sender"></param>
1036         /// <param name="e">A Data3GNetworkSettingChangedEventArgs object that contains the key & changed value</param>
1037         public static event EventHandler<Data3GNetworkSettingChangedEventArgs> Data3GNetworkSettingChanged
1038         {
1039             add
1040             {
1041                 if (s_data3GNetworkSettingChanged == null)
1042                 {
1043                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.Data3GNetworkEnabled, s_data3GNetworkSettingChangedCallback, IntPtr.Zero);
1044                     if (ret != SystemSettingsError.None)
1045                     {
1046                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1047                     }
1048                 }
1049                 s_data3GNetworkSettingChanged += value;
1050             }
1051
1052             remove
1053             {
1054                 s_data3GNetworkSettingChanged -= value;
1055                 if (s_data3GNetworkSettingChanged == null)
1056                 {
1057                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.Data3GNetworkEnabled);
1058                     if (ret != SystemSettingsError.None)
1059                     {
1060                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1061                     }
1062                 }
1063             }
1064         }
1065
1066         private static readonly Interop.Settings.SystemSettingsChangedCallback s_lockscreenAppChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1067         {
1068             string lockScreenApp = SystemSettings.LockscreenApp;
1069             LockscreenAppChangedEventArgs eventArgs = new LockscreenAppChangedEventArgs(lockScreenApp);
1070             s_lockscreenAppChanged?.Invoke(null, eventArgs);
1071         };
1072         private static event EventHandler<LockscreenAppChangedEventArgs> s_lockscreenAppChanged;
1073         /// <summary>
1074         /// LockscreenAppChanged event is triggered when the lockscreen app pkg name is changed
1075         /// </summary>
1076         /// <param name="sender"></param>
1077         /// <param name="e">A LockscreenAppChangedEventArgs object that contains the key & changed value</param>
1078         public static event EventHandler<LockscreenAppChangedEventArgs> LockscreenAppChanged
1079         {
1080             add
1081             {
1082                 if (s_lockscreenAppChanged == null)
1083                 {
1084                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LockscreenApp, s_lockscreenAppChangedCallback, IntPtr.Zero);
1085                     if (ret != SystemSettingsError.None)
1086                     {
1087                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1088                     }
1089                 }
1090                 s_lockscreenAppChanged += value;
1091             }
1092
1093             remove
1094             {
1095                 s_lockscreenAppChanged -= value;
1096                 if (s_lockscreenAppChanged == null)
1097                 {
1098                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LockscreenApp);
1099                     if (ret != SystemSettingsError.None)
1100                     {
1101                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1102                     }
1103                 }
1104             }
1105         }
1106
1107         private static readonly Interop.Settings.SystemSettingsChangedCallback s_localeCountryChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1108         {
1109             string localeCountry = SystemSettings.LocaleCountry;
1110             LocaleCountryChangedEventArgs eventArgs = new LocaleCountryChangedEventArgs(localeCountry);
1111             s_localeCountryChanged?.Invoke(null, eventArgs);
1112         };
1113         private static event EventHandler<LocaleCountryChangedEventArgs> s_localeCountryChanged;
1114         /// <summary>
1115         /// LocaleCountryChanged event is triggered when the current country setting in the &lt;LANGUAGE&gt;_&lt;REGION&gt; syntax, is changed
1116         /// </summary>
1117         /// <param name="sender"></param>
1118         /// <param name="e">A LocaleCountryChangedEventArgs object that contains the key & changed value</param>
1119         public static event EventHandler<LocaleCountryChangedEventArgs> LocaleCountryChanged
1120         {
1121             add
1122             {
1123                 if (s_localeCountryChanged == null)
1124                 {
1125                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LocaleCountry, s_localeCountryChangedCallback, IntPtr.Zero);
1126                     if (ret != SystemSettingsError.None)
1127                     {
1128                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1129                     }
1130                 }
1131                 s_localeCountryChanged += value;
1132             }
1133
1134             remove
1135             {
1136                 s_localeCountryChanged -= value;
1137                 if (s_localeCountryChanged == null)
1138                 {
1139                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LocaleCountry);
1140                     if (ret != SystemSettingsError.None)
1141                     {
1142                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1143                     }
1144                 }
1145             }
1146         }
1147
1148         private static readonly Interop.Settings.SystemSettingsChangedCallback s_localeLanguageChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1149         {
1150             string localeLanguage = SystemSettings.LocaleLanguage;
1151             LocaleLanguageChangedEventArgs eventArgs = new LocaleLanguageChangedEventArgs(localeLanguage);
1152             s_localeLanguageChanged?.Invoke(null, eventArgs);
1153         };
1154         private static event EventHandler<LocaleLanguageChangedEventArgs> s_localeLanguageChanged;
1155         /// <summary>
1156         /// LocaleLanguageChanged event is triggered when the current language setting in the &lt;LANGUAGE&gt;_&lt;REGION&gt; syntax, is changed
1157         /// </summary>
1158         /// <param name="sender"></param>
1159         /// <param name="e">A LocaleLanguageChangedEventArgs object that contains the key & changed value</param>
1160         public static event EventHandler<LocaleLanguageChangedEventArgs> LocaleLanguageChanged
1161         {
1162             add
1163             {
1164                 if (s_localeLanguageChanged == null)
1165                 {
1166                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LocaleLanguage, s_localeLanguageChangedCallback, IntPtr.Zero);
1167                     if (ret != SystemSettingsError.None)
1168                     {
1169                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1170                     }
1171                 }
1172                 s_localeLanguageChanged += value;
1173             }
1174
1175             remove
1176             {
1177                 s_localeLanguageChanged -= value;
1178                 if (s_localeLanguageChanged == null)
1179                 {
1180                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LocaleLanguage);
1181                     if (ret != SystemSettingsError.None)
1182                     {
1183                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1184                     }
1185                 }
1186             }
1187         }
1188
1189         private static readonly Interop.Settings.SystemSettingsChangedCallback s_localeTimeFormat24HourChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1190         {
1191             bool localeTimeFormat24Hour = SystemSettings.LocaleTimeFormat24HourEnabled;
1192             LocaleTimeFormat24HourSettingChangedEventArgs eventArgs = new LocaleTimeFormat24HourSettingChangedEventArgs(localeTimeFormat24Hour);
1193             s_localeTimeFormat24HourChanged?.Invoke(null, eventArgs);
1194         };
1195         private static event EventHandler<LocaleTimeFormat24HourSettingChangedEventArgs> s_localeTimeFormat24HourChanged;
1196         /// <summary>
1197         /// LocaleTimeFormat24HourChanged event is triggered when the time format is changed
1198         /// </summary>
1199         /// <param name="sender"></param>
1200         /// <param name="e">A LocaleTimeFormat24HourChangedEventArgs object that contains the key & changed value</param>
1201         public static event EventHandler<LocaleTimeFormat24HourSettingChangedEventArgs> LocaleTimeFormat24HourSettingChanged
1202         {
1203             add
1204             {
1205                 if (s_localeTimeFormat24HourChanged == null)
1206                 {
1207                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LocaleTimeFormat24HourEnabled, s_localeTimeFormat24HourChangedCallback, IntPtr.Zero);
1208                     if (ret != SystemSettingsError.None)
1209                     {
1210                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1211                     }
1212                 }
1213                 s_localeTimeFormat24HourChanged += value;
1214             }
1215
1216             remove
1217             {
1218                 s_localeTimeFormat24HourChanged -= value;
1219                 if (s_localeTimeFormat24HourChanged == null)
1220                 {
1221                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LocaleTimeFormat24HourEnabled);
1222                     if (ret != SystemSettingsError.None)
1223                     {
1224                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1225                     }
1226                 }
1227             }
1228         }
1229
1230         private static readonly Interop.Settings.SystemSettingsChangedCallback s_localeTimeZoneChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1231         {
1232             string localeTimeZone = SystemSettings.LocaleTimeZone;
1233             LocaleTimeZoneChangedEventArgs eventArgs = new LocaleTimeZoneChangedEventArgs(localeTimeZone);
1234             s_localeTimeZoneChanged?.Invoke(null, eventArgs);
1235         };
1236         private static event EventHandler<LocaleTimeZoneChangedEventArgs> s_localeTimeZoneChanged;
1237         /// <summary>
1238         /// LocaleTimeZoneChanged event is triggered when the  current time zone is changed
1239         /// </summary>
1240         /// <param name="sender"></param>
1241         /// <param name="e">A LocaleTimeZoneChangedEventArgs object that contains the key & changed value</param>
1242         public static event EventHandler<LocaleTimeZoneChangedEventArgs> LocaleTimeZoneChanged
1243         {
1244             add
1245             {
1246                 if (s_localeTimeZoneChanged == null)
1247                 {
1248                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LocaleTimeZone, s_localeTimeZoneChangedCallback, IntPtr.Zero);
1249                     if (ret != SystemSettingsError.None)
1250                     {
1251                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1252                     }
1253                 }
1254                 s_localeTimeZoneChanged += value;
1255             }
1256
1257             remove
1258             {
1259                 s_localeTimeZoneChanged -= value;
1260                 if (s_localeTimeZoneChanged == null)
1261                 {
1262                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LocaleTimeZone);
1263                     if (ret != SystemSettingsError.None)
1264                     {
1265                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1266                     }
1267                 }
1268             }
1269         }
1270
1271         private static readonly Interop.Settings.SystemSettingsChangedCallback s_timeChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1272         {
1273             
1274             int time = SystemSettings.Time;
1275             TimeChangedEventArgs eventArgs = new TimeChangedEventArgs(time);
1276             s_timeChanged?.Invoke(null, eventArgs);
1277         };
1278         private static event EventHandler<TimeChangedEventArgs> s_timeChanged;
1279         /// <summary>
1280         /// TimeChanged event is triggered when the system time is changed
1281         /// </summary>
1282         /// <param name="sender"></param>
1283         /// <param name="e">A TimeChangedEventArgs object that contains the key & changed value</param>
1284         public static event EventHandler<TimeChangedEventArgs> TimeChanged
1285         {
1286             add
1287             {
1288                 if (s_timeChanged == null)
1289                 {
1290                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.Time, s_timeChangedCallback, IntPtr.Zero);
1291                     if (ret != SystemSettingsError.None)
1292                     {
1293                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1294                     }
1295                 }
1296                 s_timeChanged += value;
1297             }
1298
1299             remove
1300             {
1301                 s_timeChanged -= value;
1302                 if (s_timeChanged == null)
1303                 {
1304                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.Time);
1305                     if (ret != SystemSettingsError.None)
1306                     {
1307                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1308                     }
1309                 }
1310             }
1311         }
1312
1313         private static readonly Interop.Settings.SystemSettingsChangedCallback s_soundLockChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1314         {
1315             bool soundLock = SystemSettings.SoundLockEnabled;
1316             SoundLockSettingChangedEventArgs eventArgs = new SoundLockSettingChangedEventArgs(soundLock);
1317             s_soundLockChanged?.Invoke(null, eventArgs);
1318         };
1319         private static event EventHandler<SoundLockSettingChangedEventArgs> s_soundLockChanged;
1320         /// <summary>
1321         /// SoundLockChanged event is triggered when the screen lock sound enabled status is changed
1322         /// </summary>
1323         /// <param name="sender"></param>
1324         /// <param name="e">A SoundLockChangedEventArgs object that contains the key & changed value</param>
1325         public static event EventHandler<SoundLockSettingChangedEventArgs> SoundLockSettingChanged
1326         {
1327             add
1328             {
1329                 if (s_soundLockChanged == null)
1330                 {
1331                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.SoundLockEnabled, s_soundLockChangedCallback, IntPtr.Zero);
1332                     if (ret != SystemSettingsError.None)
1333                     {
1334                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1335                     }
1336                 }
1337                 s_soundLockChanged += value;
1338             }
1339
1340             remove
1341             {
1342                 s_soundLockChanged -= value;
1343                 if (s_soundLockChanged == null)
1344                 {
1345                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.SoundLockEnabled);
1346                     if (ret != SystemSettingsError.None)
1347                     {
1348                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1349                     }
1350                 }
1351             }
1352         }
1353
1354         private static readonly Interop.Settings.SystemSettingsChangedCallback s_soundSilentModeChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1355         {
1356             bool soundSilentMode = SystemSettings.SoundSilentModeEnabled;
1357             SoundSilentModeSettingChangedEventArgs eventArgs = new SoundSilentModeSettingChangedEventArgs(soundSilentMode);
1358             s_soundSilentModeChanged?.Invoke(null, eventArgs);
1359         };
1360         private static event EventHandler<SoundSilentModeSettingChangedEventArgs> s_soundSilentModeChanged;
1361         /// <summary>
1362         /// SoundSilentModeChanged event is triggered when the silent mode status is changed
1363         /// </summary>
1364         /// <param name="sender"></param>
1365         /// <param name="e">A SoundSilentModeChangedEventArgs object that contains the key & changed value</param>
1366         public static event EventHandler<SoundSilentModeSettingChangedEventArgs> SoundSilentModeSettingChanged
1367         {
1368             add
1369             {
1370                 if (s_soundSilentModeChanged == null)
1371                 {
1372                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.SoundSilentModeEnabled, s_soundSilentModeChangedCallback, IntPtr.Zero);
1373                     if (ret != SystemSettingsError.None)
1374                     {
1375                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1376                     }
1377                 }
1378                 s_soundSilentModeChanged += value;
1379             }
1380
1381             remove
1382             {
1383                 s_soundSilentModeChanged -= value;
1384                 if (s_soundSilentModeChanged == null)
1385                 {
1386                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.SoundSilentModeEnabled);
1387                     if (ret != SystemSettingsError.None)
1388                     {
1389                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1390                     }
1391                 }
1392             }
1393         }
1394
1395         private static readonly Interop.Settings.SystemSettingsChangedCallback s_soundTouchChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1396         {
1397             bool soundTouch = SystemSettings.SoundTouchEnabled;
1398             SoundTouchSettingChangedEventArgs eventArgs = new SoundTouchSettingChangedEventArgs(soundTouch);
1399             s_soundTouchChanged?.Invoke(null, eventArgs);
1400         };
1401         private static event EventHandler<SoundTouchSettingChangedEventArgs> s_soundTouchChanged;
1402         /// <summary>
1403         /// SoundTouchChanged event is triggered when the screen touch sound enabled status is changed
1404         /// </summary>
1405         /// <param name="sender"></param>
1406         /// <param name="e">A SoundTouchChangedEventArgs object that contains the key & changed value</param>
1407         public static event EventHandler<SoundTouchSettingChangedEventArgs> SoundTouchSettingChanged
1408         {
1409             add
1410             {
1411                 if (s_soundTouchChanged == null)
1412                 {
1413                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.SoundTouchEnabled, s_soundTouchChangedCallback, IntPtr.Zero);
1414                     if (ret != SystemSettingsError.None)
1415                     {
1416                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1417                     }
1418                 }
1419                 s_soundTouchChanged += value;
1420             }
1421
1422             remove
1423             {
1424                 s_soundTouchChanged -= value;
1425                 if (s_soundTouchChanged == null)
1426                 {
1427                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.SoundTouchEnabled);
1428                     if (ret != SystemSettingsError.None)
1429                     {
1430                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1431                     }
1432                 }
1433             }
1434         }
1435
1436         private static readonly Interop.Settings.SystemSettingsChangedCallback s_displayScreenRotationAutoChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1437         {
1438             bool displayScreenRotationAuto = SystemSettings.DisplayScreenRotationAutoEnabled;
1439             DisplayScreenRotationAutoSettingChangedEventArgs eventArgs = new DisplayScreenRotationAutoSettingChangedEventArgs(displayScreenRotationAuto);
1440             s_displayScreenRotationAutoChanged?.Invoke(null, eventArgs);
1441         };
1442         private static event EventHandler<DisplayScreenRotationAutoSettingChangedEventArgs> s_displayScreenRotationAutoChanged;
1443         /// <summary>
1444         /// DisplayScreenRotationAutoChanged event is triggered when the automatic rotation control status is changed
1445         /// </summary>
1446         /// <param name="sender"></param>
1447         /// <param name="e">A DisplayScreenRotationAutoChangedEventArgs object that contains the key & changed value</param>
1448         public static event EventHandler<DisplayScreenRotationAutoSettingChangedEventArgs> DisplayScreenRotationAutoSettingChanged
1449         {
1450             add
1451             {
1452                 if (s_displayScreenRotationAutoChanged == null)
1453                 {
1454                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.DisplayScreenRotationAutoEnabled, s_displayScreenRotationAutoChangedCallback, IntPtr.Zero);
1455                     if (ret != SystemSettingsError.None)
1456                     {
1457                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1458                     }
1459                 }
1460                 s_displayScreenRotationAutoChanged += value;
1461             }
1462
1463             remove
1464             {
1465                 s_displayScreenRotationAutoChanged -= value;
1466                 if (s_displayScreenRotationAutoChanged == null)
1467                 {
1468                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.DisplayScreenRotationAutoEnabled);
1469                     if (ret != SystemSettingsError.None)
1470                     {
1471                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1472                     }
1473                 }
1474             }
1475         }
1476
1477         private static readonly Interop.Settings.SystemSettingsChangedCallback s_deviceNameChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1478         {
1479             string deviceName = SystemSettings.DeviceName;
1480             DeviceNameChangedEventArgs eventArgs = new DeviceNameChangedEventArgs(deviceName);
1481             s_deviceNameChanged?.Invoke(null, eventArgs);
1482         };
1483         private static event EventHandler<DeviceNameChangedEventArgs> s_deviceNameChanged;
1484         /// <summary>
1485         /// DeviceNameChanged event is triggered when the device name is changed
1486         /// </summary>
1487         /// <param name="sender"></param>
1488         /// <param name="e">A DeviceNameChangedEventArgs object that contains the key & changed value</param>
1489         public static event EventHandler<DeviceNameChangedEventArgs> DeviceNameChanged
1490         {
1491             add
1492             {
1493                 if (s_deviceNameChanged == null)
1494                 {
1495                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.DeviceName, s_deviceNameChangedCallback, IntPtr.Zero);
1496                     if (ret != SystemSettingsError.None)
1497                     {
1498                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1499                     }
1500                 }
1501                 s_deviceNameChanged += value;
1502             }
1503
1504             remove
1505             {
1506                 s_deviceNameChanged -= value;
1507                 if (s_deviceNameChanged == null)
1508                 {
1509                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.DeviceName);
1510                     if (ret != SystemSettingsError.None)
1511                     {
1512                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1513                     }
1514                 }
1515             }
1516         }
1517
1518         private static readonly Interop.Settings.SystemSettingsChangedCallback s_motionSettingChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1519         {
1520             bool motionEnabled = SystemSettings.MotionEnabled;
1521             MotionSettingChangedEventArgs eventArgs = new MotionSettingChangedEventArgs(motionEnabled);
1522             s_motionSettingChanged?.Invoke(null, eventArgs);
1523         };
1524         private static event EventHandler<MotionSettingChangedEventArgs> s_motionSettingChanged;
1525         /// <summary>
1526         /// MotionSettingChanged event is triggered when the motion feature enabled status is changed
1527         /// </summary>
1528         /// <param name="sender"></param>
1529         /// <param name="e">A MotionSettingChangedEventArgs object that contains the key & changed value</param>
1530         public static event EventHandler<MotionSettingChangedEventArgs> MotionSettingChanged
1531         {
1532             add
1533             {
1534                 if (s_motionSettingChanged == null)
1535                 {
1536                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.MotionEnabled, s_motionSettingChangedCallback, IntPtr.Zero);
1537                     if (ret != SystemSettingsError.None)
1538                     {
1539                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1540                     }
1541                 }
1542                 s_motionSettingChanged += value;
1543             }
1544
1545             remove
1546             {
1547                 s_motionSettingChanged -= value;
1548                 if (s_motionSettingChanged == null)
1549                 {
1550                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.MotionEnabled);
1551                     if (ret != SystemSettingsError.None)
1552                     {
1553                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1554                     }
1555                 }
1556             }
1557         }
1558
1559         private static readonly Interop.Settings.SystemSettingsChangedCallback s_networkWifiNotificationChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1560         {
1561             bool networkWifiNotification = SystemSettings.NetworkWifiNotificationEnabled;
1562             NetworkWifiNotificationSettingChangedEventArgs eventArgs = new NetworkWifiNotificationSettingChangedEventArgs(networkWifiNotification);
1563             s_networkWifiNotificationChanged?.Invoke(null, eventArgs);
1564         };
1565         private static event EventHandler<NetworkWifiNotificationSettingChangedEventArgs> s_networkWifiNotificationChanged;
1566         /// <summary>
1567         /// NetworkWifiNotificationChanged event is triggered when the Wi-Fi-related notifications enabled status is changed
1568         /// </summary>
1569         /// <param name="sender"></param>
1570         /// <param name="e">A NetworkWifiNotificationChangedEventArgs object that contains the key & changed value</param>
1571         public static event EventHandler<NetworkWifiNotificationSettingChangedEventArgs> NetworkWifiNotificationSettingChanged
1572         {
1573             add
1574             {
1575                 if (s_networkWifiNotificationChanged == null)
1576                 {
1577                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.NetworkWifiNotificationEnabled, s_networkWifiNotificationChangedCallback, IntPtr.Zero);
1578                     if (ret != SystemSettingsError.None)
1579                     {
1580                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1581                     }
1582                 }
1583                 s_networkWifiNotificationChanged += value;
1584             }
1585
1586             remove
1587             {
1588                 s_networkWifiNotificationChanged -= value;
1589                 if (s_networkWifiNotificationChanged == null)
1590                 {
1591                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.NetworkWifiNotificationEnabled);
1592                     if (ret != SystemSettingsError.None)
1593                     {
1594                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1595                     }
1596                 }
1597             }
1598         }
1599
1600         private static readonly Interop.Settings.SystemSettingsChangedCallback s_networkFlightModeChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1601         {
1602             bool networkFlightMode = SystemSettings.NetworkFlightModeEnabled;
1603             NetworkFlightModeSettingChangedEventArgs eventArgs = new NetworkFlightModeSettingChangedEventArgs(networkFlightMode);
1604             s_networkFlightModeChanged?.Invoke(null, eventArgs);
1605         };
1606         private static event EventHandler<NetworkFlightModeSettingChangedEventArgs> s_networkFlightModeChanged;
1607         /// <summary>
1608         /// NetworkFlightModeChanged event is triggered when the flight mode status is changed
1609         /// </summary>
1610         /// <param name="sender"></param>
1611         /// <param name="e">A NetworkFlightModeChangedEventArgs object that contains the key & changed value</param>
1612         public static event EventHandler<NetworkFlightModeSettingChangedEventArgs> NetworkFlightModeSettingChanged
1613         {
1614             add
1615             {
1616                 if (s_networkFlightModeChanged == null)
1617                 {
1618                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.NetworkFlightModeEnabled, s_networkFlightModeChangedCallback, IntPtr.Zero);
1619                     if (ret != SystemSettingsError.None)
1620                     {
1621                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1622                     }
1623                 }
1624                 s_networkFlightModeChanged += value;
1625             }
1626
1627             remove
1628             {
1629                 s_networkFlightModeChanged -= value;
1630                 if (s_networkFlightModeChanged == null)
1631                 {
1632                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.NetworkFlightModeEnabled);
1633                     if (ret != SystemSettingsError.None)
1634                     {
1635                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1636                     }
1637                 }
1638             }
1639         }
1640
1641         private static readonly Interop.Settings.SystemSettingsChangedCallback s_screenBacklightTimeChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1642         {
1643             int screenBacklightTime = SystemSettings.ScreenBacklightTime;
1644             ScreenBacklightTimeChangedEventArgs eventArgs = new ScreenBacklightTimeChangedEventArgs(screenBacklightTime);
1645             s_screenBacklightTimeChanged?.Invoke(null, eventArgs);
1646         };
1647         private static event EventHandler<ScreenBacklightTimeChangedEventArgs> s_screenBacklightTimeChanged;
1648         /// <summary>
1649         /// ScreenBacklightTimeChanged event is triggered when the backlight time is changed.
1650         /// </summary>
1651         /// <param name="sender"></param>
1652         /// <param name="e">A ScreenBacklightTimeChangedEventArgs object that contains the key & changed value</param>
1653         public static event EventHandler<ScreenBacklightTimeChangedEventArgs> ScreenBacklightTimeChanged
1654         {
1655             add
1656             {
1657                 if (s_screenBacklightTimeChanged == null)
1658                 {
1659                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.ScreenBacklightTime, s_screenBacklightTimeChangedCallback, IntPtr.Zero);
1660                     if (ret != SystemSettingsError.None)
1661                     {
1662                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1663                     }
1664                 }
1665                 s_screenBacklightTimeChanged += value;
1666             }
1667
1668             remove
1669             {
1670                 s_screenBacklightTimeChanged -= value;
1671                 if (s_screenBacklightTimeChanged == null)
1672                 {
1673                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.ScreenBacklightTime);
1674                     if (ret != SystemSettingsError.None)
1675                     {
1676                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1677                     }
1678                 }
1679             }
1680         }
1681
1682         private static readonly Interop.Settings.SystemSettingsChangedCallback s_soundNotificationChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1683         {
1684             string soundNotification = SystemSettings.SoundNotification;
1685             SoundNotificationChangedEventArgs eventArgs = new SoundNotificationChangedEventArgs(soundNotification);
1686             s_soundNotificationChanged?.Invoke(null, eventArgs);
1687         };
1688         private static event EventHandler<SoundNotificationChangedEventArgs> s_soundNotificationChanged;
1689         /// <summary>
1690         /// SoundNotificationChanged event is triggered when the file path of the current notification tone set by the user is changed
1691         /// </summary>
1692         /// <param name="sender"></param>
1693         /// <param name="e">A SoundNotificationChangedEventArgs object that contains the key & changed value</param>
1694         public static event EventHandler<SoundNotificationChangedEventArgs> SoundNotificationChanged
1695         {
1696             add
1697             {
1698                 if (s_soundNotificationChanged == null)
1699                 {
1700                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.SoundNotification, s_soundNotificationChangedCallback, IntPtr.Zero);
1701                     if (ret != SystemSettingsError.None)
1702                     {
1703                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1704                     }
1705                 }
1706                 s_soundNotificationChanged += value;
1707             }
1708
1709             remove
1710             {
1711                 s_soundNotificationChanged -= value;
1712                 if (s_soundNotificationChanged == null)
1713                 {
1714                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.SoundNotification);
1715                     if (ret != SystemSettingsError.None)
1716                     {
1717                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1718                     }
1719                 }
1720             }
1721         }
1722
1723         private static readonly Interop.Settings.SystemSettingsChangedCallback s_soundNotificationRepetitionPeriodChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1724         {
1725             int soundNotificationRepetitionPeriod = SystemSettings.SoundNotificationRepetitionPeriod;
1726             SoundNotificationRepetitionPeriodChangedEventArgs eventArgs = new SoundNotificationRepetitionPeriodChangedEventArgs(soundNotificationRepetitionPeriod);
1727             s_soundNotificationRepetitionPeriodChanged?.Invoke(null, eventArgs);
1728         };
1729         private static event EventHandler<SoundNotificationRepetitionPeriodChangedEventArgs> s_soundNotificationRepetitionPeriodChanged;
1730         /// <summary>
1731         /// SoundNotificationRepetitionPeriodChanged event is triggered when the time period for notification repetitions is changed
1732         /// </summary>
1733         /// <param name="sender"></param>
1734         /// <param name="e">A SoundNotificationRepetitionPeriodChangedEventArgs object that contains the key & changed value</param>
1735         public static event EventHandler<SoundNotificationRepetitionPeriodChangedEventArgs> SoundNotificationRepetitionPeriodChanged
1736         {
1737             add
1738             {
1739                 if (s_soundNotificationRepetitionPeriodChanged == null)
1740                 {
1741                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.SoundNotificationRepetitionPeriod, s_soundNotificationRepetitionPeriodChangedCallback, IntPtr.Zero);
1742                     if (ret != SystemSettingsError.None)
1743                     {
1744                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1745                     }
1746                 }
1747                 s_soundNotificationRepetitionPeriodChanged += value;
1748             }
1749
1750             remove
1751             {
1752                 s_soundNotificationRepetitionPeriodChanged -= value;
1753                 if (s_soundNotificationRepetitionPeriodChanged == null)
1754                 {
1755                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.SoundNotificationRepetitionPeriod);
1756                     if (ret != SystemSettingsError.None)
1757                     {
1758                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1759                     }
1760                 }
1761             }
1762         }
1763
1764         private static readonly Interop.Settings.SystemSettingsChangedCallback s_lockStateChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1765         {
1766             SystemSettingsIdleLockState lockState = SystemSettings.LockState;
1767             LockStateChangedEventArgs eventArgs = new LockStateChangedEventArgs(lockState);
1768             s_lockStateChanged?.Invoke(null, eventArgs);
1769         };
1770         private static event EventHandler<LockStateChangedEventArgs> s_lockStateChanged;
1771         /// <summary>
1772         /// LockStateChanged event is triggered when the current lock state is changed
1773         /// </summary>
1774         /// <param name="sender"></param>
1775         /// <param name="e">A LockStateChangedEventArgs object that contains the key & changed value</param>
1776         public static event EventHandler<LockStateChangedEventArgs> LockStateChanged
1777         {
1778             add
1779             {
1780                 if (s_lockStateChanged == null)
1781                 {
1782                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LockState, s_lockStateChangedCallback, IntPtr.Zero);
1783                     if (ret != SystemSettingsError.None)
1784                     {
1785                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1786                     }
1787                 }
1788                 s_lockStateChanged += value;
1789             }
1790
1791             remove
1792             {
1793                 s_lockStateChanged -= value;
1794                 if (s_lockStateChanged == null)
1795                 {
1796                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LockState);
1797                     if (ret != SystemSettingsError.None)
1798                     {
1799                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1800                     }
1801                 }
1802             }
1803         }
1804
1805         private static readonly Interop.Settings.SystemSettingsChangedCallback s_adsIdChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1806         {
1807             string adsId = SystemSettings.AdsId;
1808             AdsIdChangedEventArgs eventArgs = new AdsIdChangedEventArgs(adsId);
1809             s_adsIdChanged?.Invoke(null, eventArgs);
1810         };
1811         private static event EventHandler<AdsIdChangedEventArgs> s_adsIdChanged;
1812         /// <summary>
1813         /// AdsIdChanged event is triggered when the current ADS ID state is changed
1814         /// </summary>
1815         /// <param name="sender"></param>
1816         /// <param name="e">A AdsIdChangedEventArgs object that contains the key & changed value</param>
1817         public static event EventHandler<AdsIdChangedEventArgs> AdsIdChanged
1818         {
1819             add
1820             {
1821                 if (s_adsIdChanged == null)
1822                 {
1823                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.AdsId, s_adsIdChangedCallback, IntPtr.Zero);
1824                     if (ret != SystemSettingsError.None)
1825                     {
1826                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1827                     }
1828                 }
1829                 s_adsIdChanged += value;
1830             }
1831
1832             remove
1833             {
1834                 s_adsIdChanged -= value;
1835                 if (s_adsIdChanged == null)
1836                 {
1837                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.AdsId);
1838                     if (ret != SystemSettingsError.None)
1839                     {
1840                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1841                     }
1842                 }
1843             }
1844         }
1845
1846         private static readonly Interop.Settings.SystemSettingsChangedCallback s_ultraDataSaveChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1847         {
1848             SystemSettingsUdsState ultraDataSave = SystemSettings.UltraDataSave;
1849             UltraDataSaveChangedEventArgs eventArgs = new UltraDataSaveChangedEventArgs(ultraDataSave);
1850             s_ultraDataSaveChanged?.Invoke(null, eventArgs);
1851         };
1852         private static event EventHandler<UltraDataSaveChangedEventArgs> s_ultraDataSaveChanged;
1853         /// <summary>
1854         /// UltraDataSaveChanged event is triggered when the current Ultra Data Save state is changed
1855         /// </summary>
1856         /// <param name="sender"></param>
1857         /// <param name="e">A UltraDataSaveChangedEventArgs object that contains the key & changed value</param>
1858         public static event EventHandler<UltraDataSaveChangedEventArgs> UltraDataSaveChanged
1859         {
1860             add
1861             {
1862                 if (s_ultraDataSaveChanged == null)
1863                 {
1864                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.UltraDataSave, s_ultraDataSaveChangedCallback, IntPtr.Zero);
1865                     if (ret != SystemSettingsError.None)
1866                     {
1867                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1868                     }
1869                 }
1870                 s_ultraDataSaveChanged += value;
1871             }
1872
1873             remove
1874             {
1875                 s_ultraDataSaveChanged -= value;
1876                 if (s_ultraDataSaveChanged == null)
1877                 {
1878                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.UltraDataSave);
1879                     if (ret != SystemSettingsError.None)
1880                     {
1881                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1882                     }
1883                 }
1884             }
1885         }
1886
1887         private static readonly Interop.Settings.SystemSettingsChangedCallback s_ultraDataSavePackageListChangedCallback = (SystemSettingsKeys key, IntPtr userData) =>
1888         {
1889             string ultraDataSavePackageList = "None";
1890             UltraDataSavePackageListChangedEventArgs eventArgs = new UltraDataSavePackageListChangedEventArgs(ultraDataSavePackageList);
1891             s_ultraDataSavePackageListChanged?.Invoke(null, eventArgs);
1892         };
1893         private static event EventHandler<UltraDataSavePackageListChangedEventArgs> s_ultraDataSavePackageListChanged;
1894         /// <summary>
1895         /// UltraDataSavePackageListChanged event is triggered when the current ADS ID state is changed
1896         /// </summary>
1897         /// <param name="sender"></param>
1898         /// <param name="e">A UltraDataSavePackageListChangedEventArgs object that contains the key & changed value</param>
1899         public static event EventHandler<UltraDataSavePackageListChangedEventArgs> UltraDataSavePackageListChanged
1900         {
1901             add
1902             {
1903                 if (s_ultraDataSavePackageListChanged == null)
1904                 {
1905                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.UltraDataSavePackageList, s_ultraDataSavePackageListChangedCallback, IntPtr.Zero);
1906                     if (ret != SystemSettingsError.None)
1907                     {
1908                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1909                     }
1910                 }
1911                 s_ultraDataSavePackageListChanged += value;
1912             }
1913
1914             remove
1915             {
1916                 s_ultraDataSavePackageListChanged -= value;
1917                 if (s_ultraDataSavePackageListChanged == null)
1918                 {
1919                     SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.UltraDataSavePackageList);
1920                     if (ret != SystemSettingsError.None)
1921                     {
1922                         throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling");
1923                     }
1924                 }
1925             }
1926         }
1927     }
1928 }
1929