private AsyncCommand(ITaskRunner <TParameter> runner, ICondition condition) : base(runner.Run, condition) { this.runner = runner; runner.ObservePropertyChangedSlim(nameof(runner.TaskCompletion)) .Subscribe(_ => this.OnPropertyChanged(nameof(this.Execution))); this.CancelCommand = new ConditionRelayCommand(runner.Cancel, runner.CanCancelCondition); }
private AsyncCommand(ITaskRunner runner, ConditionAndDisposable conditionAndDisposable) : base(runner.Run, conditionAndDisposable.Condition) { this.CancelCommand = new ConditionRelayCommand(runner.Cancel, runner.CanCancelCondition); this.runner = runner; var completionSubscription = runner.ObservePropertyChangedSlim(nameof(runner.TaskCompletion)) .Subscribe(_ => this.OnPropertyChanged(nameof(this.Execution))); this.disposable = conditionAndDisposable.Disposable == null ? completionSubscription : new CompositeDisposable(2) { completionSubscription, conditionAndDisposable.Disposable }; }