使用ReactiveUI按顺序执行一组命令 [英] Execute a set of commands in order, sequentially with ReactiveUI
本文介绍了使用ReactiveUI按顺序执行一组命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个 ViewModel
,其中包含一些用户可以手动调用的 ReactiveCommands
.
I have a ViewModel
with some ReactiveCommands
that user can invoke manually.
CommandA
CommandB
CommandC
因此,用户只能先调用 B 或 A ,然后再调用 C .
So the user can invoke only B, or A first, and then C.
问题在于,我想创建另一个命令来按顺序运行它们(从A到C).它们不应该并行运行,而是顺序>.
如何命令给定特征?
推荐答案
导入System.Reactive.Linq,现在您可以:
Import System.Reactive.Linq, now you can:
{
await CommandA.Execute();
await CommandB.Execute();
await CommandC.Execute();
}
System.Reactive.Linq使IObservable处于等待状态.
System.Reactive.Linq makes IObservable as awaitable.
这篇关于使用ReactiveUI按顺序执行一组命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文