/// <summary>Конструктор команды</summary> /// <param name="executeAction">Выполняемый метод команды</param> /// <param name="canExecuteAction">Метод разрешающий выполнение команды</param> public RelayCommandAction(ExecuteActionHandler execute, CanExecuteActionHandler canExecute = null) { this.execute = ExecuteAction; this.canExecute = CanExecuteAction; executeAction = execute ?? throw new ArgumentNullException(nameof(execute)); canExecuteAction = canExecute ?? CanExecuteActionTrue; }
/// <inheritdoc cref="WpfRelayCommand(ExecuteHandler,CanExecuteHandler,Dispatcher)"/> public WpfRelayCommandAction(ExecuteActionHandler execute, CanExecuteActionHandler canExecute = null, Dispatcher dispatcher = null) : base(null, null, dispatcher) { this.execute = ExecuteAction; this.canExecute = CanExecuteAction; executeAction = execute ?? throw new ArgumentNullException(nameof(execute)); canExecuteAction = canExecute ?? CanExecuteActionTrue; }
/// <summary>Конструктор команды</summary> /// <param name="execute">Выполняемый метод команды</param> /// <param name="canExecute">Метод разрешающий выполнение команды</param> public RelayActionCommand(ExecuteActionHandler execute, CanExecuteActionHandler canExecute = null) : base(_ => execute(), _ => canExecute()) => CanExecuteChanged += (s, e)
/// <summary>Конструктор команды</summary> /// <param name="execute">Выполняемый метод команды</param> /// <param name="canExecute">Метод разрешающий выполнение команды</param> public RelayActionCommand(ExecuteActionHandler execute, CanExecuteActionHandler canExecute = null) : base(_ => execute(), _ => canExecute()) { }