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