/// <summary> /// Remove a command from the command map /// </summary> /// <param name="commandName">The name of the command</param> internal void RemoveCommand(string commandName) { if (RelayCommands.ContainsKey(commandName)) { RelayCommands[commandName].Dispose(); RelayCommands.Remove(commandName); } }
/// <summary> /// Add a named command to the command map /// </summary> /// <param name="commandName">The name of the command</param> /// <param name="executeMethod">The method to execute</param> /// <param name="canExecuteMethod">The method to execute to check if the command can be executed</param> internal void AddCommand(string commandName, Action <object> executeMethod, Predicate <object> canExecuteMethod, bool isVisible) { if (RelayCommands.ContainsKey(commandName)) { RelayCommands[commandName].Dispose(); } RelayCommands[commandName] = new RelayCommand(executeMethod, canExecuteMethod, isVisible); }