开发者

Reactive Extensions wait for method to finish

We are starting to refactor our silverlight application using some reactive extensions. I have an Initialize method that does some work. I have a call to a method within the Initialize method that must be completed before the rest of the Initialize method is called.

 LoadTaskQueues(_currentUser.InstitutionID);

        if (_params.Task != null)
        {
            LoadTaskInformation(_params.Task);
            return null;
        }

I need to have Loa开发者_如何学CdTaskQueues completed before it runs the LoadTaskInformation.


Assuming that LoadTaskQueues returns IObservable (you don't specify), you want to Subscribe here:

LoadTaskQueues()
    .Where(_ => _params.Task != null)
    .Subscribe(_ =>  LoadTaskInformation(_params.Task));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜