reactivecommand iobservable code example
Example: reactivecommand iobservable
// Each time values of UserName and Password properties change,
// the canExecute observable is signalled and the logic that
// determines if command execution should be allowed is executed.
var canExecute = this.WhenAnyValue(
x => x.UserName, x => x.Password,
(userName, password) =>
!string.IsNullOrEmpty(userName) &&
!string.IsNullOrEmpty(password));
// The command will be unavailable during execution of LogOnAsync
// method, or while UserName and Password ViewModel properties are
// nulls or empty strings. In other words, canExecute supplements
// the default executability behavior, it doesn't replace it.
var command = ReactiveCommand.CreateFromTask(LogOnAsync, canExecute);