public void RegisterCommand(string commandName, ICommand command, IViewModel viewModel = null)
{
Argument.IsNotNullOrWhitespace("commandName", commandName);
Argument.IsNotNull("command", command);
if (CatelEnvironment.IsInDesignMode)
{
return;
}
lock (_lockObject)
{
Log.Debug("Registering command to '{0}'", commandName);
if (!_commands.ContainsKey(commandName))
{
throw Log.ErrorAndCreateException<InvalidOperationException>("Command '{0}' is not yet created using the CreateCommand method", commandName);
}
_commands[commandName].RegisterCommand(command, viewModel);
InvalidateCommands();
}
}