有没有办法跟踪反应命令何时完成执行? [英] Is there a way to track when reactive command finished its execution?

查看:41
本文介绍了有没有办法跟踪反应命令何时完成执行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道如何跟踪响应式命令已完成执行并连接方法,该方法将在此之后开始运行?

Does anybody know how to track the fact that reactive command has finished its execution and hook up the method, which will start running after that?

附言在命令处理程序方法的末尾调用方法时的变体不适合我的情况.

P.S. The variant when calling the method in the end of the command's handler method does not fit in my situation.

提前致谢!

推荐答案

ReactiveCommand 有一个名为 IsExecuting 的可观察属性,可用于观察命令何时执行.处理这种情况的一种方法是做这样的事情:

ReactiveCommand has an observable property called IsExecuting that can be used to observe when the command is being executed. One way to handle this case would be doing something like this:

YourCommand.IsExecuting
    .Skip(1) // IsExecuting has an initial value of false.  We can skip that first value
    .Where(isExecuting => !isExecuting) // filter until the executing state becomes false
    .Subscribe(_ => YourMethodCall()); // run your method now that the command is done

这篇关于有没有办法跟踪反应命令何时完成执行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆