c# - 有没有办法跟踪反应命令何时完成执行?
问题描述
有谁知道如何跟踪响应式命令已完成执行并连接将在此之后开始运行的方法的事实?
PS 在命令的处理程序方法末尾调用方法时的变体不适合我的情况。
提前致谢!
解决方案
ReactiveCommand 有一个名为 observable 的属性IsExecuting
,可用于观察命令何时执行。处理这种情况的一种方法是这样做:
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
推荐阅读
- python - 如何使用列表中的函数参数进行函数调用
- node.js - 如何使用节点 api 在 azure devops 工作项和 git 分支之间添加链接?
- react-native - 基本的简单 React Navigation v5 在屏幕之间导航
- flutter - 颤动 - 如何在顶部和底部对齐(这是问题) - 和列中间部分
- java - 如何创建通用数量的对象?
- r - 为什么 coord_map() 会覆盖 ggplot 中的 dup_axis() 以及如何解决它
- reactjs - 将 ol-ext 导入 React - 打开第 6 层项目
- android - 有没有办法获取 Android 上的视频帧总数?
- php - Laravel 7 __construct 中的用户数据
- ios - iOS 9 的 UNUserNotificationCenter 替代方案