コード例 #1
0
ファイル: AsyncCommand`1.cs プロジェクト: sk8tz/Gu.Reactive
 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);
 }
コード例 #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
            };
        }