/// <summary> /// Initializes a new instance of the <see cref="ConvertCSToVBCommand"/> class. /// Adds our command handlers for menu (commands must exist in the command table file) /// </summary> /// <param name="package">Owner package, not null.</param> ConvertCSToVBCommand(REConverterPackage package) { if (package == null) { throw new ArgumentNullException(nameof(package)); } this.package = package; OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (commandService != null) { // Command in main menu var menuCommandID = new CommandID(CommandSet, MainMenuCommandId); var menuItem = new OleMenuCommand(CodeEditorMenuItemCallback, menuCommandID); menuItem.BeforeQueryStatus += CodeEditorMenuItem_BeforeQueryStatus; commandService.AddCommand(menuItem); // Command in code editor's context menu var ctxMenuCommandID = new CommandID(CommandSet, CtxMenuCommandId); var ctxMenuItem = new OleMenuCommand(CodeEditorMenuItemCallback, ctxMenuCommandID); ctxMenuItem.BeforeQueryStatus += CodeEditorMenuItem_BeforeQueryStatus; commandService.AddCommand(ctxMenuItem); // Command in project item context menu var projectItemCtxMenuCommandID = new CommandID(CommandSet, ProjectItemCtxMenuCommandId); var projectItemCtxMenuItem = new OleMenuCommand(ProjectItemMenuItemCallback, projectItemCtxMenuCommandID); projectItemCtxMenuItem.BeforeQueryStatus += ProjectItemMenuItem_BeforeQueryStatus; commandService.AddCommand(projectItemCtxMenuItem); } }
/// <summary> /// Initializes a new instance of the <see cref="ConvertVBToCSCommand"/> class. /// Adds our command handlers for menu (commands must exist in the command table file) /// </summary> /// <param name="package">Owner package, not null.</param> ConvertVBToCSCommand(REConverterPackage package) { if (package == null) { throw new ArgumentNullException(nameof(package)); } this.package = package; OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (commandService != null) { // Command in main menu var menuCommandID = new CommandID(CommandSet, MainMenuCommandId); var menuItem = new OleMenuCommand(CodeEditorMenuItemCallback, menuCommandID); menuItem.BeforeQueryStatus += CodeEditorMenuItem_BeforeQueryStatus; commandService.AddCommand(menuItem); // Command in code editor's context menu var ctxMenuCommandID = new CommandID(CommandSet, CtxMenuCommandId); var ctxMenuItem = new OleMenuCommand(CodeEditorMenuItemCallback, ctxMenuCommandID); ctxMenuItem.BeforeQueryStatus += CodeEditorMenuItem_BeforeQueryStatus; commandService.AddCommand(ctxMenuItem); // Command in project item context menu var projectItemCtxMenuCommandID = new CommandID(CommandSet, ProjectItemCtxMenuCommandId); var projectItemCtxMenuItem = new OleMenuCommand(ProjectItemMenuItemCallback, projectItemCtxMenuCommandID); projectItemCtxMenuItem.BeforeQueryStatus += ProjectItemMenuItem_BeforeQueryStatus; commandService.AddCommand(projectItemCtxMenuItem); } }
/// <summary> /// Initializes the singleton instance of the command. /// </summary> /// <param name="package">Owner package, not null.</param> public static void Initialize(REConverterPackage package) { Instance = new ConvertCSToVBCommand(package); }
/// <summary> /// Initializes the singleton instance of the command. /// </summary> /// <param name="package">Owner package, not null.</param> public static void Initialize(REConverterPackage package) { Instance = new ConvertVBToCSCommand(package); }