/// <summary> /// Retrieves all the Command Templates defined by this Presenter /// </summary> /// <param name="presenter">The Presenter to check</param> /// <returns>The matching Command Templates</returns> public ICollection <GuiCommandTemplate> GetCommandTemplates(GuiPresenter presenter) { //**************************************** IDictionary <string, GuiCommandTemplate> CommandTemplates; //**************************************** if (_CommandMappings.TryGetValue(presenter.GetType(), out CommandTemplates)) { return(CommandTemplates.Values); } throw new ArgumentException("Presenter does not exist"); }
/// <summary> /// Retrieves the named Command Template if defined by this Presenter /// </summary> /// <param name="presenter">The Presenter to check</param> /// <param name="commandName">The name of the Command Template</param> /// <returns>The requested Command Template, or null if not defined</returns> public GuiCommandTemplate GetCommandTemplate(GuiPresenter presenter, string commandName) { //**************************************** IDictionary <string, GuiCommandTemplate> CommandTemplates; GuiCommandTemplate MyTemplate; //**************************************** if (!_CommandMappings.TryGetValue(presenter.GetType(), out CommandTemplates)) { throw new ArgumentException("Presenter does not exist"); } if (CommandTemplates.TryGetValue(commandName, out MyTemplate)) { return(MyTemplate); } return(null); }