コード例 #1
0
        public ActionCommand(Action execute, IObservableReadOnlyValue <bool> canExecute)
        {
            _execute   = execute ?? throw new ArgumentNullException(nameof(execute));
            CanExecute = canExecute ?? ObservableValue.Create(true);

            _canExecuteSubscription = canExecute?.Subscribe(x =>
                                                            CanExecuteChanged?.Invoke(this, EventArgs.Empty));
        }
コード例 #2
0
        public AsyncActionCommand(Func <CancellationToken, Task> executeAsync, IObservableReadOnlyValue <bool> canExecute)
        {
            _executeAsync = executeAsync ?? throw new ArgumentNullException(nameof(executeAsync));
            CanExecute    = canExecute ?? ObservableValue.Create(true);

            _canExecuteSubscription = canExecute?.Subscribe(x =>
                                                            CanExecuteChanged?.Invoke(this, EventArgs.Empty));
        }