/// <summary>The remove menu plugin.</summary> /// <param name="toRemove">The to remove.</param> public void RemoveMenuPlugin(IMenuCommandPlugin toRemove) { var plugDescRemove = toRemove.GetPluginDescription(); foreach (var menu in this.ToolsProvidedByPlugins) { if (menu.Header.Equals(plugDescRemove.Name)) { this.ToolsProvidedByPlugins.Remove(menu); KeyValuePair <int, IMenuCommandPlugin> selectMenu = this.InUsePlugin; foreach (var menuCheck in this.menuItemPlugins) { if (menuCheck.Value.GetPluginDescription().Name.Equals(plugDescRemove.Name)) { selectMenu = menuCheck; } } if (this.IsRunningInVisualStudio()) { this.IdOfPluginToRemove = selectMenu.Key; this.OnRemovePluginRequest(EventArgs.Empty); } this.menuItemPlugins.Remove(selectMenu.Key); return; } } }
/// <summary>The add a new menu.</summary> /// <param name="toAdd">The to add.</param> public void AddANewMenu(IMenuCommandPlugin toAdd) { var plugDesc = toAdd.GetPluginDescription(); foreach (var menu in this.ToolsProvidedByPlugins) { if (menu.Header.Equals(plugDesc.Name)) { this.RemoveMenuPlugin(toAdd); this.ToolsProvidedByPlugins.Add(new MenuItem { Header = plugDesc.Name }); this.menuItemPlugins.Add(this.GetFirstFreeId(), toAdd); return; } } this.ToolsProvidedByPlugins.Add(new MenuItem { Header = plugDesc.Name }); this.menuItemPlugins.Add(this.GetFirstFreeId(), toAdd); }
/// <summary>The remove menu plugin.</summary> /// <param name="toRemove">The to remove.</param> public void RemoveMenuPlugin(IMenuCommandPlugin toRemove) { var plugDescRemove = toRemove.GetPluginDescription(); foreach (var menu in this.ToolsProvidedByPlugins) { if (menu.Header.Equals(plugDescRemove.Name)) { this.ToolsProvidedByPlugins.Remove(menu); KeyValuePair<int, IMenuCommandPlugin> selectMenu = this.InUsePlugin; foreach (var menuCheck in this.menuItemPlugins) { if (menuCheck.Value.GetPluginDescription().Name.Equals(plugDescRemove.Name)) { selectMenu = menuCheck; } } if (this.IsRunningInVisualStudio()) { this.IdOfPluginToRemove = selectMenu.Key; this.OnRemovePluginRequest(EventArgs.Empty); } this.menuItemPlugins.Remove(selectMenu.Key); return; } } }
/// <summary> /// Removes the menu plugin. /// </summary> /// <param name="menuPlugin">The menu plugin.</param> public void RemoveMenuPlugin(IMenuCommandPlugin menuPlugin) { this.model.RemoveMenuPlugin(menuPlugin); }