Esempio n. 1
0
 /// <summary>
 /// Instantiates a new RelayCommand with a delegate to be executed when the command is called, and a predicate to check if the command can be called.
 /// </summary>
 /// <param name="execute">The method to be exeucted when the command is called.</param>
 /// <param name="canExecute">The predicate to check if the command is callable.</param>
 public RelayCommand(ExecuteMethod execute, CanExecuteMethod canExecute)
 {
     if (execute == null)
     {
         throw new ArgumentNullException("execute");
     }
     _execute    = execute;
     _canExecute = canExecute;
 }
Esempio n. 2
0
 public DelegateCommand(ExcuteMethod <T> executeMethod, CanExecuteMethod <T> canExecuteMethod)
 {
     this.executeMethod    = executeMethod;
     this.canExecuteMethod = canExecuteMethod;
 }
Esempio n. 3
0
 /// <inheritdoc />
 public override bool CanExecute(object parameter = null)
 {
     return(!IsExecuting && (CanExecuteMethod?.Invoke() ?? true));
 }
Esempio n. 4
0
 public RemoveCommand(ExecuteMethod <T> executeRemove, CanExecuteMethod <T> canExecuteRemove)
 {
     this.executeRemove    = executeRemove;
     this.canExecuteRemove = canExecuteRemove;
 }
 public RelaySyncCommand(ExecuteMethod execute, CanExecuteMethod canExecute = null)
 {
     _execute    = execute;
     _canExecute = canExecute;
 }