Hi,
I have this command:
CreateSeries = ReactiveCommand.CreateAsyncTask(async _ =>
{
var someInput = MayChangeWhileThisIsRunningProperty;
string title = CreateTitle(someInput);
var data = await GetDataAsync(someInput); <-- must create this here and not in the subscription since the property may change
List<IChartSeriesViewModel> chartViewModels = CreateViewModels(data);
return Tuple.Create(chartViewModels , title);
}
Then the result of this should update a bunch of properties:
_series = CreateSeries.ObserveOn(RxApp.MainThreadScheduler)
.Select(x => new ObservableCollection<IChartSeriesViewModel>(x.Item1))
.ToProperty(this, x => x.SeriesCollection);
_yRange = CreateSeries.ObserveOn(RxApp.MainThreadScheduler)
.Select(x => CalculateYRange(x.Item1))
.ToProperty(this, x => x.YRange);
_title = CreateSeries.Select(x => x.Item2)
.ObserveOn(RxApp.MainThreadScheduler)
.ToProperty(this, x => x.Title);
However, this feels a bit ineffective adding 3 subscriptions to a single command's results. Should all these be set at the bottom of the command's expression instead of returning the view models and the plot title?
- Atle