예제 #1
0
 /// <summary>
 /// Removes a registered command.
 /// </summary>
 /// <param name="command">The registered command.</param>
 public virtual void Unregister(Command command)
 {
     if (!_commands.Contains(command))
     {
         throw new ArgumentException("The specified command has not been registered.", nameof(command));
     }
     _commands.Remove(command);
 }
예제 #2
0
 /// <summary>
 /// Register a command to be executed.
 /// </summary>
 /// <param name="command">Command to execute.</param>
 public virtual void Register(Command command)
 {
     if (_commands.Contains(command))
     {
         throw new ArgumentException("The specified command already registered.", nameof(command));
     }
     _commands.Add(command);
 }