protected override Task BuildSelectedValue(bool withNotifyPropertyChanged = true) { if (CTS != null) { CTS.Cancel(false); } CTS = new CancellationTokenSource(); return(Task.Run(() => { _selectedValue = new ApplyedProductParameter { Id = this.Id, DataType = this.DataType, Values = Items.Where(x => x.Selected).Select(y => new ApplyedProductParameterValue { Id = y.Id }).ToList() }; if (withNotifyPropertyChanged) { RaisePropertyChanged(() => SelectedValue); } }, CTS.Token)); }
protected override void OnSelectionMessageReceived(ProductDetailsSelectionChangedMessage msg) { if (this.Id != msg.ParameterId) { return; } var newSelectedValues = msg.ApplyedParameterValues; if (newSelectedValues.IsNullOrEmpty()) { ClearSelectedValue(); } else { SelectedValue = new ApplyedProductParameter { Id = this.Id, DataType = this.DataType, Values = newSelectedValues }; Items = new ObservableCollection <MultiCollectionItemVM>(Values .Where(x => newSelectedValues.Any(y => y.Id == x.Id)) .Select(z => new MultiCollectionItemVM(z.Id, z.ValueName)) ); } Messenger.Publish(new ProductDetailsReloadWhenValueChangedMessage(this)); }
protected override void OnSelectionMessageReceived(ProductDetailsSelectionChangedMessage msg) { if (this.Id != msg.ParameterId) { return; } var newSelectedValue = msg.ApplyedParameterValues?.SingleOrDefault(); if (newSelectedValue == null) { ClearSelectedValue(); } else { var filterValue = Values.FirstOrDefault(x => x.Id == newSelectedValue.Id); if (filterValue != null) { ValueName = filterValue.ValueName; SelectedValue = new ApplyedProductParameter { Id = this.Id, DataType = this.DataType, Values = new List <ApplyedProductParameterValue> { newSelectedValue } }; } } Messenger.Publish(new ProductDetailsReloadWhenValueChangedMessage(this)); }
protected virtual void ParseRawValues() { Min = MinValueRaw.IsNullOrEmtpy() ? default(T) : FromString(MinValueRaw); Max = MaxValueRaw.IsNullOrEmtpy() ? default(T) : FromString(MaxValueRaw); _selectedValue = new ApplyedProductParameter { Id = this.Id, DataType = this.DataType, MinValue = ToRawString(Min), MaxValue = ToRawString(Max) }; }
protected Task BuildSelectedValue(PickerCollectionItemVM item) { if (CTS != null) { CTS.Cancel(false); } CTS = new CancellationTokenSource(); return(Task.Run(() => { SelectedValue = new ApplyedProductParameter { Id = this.Id, DataType = this.DataType, Values = new List <ApplyedProductParameterValue> { new ApplyedProductParameterValue { Id = item.Id } } }; }, CTS.Token)); }
private void LoadContent() { var newSelectedValue = ApplyedFilterValues?.SingleOrDefault(); if (newSelectedValue == null) { return; } var filterValue = Values.FirstOrDefault(x => x.Id == newSelectedValue.Id); if (filterValue != null) { InvokeOnMainThread(() => ValueName = filterValue.ValueName); SelectedValue = new ApplyedProductParameter { Id = this.Id, DataType = this.DataType, Values = new List <ApplyedProductParameterValue> { newSelectedValue } }; } }