I make this async webrequest call mutliple times(can be twice or thrice or even 6 times depending on conditions)
var request = HttpWebRequest.CreateHttp(url);
var observableRequest = Observable.FromAsyncPattern<WebResponse>(
request.BeginGetResponse, request.EndGetResponse);
Observable.Timeout(observableRequest.Invoke(), TimeSpan.FromSeconds(120)).
Subscribe(response => { HandleListResult(response); },
exception => { HandleListResultTimeOut(exception); });
I have a Collection (List) in the ViewModel which has a Binding to a LisBox and i would like to keep adding to the collection after each response returns.
What is the best practice to make this happen using Reactive Extensions ? Would be great if someone can show me some sample code !
Thanks in advance
You can translate url flow directly into streams:
And then you need to observe your responces on UI, you need to use .ObserveOnDispatcher(), f.e.: