public abstract void PreferenceValueChanged(PreferenceCellItem item);
예제 #2
0
        public void SetItem(PreferenceCellItem item)
        {
            _item = item;
            BackgroundView.BackgroundColor = item.Enabled ? UIColor.White : UIColor.FromRGB(0.95f, 0.95f, 0.95f);
            TextLabel.Text = item.Title;
            TextLabel.TextColor = item.Enabled ? UIColor.Black : UIColor.FromRGB(0.7f, 0.7f, 0.7f);
            DetailTextLabel.Text = item.Description;
            DetailTextLabel.TextColor = item.Enabled ? UIColor.Gray : UIColor.FromRGB(0.85f, 0.85f, 0.85f);
            Switch.Hidden = item.CellType != PreferenceCellType.Boolean;
            Switch.Enabled = item.Enabled;
            Slider.Hidden = item.CellType != PreferenceCellType.Slider;
            SelectionStyle = item.CellType != PreferenceCellType.Boolean && item.CellType != PreferenceCellType.Slider && item.Enabled ? UITableViewCellSelectionStyle.Default : UITableViewCellSelectionStyle.None;
			ValueTextField.Hidden = item.CellType != PreferenceCellType.Integer;

			ValueTextLabel.Text = string.Empty;
			ValueTextField.Text = string.Empty;
			ValueTextField.Tag = (int)item.CellType;

            if (item.Value == null)
                return;

            switch (item.CellType)
            {
                case PreferenceCellType.Button:
                    break;
                case PreferenceCellType.Boolean:
                    Switch.On = (bool)item.Value;
                    break;
                case PreferenceCellType.String:
                    break;
                case PreferenceCellType.Integer:
					ValueTextField.Text = string.Format("{0} {1}", (int)item.Value, item.ScaleName);
                    break;
                case PreferenceCellType.Slider:
                    ValueTextLabel.Text = string.Format("{0} {1}", (int)item.Value, item.ScaleName);
                    MinValueTextLabel.Text = string.Format("{0} {1}", item.MinValue, item.ScaleName);
                    MaxValueTextLabel.Text = string.Format("{0} {1}", item.MaxValue, item.ScaleName);
                    Slider.MinValue = item.MinValue;
                    Slider.MaxValue = item.MaxValue;
                    Slider.Value = (int)item.Value;
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }
        }
        public override void PreferenceValueChanged(PreferenceCellItem item)
        {
            var localItem = _items.FirstOrDefault(x => x.Id == item.Id);
            if (localItem == null)
                return;

            localItem.Value = item.Value;

			if (item.Id == "sync_service_enabled")
				_config.IsSyncServiceEnabled = (bool)item.Value;
			else if (item.Id == "sync_service_port")
				_config.SyncServicePort = (int)item.Value;

			OnSetLibraryPreferences(_config);
        }
		public override void PreferenceValueChanged(PreferenceCellItem item)
		{
			var localItem = _items.FirstOrDefault(x => x.Id == item.Id);
			if (localItem == null)
				return;

			localItem.Value = item.Value;

			if (item.Id == "buffer_size")
				_config.BufferSize = (int)item.Value;
			else if (item.Id == "update_period")
				_config.UpdatePeriod = (int)item.Value;

			OnSetAudioPreferences(_config);
		}
        public override void PreferenceValueChanged(PreferenceCellItem item)
        {
            var localItem = _items.FirstOrDefault(x => x.Id == item.Id);
            if (localItem == null)
                return;

            localItem.Value = item.Value;

            if (item.Id == "enable_resume_playback")
                _config.IsResumePlaybackEnabled = (bool)item.Value;
            else if (item.Id == "enable_resume_playback_wifi_only")
				_config.IsSyncOnlyOnWifiEnabled = (bool)item.Value;
			else if (item.Id == "enable_equalizer_presets_sync")
				_config.IsSyncPresetsEnabled = (bool)item.Value;
			else if (item.Id == "enable_playlist_sync")
				_config.IsSyncPlaylistsEnabled = (bool)item.Value;

            OnSetCloudPreferences(_config);
        }
		public override void PreferenceValueChanged(PreferenceCellItem item)
		{
			var localItem = _items.FirstOrDefault(x => x.Id == item.Id);
			if (localItem == null)
				return;

			localItem.Value = item.Value;

			if (item.Id == "update_frequency_song_position")
				_config.SongPositionUpdateFrequency = (int)item.Value;
			else if (item.Id == "update_frequency_output_meter")
				_config.OutputMeterUpdateFrequency = (int)item.Value;
			else if (item.Id == "peak_files_maximum_size")
				_config.MaximumPeakFolderSize = (int)item.Value;

			OnSetGeneralPreferences(_config);
		}