Hi,
I have a ReactiveCommand bound to a XAML button like this:
XAML:
<Button Content="Update" HorizontalAlignment="Right" Command="{Binding CreateSeries}"/>
ViewModel:
public ReactiveCommand<IList<IChartSeriesViewModel>> CreateSeries { get; protected set; }
In ctor:
CreateSeries = ReactiveCommand.CreateAsyncTask(_ => CreateSeriesImpl());
CreateSeries.Subscribe(chartSeriesViewModels =>
{
SeriesCollection = new ObservableCollection<IChartSeriesViewModel>(chartSeriesViewModels);
});
The async dummy task:
private async Task<IList<IChartSeriesViewModel>> CreateSeriesImpl()
{
const int nSimulations = 100;
IEnumerable<Task<Data>> readDataTasks = Enumerable.Range(0, nSimulations).Select(ReadData);
Data[] datas = await Task.WhenAll(readDataTasks);
return datas.Select(CreateChartSeries).ToList();
}
When I press my 'Update' button it id disabled as expected, however, it never gets enabled again even though the task finishes and my plots gets updated. Is there something I am forgetting? Shouldn't the button get enabled automagically when the task finishes?
Another thing, I tried using ReactiveList instead of ObservableCollection, but the plot would never update (SciChart by the way).
Sincerely
Atle