我正在使用 Reactive UI 7
我有以下反应命令:
public ReactiveCommand SignupCommand { get; protected set; }
SignupCommand = ReactiveCommand.CreateFromObservable<ParentEntity>(RegisterTask);
SignupCommand.IsExecuting.Subscribe((isLoading) => {
if (isLoading){
_userDialogs.ShowLoading(AppResources.Signup_CreatingAccount, MaskType.Black);
}
else
{
_userDialogs.HideLoading();
}
});
SignupCommand.ThrownExceptions.Subscribe((ex) =>
{
Debug.WriteLine(String.Format("Exception: {0}", ex.ToString()));
_mvxMessenger.Publish(new ExceptionOcurredMessage(this, ex));
});
当我尝试订阅订阅响应命令结果时,此方法不再可用。有 SubscribeToExpressionChain 方法,我不太明白如何使用。
我应该使用 ReactiveCommandBase 类吗?
提前致谢。
答案 0 :(得分:2)
Subscribe
是System
命名空间中的扩展方法。 ReactiveCommand<TSomething,T>
实施IObservable<T>
。您是否需要添加导入/使用声明?
试试这个:System.ObservableExtensions.Subscribe(SignupCommand, a => { });
。如果编译,你只是错过了使用。