Esempio n. 1
0
        protected virtual async void OnSettingsValueChanged(ISettingsItemVm item)
        {
            switch (item.ElementType)
            {
            case SettingsElementType.Region:
                //var regionId = ((ISettingsPickerVm)item).SelectedValueId;
                //AppSettings.RegionID = regionId;
                //ChangeRegionHeaderTo(regionId);
                break;

            case SettingsElementType.Geolocation:
                AppSettings.IsGeolocationEnabled = ((SettingsSwitchVm)item).Enabled;
                break;

            case SettingsElementType.Notifications:
                try
                {
                    if (_notificationCTS != null)
                    {
                        _notificationCTS.Cancel();
                    }

                    _notificationCTS = new CancellationTokenSource();

                    var enabled = ((SettingsSwitchVm)item).Enabled;
                    await VmService.ChangeNotifications(enabled, _notificationCTS.Token);

                    AppSettings.IsNotificationsEnabled = enabled;
                }
                catch (OperationCanceledException)
                {
                }
                break;
            }
        }