i am using a IObservable to do some loading in the background. i want to specify when this is finished loading. How can i do this only once, instead of every time my data retriver does a yield return? How do I do this?
bool IsLoading = true;
ObservableCollection<MyData> dataList = new
ObservableCollection<MyData>();
DataLoader.RetrieveData().ToObservable(Scheduler.ThreadPool).Select(x => x).ObserverOn(Scheduler.Dispatcher).Subscribe(x => {
dataList.Add(x);
IsLoading = false;});
You should look at the Finally extension method, it will do exactly what you want!
That should execute after the observable sequence is terminated.