/// <summary>
        /// Default class constructor.
        /// </summary>
        public Settings()
        {
            _service = DependencyService.Get <ISettings>();

            _service.LocaleChanged       += (s, e) => { LocaleChanged?.Invoke(s, e); };
            _service.UserSettingsChanged += (s, e) => { UserSettingsChanged?.Invoke(s, e); };
            _service.FontChanged         += (s, e) => { FontChanged?.Invoke(s, e); };
            _service.SoundChanged        += (s, e) => { SoundChanged?.Invoke(s, e); };
            _service.OtherChanged        += (s, e) => { OtherChanged?.Invoke(s, e); };

            _service.StartListening();
        }
        /// <summary>
        /// Starts observing system settings for changes.
        /// </summary>
        /// <remarks>
        /// System settings events will be never invoked before calling this method.
        /// </remarks>
        public void StartListening()
        {
            SystemSettings.LocaleCountryChanged +=
                (s, e) => { LocaleChanged?.Invoke(s, new EventArgs()); };
            SystemSettings.LocaleLanguageChanged +=
                (s, e) => { LocaleChanged?.Invoke(s, new EventArgs()); };
            SystemSettings.LocaleTimeFormat24HourSettingChanged +=
                (s, e) => { LocaleChanged?.Invoke(s, new EventArgs()); };
            SystemSettings.LocaleTimeZoneChanged +=
                (s, e) => { LocaleChanged?.Invoke(s, new EventArgs()); };

            try
            {
                SystemSettings.IncomingCallRingtoneChanged +=
                    (s, e) => { UserSettingsChanged?.Invoke(s, new EventArgs()); };
            }
            catch (NotSupportedException e)
            {
                Log.Warn("SystemInfo", e.Message);
            }

            try
            {
                SystemSettings.EmailAlertRingtoneChanged +=
                    (s, e) => { UserSettingsChanged?.Invoke(s, new EventArgs()); };
            }
            catch (NotSupportedException e)
            {
                Log.Warn("SystemInfo", e.Message);
            }

            try
            {
                SystemSettings.WallpaperHomeScreenChanged +=
                    (s, e) => { UserSettingsChanged?.Invoke(s, new EventArgs()); };
            }
            catch (NotSupportedException e)
            {
                Log.Warn("SystemInfo", e.Message);
            }

            try
            {
                SystemSettings.WallpaperLockScreenChanged +=
                    (s, e) => { UserSettingsChanged?.Invoke(s, new EventArgs()); };
            }
            catch (NotSupportedException e)
            {
                Log.Warn("SystemInfo", e.Message);
            }

            SystemSettings.FontSizeChanged += (s, e) => { FontChanged?.Invoke(s, new EventArgs()); };
            SystemSettings.FontTypeChanged += (s, e) => { FontChanged?.Invoke(s, new EventArgs()); };

            SystemSettings.SoundLockSettingChanged +=
                (s, e) => { SoundChanged?.Invoke(s, new EventArgs()); };
            SystemSettings.SoundSilentModeSettingChanged +=
                (s, e) => { SoundChanged?.Invoke(s, new EventArgs()); };
            SystemSettings.SoundTouchSettingChanged +=
                (s, e) => { SoundChanged?.Invoke(s, new EventArgs()); };
            SystemSettings.SoundNotificationRepetitionPeriodChanged +=
                (s, e) => { SoundChanged?.Invoke(s, new EventArgs()); };

            SystemSettings.DeviceNameChanged    += (s, e) => { OtherChanged?.Invoke(s, new EventArgs()); };
            SystemSettings.MotionSettingChanged += (s, e) => { OtherChanged?.Invoke(s, new EventArgs()); };
        }
Beispiel #3
0
 /// <summary>
 /// Invoked on email alert ring tone setting change.
 /// </summary>
 /// <param name="s">Object that sent event.</param>
 /// <param name="e">Event parameters.</param>
 private void OnEmailAlertRingtoneChanged(object s, EmailAlertRingtoneChangedEventArgs e)
 {
     UserSettingsChanged?.Invoke(s, new EventArgs());
 }
Beispiel #4
0
 /// <summary>
 /// Invoked on incoming call ring tone change.
 /// </summary>
 /// <param name="s">Object that sent event.</param>
 /// <param name="e">Event parameters.</param>
 private void OnIncomingCallRingtoneChanged(object s, IncomingCallRingtoneChangedEventArgs e)
 {
     UserSettingsChanged?.Invoke(s, new EventArgs());
 }
Beispiel #5
0
 /// <summary>
 /// Invoked on home screen wallpaper setting change.
 /// </summary>
 /// <param name="s">Object that sent event.</param>
 /// <param name="e">Event parameters.</param>
 private void OnWallpaperHomeScreenChanged(object s, WallpaperHomeScreenChangedEventArgs e)
 {
     UserSettingsChanged?.Invoke(s, new EventArgs());
 }