protected override void OnBuyCommandExecute() { if (Quantity == default(float)) { base.OnBuyCommandExecute(); } else if (IncrementCommand != null && IncrementCommand.CanExecute()) { IncrementCommand.Execute(); } }
public CanExecuteChangedAsObservableViewModel() { IncrementCommand = new[] { IsChecked1, IsChecked2 } .CombineLatestValuesAreAllTrue() .ToReactiveCommand() .WithSubscribe(() => Counter.Increment(), CompositeDisposable.Add); CanExecuteIncrementCommand = IncrementCommand.CanExecuteChangedAsObservable() .Select(_ => IncrementCommand.CanExecute()) .ToReadOnlyReactiveProperty() .AddTo(CompositeDisposable); }