The result Im after is a list (WPF) of items that is populated one at a time async from a web service (WCF). I figured RX could be a good option for this?
My web service method is returning an array of strings (for now) and at the client-side Im using:
var list = Observable.FromAsyncPattern<string[]>(clien开发者_开发知识库t.BeginList, client.EndList);
But now what? Im not familiar with RX at all and I feel very lost. Anyhow I guess my web service has to stream the list instead of sending it in a chunk if I want them to pop in continously?
FromObservablePattern
returns a Func<IObservable>
(or possibly with arguments if the service takes any), so you call the delegate and then subscribe to the source:
var list = Observable.FromAsyncPattern<string[]>(client.BeginList, client.EndList);
list().Subscribe(items =>
{
// items is the string[]
});
精彩评论