Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
        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
            };
        }