开发者

Reactive Extensions wait for method to finish

开发者 https://www.devze.com 2023-03-08 12:59 出处:网络
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 mus

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

精彩评论

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