Example #1
0
        /// <inheritdoc/>
        public bool RegisterDelegate(string commandName, CommandExecuteDel execute, CommandCanExecuteDel?canExecute = null)
        {
            if (!ValidateName(commandName))
            {
                return(false);
            }

            _singletonCommands[commandName] = new DelegateCommand(execute, canExecute);
            return(true);
        }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DelegateCommand"/> class.
 /// </summary>
 /// <param name="execute">A delegate that performs the command action.</param>
 /// <param name="canExecute">A delegate that checks if the command can be executed.</param>
 public DelegateCommand(CommandExecuteDel execute, CommandCanExecuteDel?canExecute = null)
 {
     _execute    = execute ?? throw new ArgumentException($"'{nameof(execute)}' cannot be null.");
     _canExecute = canExecute;
 }