Ejemplo n.º 1
0
        /// <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()); };
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Invoked on device name change.
 /// </summary>
 /// <param name="s">Object that sent event.</param>
 /// <param name="e">Event parameters.</param>
 private void OnDeviceNameChanged(object s, DeviceNameChangedEventArgs e)
 {
     OtherChanged?.Invoke(s, new EventArgs());
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Invoked on motion settings change.
 /// </summary>
 /// <param name="s">Object that sent event.</param>
 /// <param name="e">Event parameters.</param>
 private void OnMotionSettingChanged(object s, MotionSettingChangedEventArgs e)
 {
     OtherChanged?.Invoke(s, new EventArgs());
 }