0
我想獲得一個簡單的骨架ViewModel設置與ReactiveUI 6(測試版),並不斷收到編譯器錯誤(在Xamarin工作室,FWIW)。在RxUI 6中訂閱ReactiveCommand的正確方法是什麼?
代碼:
using System;
using System.Reactive;
using System.Reactive.Linq;
using ReactiveUI;
// ...
public IReactiveCommand TryAuthenticateCommand { get; protected set; }
// ...
this.TryAuthenticateCommand = ReactiveCommand.Create(
this.WhenAny(
x => x.Username,
x => x.Password,
(username, password) =>
!string.IsNullOrWhiteSpace(username.Value) &&
!string.IsNullOrWhiteSpace(password.Value)));
this.TryAuthenticateCommand.Subscribe(x => MessageBus.Current.SendMessage("Yes!"));
錯誤:
Error CS0411: The type arguments for method `System.ObservableExtensions.Subscribe<T>(this System.IObservable<T>, System.Action<T>)' cannot be inferred from the usage. Try specifying the type arguments explicitly (CS0411)
試圖添加'使用System.Reactive;'並沒有區別。 –
System.Reactive.Linq?我永遠不會記得那個擴展方法的生命 –
是的,我已經得到了它們(見更新的問題)。任何其他? :) –