private IntegrationTestServiceCommands(Package package) { if (package == null) { throw new ArgumentNullException(nameof(package)); } _package = package; var commandService = ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (commandService != null) { var startServiceMenuCmdId = new CommandID(GrpIdIntegrationTestServiceCommands, CmdIdStartIntegrationTestService); _startServiceMenuCmd = new MenuCommand(StartServiceCallback, startServiceMenuCmdId) { Enabled = true, Supported = true, Visible = true }; commandService.AddCommand(_startServiceMenuCmd); var stopServiceMenuCmdId = new CommandID(GrpIdIntegrationTestServiceCommands, CmdIdStopIntegrationTestService); _stopServiceMenuCmd = new MenuCommand(StopServiceCallback, stopServiceMenuCmdId) { Enabled = false, Supported = true, Visible = false }; commandService.AddCommand(_stopServiceMenuCmd); } }
private void RegisterCommand(ToolbarCommand id, EventHandler callback) { var menuCommandID = new CommandID(PackageConstants.GuidTortoiseGitToolbarCmdSet, (int)id); var menuItem = new OleMenuCommand(callback, menuCommandID); menuItem.Visible = false; _commandService.AddCommand(menuItem); }
public override void ShowContextMenu(System.ComponentModel.Design.CommandID menuID, int x, int y) { //if (this.Verbs != null) { ContextMenu cm = new ContextMenu(); //foreach (DesignerVerb verb in this.Verbs) //{ MenuItem menuItem = new MenuItem("Delete"); menuItem.Click += new EventHandler(menuItem_Click); menuItem.Tag = StandardCommands.Delete; cm.MenuItems.Add(menuItem); //} // menuItem = new MenuItem("Undo"); menuItem.Click += new EventHandler(menuItem_Click); menuItem.Tag = StandardCommands.Undo; cm.MenuItems.Add(menuItem); // if (cm.MenuItems.Count > 0) { IDesignerHost host = (IDesignerHost)this.GetService(typeof(IDesignerHost)); ISelectionService ss = host.GetService(typeof(ISelectionService)) as ISelectionService; Control ps = ss.PrimarySelection as Control; Point s = ps.PointToScreen(new Point(0, 0)); cm.Show(ps, new Point(x - s.X, y - s.Y)); } } }
public void SetupCommands() { CommandID commandSol = new CommandID(GuidList.guidDiffCmdSet, (int)PkgCmdIDList.cmdSolutionColors); OleMenuCommand menuCommandSol = new OleMenuCommand((s, e) => ApplySolutionSettings(), commandSol); menuCommandSol.BeforeQueryStatus += SolutionBeforeQueryStatus; _mcs.AddCommand(menuCommandSol); }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initilaization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString())); base.Initialize(); OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (mcs != null) { // Create the command to generate the missing steps skeleton CommandID menuCommandID = new CommandID(GuidList.guidSpecFlowGenerateOption, (int)PkgCmdIDList.cmdidGenerate); //Create a menu item corresponding to that command IFileHandler fileHandler = new FileHandler(); StepFileGenerator stepFileGen = new StepFileGenerator(fileHandler); OleMenuCommand menuItem = new OleMenuCommand(stepFileGen.GenerateStepFileMenuItemCallback, menuCommandID); //Add an event handler to the menu item menuItem.BeforeQueryStatus += stepFileGen.QueryStatusMenuCommandBeforeQueryStatus; mcs.AddCommand(menuItem); } }
/* * private void InitializeGlobalCommands() * { * //Most commands like Delete, Cut, Copy and paste are all added to the MenuCommandService * // by the other services like the DesignerHost. Commands like ViewCode and ShowProperties * // need to be added by the IDE because only the IDE would know how to perform those actions. * // This allows people to call MenuCommandSerice.GlobalInvoke( StandardCommands.ViewCode ); * // from designers and what not. .Net Control Designers like the TableLayoutPanelDesigner * // build up their own context menus instead of letting the MenuCommandService build it. * // The context menus they build up are in the format that Visual studio expects and invokes * // the ViewCode and Properties commands by using GlobalInvoke. * * // AbstractFormsDesignerCommand viewCodeCommand = new ViewCode(); * // AbstractFormsDesignerCommand propertiesCodeCommand = new ShowProperties(); * // this.AddCommand( new MenuCommand(viewCodeCommand.CommandCallBack, viewCodeCommand.CommandID)); * // this.AddCommand( new MenuCommand(propertiesCodeCommand.CommandCallBack, propertiesCodeCommand.CommandID)); * } */ public override void ShowContextMenu(CommandID menuID, int x, int y) { string contextMenuPath = "/SharpDevelop/ReportDesigner/ContextMenus/"; ISelectionService sp = (ISelectionService)base.GetService(typeof(ISelectionService)); if (sp != null) { if (menuID == MenuCommands.TraySelectionMenu) { contextMenuPath += "TraySelectionMenu"; } else if (sp.PrimarySelection is RootReportModel) { System.Console.WriteLine("found Root"); contextMenuPath += "ContainerMenu"; } else if (sp.PrimarySelection is BaseSection) { System.Console.WriteLine("found baseSection"); contextMenuPath += "ContainerMenu"; } else { contextMenuPath += "SelectionMenu"; } Point p = panel.PointToClient(new Point(x, y)); MenuService.ShowContextMenu(this, contextMenuPath, panel, p.X, p.Y); } }
public void SetupCommands() { CommandID cmd = new CommandID(CommandGuids.guidImageCmdSet, (int)CommandId.SpriteImage); OleMenuCommand menuCmd = new OleMenuCommand(async (s, e) => await MakeSpriteAsync(), cmd); menuCmd.BeforeQueryStatus += BeforeQueryStatus; _mcs.AddCommand(menuCmd); }
protected override void Initialize() { base.Initialize(); _logger = new Logger(); _dte = GetGlobalService(typeof(DTE)) as DTE; if (_dte == null) return; OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (mcs != null) { CommandID publishCommandId = new CommandID(GuidList.GuidItemMenuCommandsCmdSet, (int)PkgCmdIdList.CmdidWebResourceDeployerPublish); OleMenuCommand publishMenuItem = new OleMenuCommand(PublishItemCallback, publishCommandId); publishMenuItem.BeforeQueryStatus += PublishItem_BeforeQueryStatus; publishMenuItem.Visible = false; mcs.AddCommand(publishMenuItem); CommandID editorPublishCommandId = new CommandID(GuidList.GuidEditorCommandsCmdSet, (int)PkgCmdIdList.CmdidWebResourceEditorPublish); OleMenuCommand editorPublishMenuItem = new OleMenuCommand(PublishItemCallback, editorPublishCommandId); editorPublishMenuItem.BeforeQueryStatus += PublishItem_BeforeQueryStatus; editorPublishMenuItem.Visible = false; mcs.AddCommand(editorPublishMenuItem); } }
private AddInheritDocCommand(Package package) { this.package = package; OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (commandService != null) { var menuCommandId = new CommandID(CommandSet, CommandId); var menuItem = new OleMenuCommand(MenuItemCallback, menuCommandId); commandService.AddCommand(menuItem); menuItem.BeforeQueryStatus += (sender, e) => { bool visible = false; var dte = (DTE)Package.GetGlobalService(typeof(SDTE)); var classElem = SearchService.FindClass(dte); if (classElem != null) { List<CodeElement> codeElements = SearchService.FindCodeElements(dte); if (classElem.ImplementedInterfaces.Count > 0) { visible = true; } else { visible = codeElements.Any(elem => elem.IsInherited() || elem.OverridesSomething()); } } ((OleMenuCommand)sender).Visible = visible; }; } }
/// <summary> /// Initializes a new instance of the <see cref="AliaserCommand"/> class. /// Adds our command handlers for menu (commands must exist in the command table file) /// </summary> /// <param name="package">Owner package, not null.</param> private AliaserCommand(Package package) { if (package == null) { throw new ArgumentNullException("package"); } this.package = package; this.MainService = new AliaserService(); OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (commandService != null) { CommandID menuToAliasCommandID = new CommandID(MenuGroup, ALIASER_TO_ALIAS_COMMAND_ID); CommandID menuToInstanceCommandID = new CommandID(MenuGroup, ALIASER_TO_INSTANCE_COMMAND_ID); EventHandler transformAliasToInstace = this.TransformAliasToInstace; EventHandler transformInstaceToAlias = this.TransformInstaceToAlias; MenuCommand menuItemToInstace = new MenuCommand(transformAliasToInstace, menuToInstanceCommandID); MenuCommand menuItemToAlias = new MenuCommand(transformInstaceToAlias, menuToAliasCommandID); commandService.AddCommand(menuItemToInstace); commandService.AddCommand(menuItemToAlias); } }
protected override void Initialize() { base.Initialize(); _dte = GetService(typeof(DTE)) as DTE2; OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; CommandID cmdCustom = new CommandID(GuidList.guidOpenCommandLineCmdSet, (int)PkgCmdIDList.cmdidOpenCommandLine); OleMenuCommand customItem = new OleMenuCommand(OpenCustom, cmdCustom); customItem.BeforeQueryStatus += BeforeQueryStatus; mcs.AddCommand(customItem); CommandID cmdCmd = new CommandID(GuidList.guidOpenCommandLineCmdSet, (int)PkgCmdIDList.cmdidOpenCmd); MenuCommand cmdItem = new MenuCommand(OpenCmd, cmdCmd); mcs.AddCommand(cmdItem); CommandID cmdPowershell = new CommandID(GuidList.guidOpenCommandLineCmdSet, (int)PkgCmdIDList.cmdidOpenPowershell); MenuCommand powershellItem = new MenuCommand(OpenPowershell, cmdPowershell); mcs.AddCommand(powershellItem); CommandID cmdOptions = new CommandID(GuidList.guidOpenCommandLineCmdSet, (int)PkgCmdIDList.cmdidOpenOptions); MenuCommand optionsItem = new MenuCommand((s, e) => { ShowOptionPage(typeof(Options)); }, cmdOptions); mcs.AddCommand(optionsItem); CommandID cmdExe = new CommandID(GuidList.guidOpenCommandLineCmdSet, (int)PkgCmdIDList.cmdExecuteCmd); OleMenuCommand exeItem = new OleMenuCommand(ExecuteFile, cmdExe); exeItem.BeforeQueryStatus += BeforeExeQuery; mcs.AddCommand(exeItem); }
/// <summary> /// Standard constructor for the tool window. /// </summary> public MyToolWindow() : base(null) { // Set the window title reading it from the resources. this.Caption = Resources.ToolWindowTitle; // Set the image that will appear on the tab of the window frame // when docked with an other window // The resource ID correspond to the one defined in the resx file // while the Index is the offset in the bitmap strip. Each image in // the strip being 16x16. this.BitmapResourceID = 301; this.BitmapIndex = 1; // Create the toolbar. this.ToolBar = new CommandID(GuidList.GuidCroolPackageCmdSet, PkgCmdIDList.ToolbarID); this.ToolBarLocation = (int)VSTWT_LOCATION.VSTWT_TOP; // Create the handlers for the toolbar commands. var mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (null != mcs) { // Command for the combo's list var comboListCmdID = new CommandID(GuidList.GuidCroolPackageCmdSet, PkgCmdIDList.CmdidWindowsMediaFilenameGetList); var comboMenuList = new OleMenuCommand(new EventHandler(this.ComboListHandler), comboListCmdID); mcs.AddCommand(comboMenuList); } // This is the user control hosted by the tool window; Note that, even if this class implements IDisposable, // we are not calling Dispose on this object. This is because ToolWindowPane calls Dispose on // the object returned by the Content property. this.Content = new MyControl(); }
protected override void Initialize() { Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString())); base.Initialize(); // Add our command handlers for menu (commands must exist in the .vsct file) OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (null != mcs) { // Create the command for the menu item. CommandID menuCommandID = new CommandID(GuidList.guidVSScriptsCmdSet, (int)PkgCmdIDList.cmdidConfigureScripts); MenuCommand menuItem = new MenuCommand(HandleScriptsCmd, menuCommandID); mcs.AddCommand(menuItem); LoadScriptsList(); for (int i = 0; i < PkgCmdIDList.numScripts; ++i) { var cmdID = new CommandID(GuidList.guidVSScriptsCmdSet, PkgCmdIDList.cmdidScript0 + i); var cmd = new OleMenuCommand(new EventHandler(HandleScriptMenuItem), cmdID); cmd.BeforeQueryStatus += new EventHandler(HandleScriptBeforeQueryStatus); cmd.Visible = true; mcs.AddCommand(cmd); } } }
// This function is called by the IVsSccProvider service implementation when the active state of the provider changes // The package needs to show or hide the scc-specific commands public virtual void OnActiveStateChange() { MsVsShell.OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as MsVsShell.OleMenuCommandService; if (mcs != null) { CommandID cmd = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdSccCommand); MenuCommand menuCmd = mcs.FindCommand(cmd); menuCmd.Supported = true; menuCmd.Enabled = sccService.Active; menuCmd.Visible = sccService.Active; cmd = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdViewToolWindow); menuCmd = mcs.FindCommand(cmd); menuCmd.Supported = true; menuCmd.Enabled = sccService.Active; menuCmd.Visible = sccService.Active; cmd = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdToolWindowToolbarCommand); menuCmd = mcs.FindCommand(cmd); menuCmd.Supported = true; menuCmd.Enabled = sccService.Active; menuCmd.Visible = sccService.Active; } ShowSccProviderToolWindow(); }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initilaization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { Trace.WriteLine (string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString())); base.Initialize(); OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if ( null != mcs ) { // Create the command for the menu item. CommandID menuCommandID = new CommandID(GuidList.guidChoreoCmdSet, (int)PkgCmdIDList.cmdidMyCommand); MenuCommand menuItem = new MenuCommand(MenuItemCallback, menuCommandID ); mcs.AddCommand( menuItem ); //// Create the command for the tool window //CommandID toolwndCommandID = new CommandID(GuidList.guidChoreoCmdSet, (int)PkgCmdIDList.cmdidMyTool); //MenuCommand menuToolWin = new MenuCommand(ShowToolWindow, toolwndCommandID); //mcs.AddCommand( menuToolWin ); } MacroManager.Initialize(this); MacroManager.LoadMacros(); var registerPriorityCommandTarget = (IVsRegisterPriorityCommandTarget) GetService(typeof(SVsRegisterPriorityCommandTarget)); uint pdwCookie; ErrorHandler.ThrowOnFailure(registerPriorityCommandTarget.RegisterPriorityCommandTarget(0, new MacroCommandTarget(), out pdwCookie)); }
///////////////////////////////////////////////////////////////////////////// // Overridden Package Implementation #region Package Members /// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { ((IServiceContainer)this).AddService(typeof(NpgsqlProviderObjectFactory), new NpgsqlProviderObjectFactory(), true); base.Initialize(); // Add our command handlers for menu (commands must exist in the .vsct file) OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (null != mcs) { // Create the command for the menu item. { CommandID menuCommandID = new CommandID(GuidList.guidNpgsqlDdexProviderCmdSetToolsMenu, (int)PkgCmdIDList.cmdidSetupNpgsql); MenuCommand menuItem = new MenuCommand(MenuItemSetupNpgsqlDdexProvider, menuCommandID); mcs.AddCommand(menuItem); } { CommandID menuCommandID = new CommandID(GuidList.guidNpgsqlDdexProviderCmdSetToolsMenu, (int)PkgCmdIDList.cmdidUninstNpgsql); MenuCommand menuItem = new MenuCommand(MenuItemUninstNpgsqlDdexProvider, menuCommandID); mcs.AddCommand(menuItem); } { CommandID menuCommandID = new CommandID(GuidList.guidNpgsqlDdexProviderCmdSetProjMenu, (int)PkgCmdIDList.cmdidCheckNpgsql); MenuCommand menuItem = new MenuCommand(MenuItemCheckNpgsqlDdexProvider, menuCommandID); mcs.AddCommand(menuItem); } } AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; }
public void SetupCommands() { CommandID commandId = new CommandID(GuidList.guidDiffCmdSet, (int)PkgCmdIDList.cmdDiff); OleMenuCommand menuCommand = new OleMenuCommand((s, e) => Sort(), commandId); menuCommand.BeforeQueryStatus += menuCommand_BeforeQueryStatus; _mcs.AddCommand(menuCommand); }
private CompilerOutputCmds(DevUtilsPackage package) { this.package = package; // Add our command handlers for menu (commands must exist in the .vsct file) OleMenuCommandService mcs = serviceProvider.GetService(typeof (IMenuCommandService)) as OleMenuCommandService; if (null != mcs) { // Create the command for the menu item. CommandID menuCommandID = new CommandID(guidDevUtilsCmdSet, cmdShowAssembly); var cmd = new OleMenuCommand((s, e) => showCppOutput(1), changeHandler, beforeQueryStatus, menuCommandID); cmd.Properties["lang"] = "C/C++"; mcs.AddCommand(cmd); menuCommandID = new CommandID(guidDevUtilsCmdSet, cmdShowPreprocessed); cmd = new OleMenuCommand((s, e) => showCppOutput(2), changeHandler, beforeQueryStatus, menuCommandID); cmd.Properties["lang"] = "C/C++"; mcs.AddCommand(cmd); menuCommandID = new CommandID(guidDevUtilsCmdSet, cmdShowDecompiledCSharp); cmd = new OleMenuCommand((s, e) => showDecompiledCSharp(), changeHandler, beforeQueryStatus, menuCommandID); cmd.Properties["lang"] = "CSharp"; mcs.AddCommand(cmd); } }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initilaization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { Trace.WriteLine (string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString())); base.Initialize(); var core = Infrastructure.Core.Instance; // Init the core. // Add our command handlers for menu (commands must exist in the .vsct file) OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (null != mcs) { // Create the command for the menu item. CommandID menuCommandID = new CommandID(GuidList.guidSuctionCmdSet, (int)PkgCmdIDList.cmdidSuctionSolution); MenuCommand menuItem = new MenuCommand(MenuItemCallback_Solution, menuCommandID); mcs.AddCommand(menuItem); menuCommandID = new CommandID(GuidList.guidSuctionCmdProjectSet, (int)PkgCmdIDList.cmdidSuctionProject); menuItem = new MenuCommand(MenuItemCallback_Project, menuCommandID); mcs.AddCommand(menuItem); menuCommandID = new CommandID(GuidList.guidSuctionCmdItemSet, (int)PkgCmdIDList.cmdidSuctionItem); menuItem = new MenuCommand(MenuItemCallback_Item, menuCommandID); mcs.AddCommand(menuItem); } }
/// <summary> /// Initializes a new instance of the <see cref="BaseCommand" /> class. /// </summary> /// <param name="package">The hosting package.</param> /// <param name="id">The id for the command.</param> protected BaseCommand(CodeMaidPackage package, CommandID id) : base(BaseCommand_Execute, id) { Package = package; BeforeQueryStatus += BaseCommand_BeforeQueryStatus; }
public void SetupCommands() { CommandID commandId = new CommandID(CommandGuids.guidDiffCmdSet, (int)CommandId.RunDiff); OleMenuCommand menuCommand = new OleMenuCommand((s, e) => PerformDiff(), commandId); menuCommand.BeforeQueryStatus += BeforeQueryStatus; _mcs.AddCommand(menuCommand); }
public void SetupCommands() { CommandID cmd = new CommandID(CommandGuids.guidImageCmdSet, (int)CommandId.CompressImage); OleMenuCommand menuCmd = new OleMenuCommand((s, e) => StartCompress(), cmd); menuCmd.BeforeQueryStatus += BeforeQueryStatus; _mcs.AddCommand(menuCmd); }
protected void Initialize(Guid menuGroup, int commandId) { var cmdId = new CommandID(menuGroup, commandId); Command = new OleMenuCommand(this.OnInvoke, cmdId); Command.BeforeQueryStatus += OnBeforeQueryStatus; CommandService.AddCommand(Command); }
public void SetupCommands() { CommandID cid = new CommandID(CommandGuids.guidEditorExtensionsCmdSet, (int)CommandId.AddGrunt); OleMenuCommand cmd = new OleMenuCommand((s, e) => Execute(), cid); cmd.BeforeQueryStatus += BeforeQueryStatus; _mcs.AddCommand(cmd); }
public static void Register(MenuCommandService mcs) { var cmdId = new CommandID(VSCommandTable.PackageGuids.VSPackageCmdSetGuid, VSCommandTable.CommandIds.CreateServiceCode); var menu = new OleMenuCommand(MenuItemCallbackHandler, cmdId); menu.BeforeQueryStatus += BeforeQueryStatus; mcs.AddCommand(menu); }
public override void ShowContextMenu(CommandID menuID, int x, int y) { ContextMenuStripCodon contextMenuStripCodon = null; if (menuID == MenuCommands.ComponentTrayMenu) { } else if (menuID == MenuCommands.ContainerMenu) { contextMenuStripCodon = new ContainerMenu(this); } else if (menuID == MenuCommands.SelectionMenu) { contextMenuStripCodon = new SelectionMenu(this); } else if (menuID == MenuCommands.TraySelectionMenu) { } else { throw new Exception("ShowContextMenu Error"); } if (contextMenuStripCodon != null) { contextMenuStripCodon.View.Renderer = ToolStripRenders.Default; contextMenuStripCodon.View.Show(x, y); } }
public static void Register(DTE2 dte, MenuCommandService mcs) { _dte = dte; CommandID nestAllId = new CommandID(GuidList.guidFileNestingCmdSet, (int)PkgCmdIDList.cmdRunNesting); OleMenuCommand menuNestAll = new OleMenuCommand(NestAll, nestAllId); mcs.AddCommand(menuNestAll); }
/// <summary> /// Initializes a new instance of the <see cref="SpadeToolWindow" /> class. /// </summary> public SpadeToolWindow() : base(null) { // Set the tool window caption. Caption = "CodeMaid Spade"; // Set the tool window image from resources. BitmapResourceID = 508; BitmapIndex = 0; // Create the toolbar for the tool window. ToolBar = new CommandID(GuidList.GuidCodeMaidToolbarSpadeBaseGroup, PkgCmdIDList.ToolbarIDCodeMaidToolbarSpade); // Setup the associated classes. _viewModel = new SpadeViewModel(); // Register for view model requests to be refreshed. _viewModel.RequestingRefresh += (sender, args) => Refresh(); // Create and set the view. base.Content = new SpadeView { DataContext = _viewModel }; // Register for changes to settings. Settings.Default.SettingsSaving += (sender, args) => Refresh(); }
protected override void Initialize() { base.Initialize(); control = new PendingChangesView(this); // This is the user control hosted by the tool window; Note that, even if this class implements IDisposable, // we are not calling Dispose on this object. This is because ToolWindowPane calls Dispose on // the object returned by the Content property. base.Content = control; OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; var cmd = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdPendingChangesCommit); var menu = new MenuCommand(new EventHandler(OnCommitCommand), cmd); mcs.AddCommand(menu); cmd = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdPendingChangesAmend); menu = new MenuCommand(new EventHandler(OnAmendCommitCommand), cmd); mcs.AddCommand(menu); cmd = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdPendingChangesRefresh); menu = new MenuCommand(new EventHandler(OnRefreshCommand), cmd); mcs.AddCommand(menu); sccProviderService = BasicSccProvider.GetServiceEx<SccProviderService>(); }
/* private void InitializeGlobalCommands() { //Most commands like Delete, Cut, Copy and paste are all added to the MenuCommandService // by the other services like the DesignerHost. Commands like ViewCode and ShowProperties // need to be added by the IDE because only the IDE would know how to perform those actions. // This allows people to call MenuCommandSerice.GlobalInvoke( StandardCommands.ViewCode ); // from designers and what not. .Net Control Designers like the TableLayoutPanelDesigner // build up their own context menus instead of letting the MenuCommandService build it. // The context menus they build up are in the format that Visual studio expects and invokes // the ViewCode and Properties commands by using GlobalInvoke. // AbstractFormsDesignerCommand viewCodeCommand = new ViewCode(); // AbstractFormsDesignerCommand propertiesCodeCommand = new ShowProperties(); // this.AddCommand( new MenuCommand(viewCodeCommand.CommandCallBack, viewCodeCommand.CommandID)); // this.AddCommand( new MenuCommand(propertiesCodeCommand.CommandCallBack, propertiesCodeCommand.CommandID)); } */ public override void ShowContextMenu(CommandID menuID, int x, int y) { string contextMenuPath = "/SharpDevelop/ReportDesigner/ContextMenus/"; var selectionService = (ISelectionService)base.GetService(typeof(ISelectionService)); if (selectionService != null) { if (menuID == MenuCommands.TraySelectionMenu) { contextMenuPath += "TraySelectionMenu"; } else if (selectionService.PrimarySelection is RootReportModel) { System.Console.WriteLine("found Root"); contextMenuPath += "ContainerMenu"; } else if (selectionService.PrimarySelection is BaseSection) { System.Console.WriteLine("found baseSection"); contextMenuPath += "ContainerMenu"; } else { contextMenuPath += "SelectionMenu"; } Point p = panel.PointToClient(new Point(x, y)); MenuService.ShowContextMenu(this, contextMenuPath, panel, p.X, p.Y); } }
public int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) { CommandID cd = new CommandID(pguidCmdGroup, unchecked((int)nCmdID)); List<CommandData> items; if (!_data.TryGetValue(cd, out items)) return (int)Constants.OLECMDERR_E_NOTSUPPORTED; foreach (CommandData d in items) { if (!d.Control.ContainsFocus) continue; CommandEventArgs ce = new CommandEventArgs((VisualGitCommand)cd.ID, GetService<VisualGitContext>()); if (d.UpdateHandler != null) { CommandUpdateEventArgs ud = new CommandUpdateEventArgs(ce.Command, ce.Context); d.UpdateHandler(d.Control, ud); if (!ud.Enabled) return (int)Constants.OLECMDERR_E_DISABLED; } d.Handler(d.Control, ce); return VSConstants.S_OK; } return (int)Constants.OLECMDERR_E_NOTSUPPORTED; }
public static void Register(MenuCommandService mcs) { CommandID nestId = new CommandID(GuidList.guidFileNestingCmdSet, (int)PkgCmdIDList.cmdNest); OleMenuCommand menuNest = new OleMenuCommand(Nest, nestId); mcs.AddCommand(menuNest); menuNest.BeforeQueryStatus += BeforeNest; }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initilaization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { Trace.WriteLine (string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString())); base.Initialize(); Dte = Package.GetGlobalService(typeof(EnvDTE.DTE)) as DTE2; // Add our command handlers for menu (commands must exist in the .vsct file) _attachToIIS = new AttachToIIS(Dte); OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if ( null != mcs ) { // Create the command for the menu item. CommandID menuCommandID = new CommandID(GuidList.guidAlkampferVsix2010CmdSet, (int)PkgCmdIDList.cmdidAttachToIIS); MenuCommand menuItem = new MenuCommand(_attachToIIS.MenuItemCallback, menuCommandID); mcs.AddCommand( menuItem ); } //Stop at first error command. _stopBuildAtFirstErrorCommand = new StopBuildAtFirstError(Dte); mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (null != mcs) { // Create the command for the menu item. CommandID menuCommandID = new CommandID(GuidList.guidAlkampferVsix2010CmdSet, (int)PkgCmdIDList.stopBuildAtFirstError); MenuCommand menuItem = new MenuCommand(_stopBuildAtFirstErrorCommand.MenuItemCallback, menuCommandID); _stopBuildAtFirstErrorCommand.ManageMenuItem(menuItem); mcs.AddCommand(menuItem); } }
public override void ShowContextMenu(CommandID menuID, int x, int y) { //ISelectionService if (menuID == MenuCommands.SelectionMenu || menuID == MenuCommands.ContainerMenu) { ContextMenuStrip contextMenu = new ContextMenuStrip(); ToolStripMenuItem[] menuItems = GetSelectionMenuItems(); if (menuItems.Length > 0) { contextMenu.Items.Add(new ToolStripSeparator()); foreach (ToolStripMenuItem item in menuItems) { if (item.Text == "Add Tab") { contextMenu.Items.Add(new ToolStripSeparator()); } contextMenu.Items.Add(item); } } contextMenu.Show(panel, panel.PointToClient(new Point(x, y))); } else { throw new Exception(); } //Point p = panel.PointToClient(new Point(x, y)); //MenuService.ShowContextMenu(this, contextMenuPath, panel, p.X, p.Y); //ISelectionService selectionService = (ISelectionService)(this.GetService(typeof(ISelectionService))); //ICollection selectedComponents = selectionService.GetSelectedComponents(); //PropertyGrid propertyGrid = (PropertyGrid)this.GetService(typeof(PropertyGrid)); //if (selectedComponents.Count != 1) // return; //Editor ed = new Editor(); //if (ed.ShowDialog() == DialogResult.OK) //{ // object[] comps = new object[selectedComponents.Count]; // int i = 0; // foreach (Object o in selectedComponents) // { // comps[i] = o; // i++; // } // if (comps[0].GetType() == typeof(System.Windows.Forms.Button)) // { // Button btn = comps[0] as Button; // btn.Text = ed.Name; // propertyGrid.SelectedObject = btn; // } //} }
public bool PostExecCommand(System.ComponentModel.Design.CommandID command) { if (command == null) { throw new ArgumentNullException("command"); } return(PostExecCommand(command, null)); }
/// <summary> /// Shows the specified shortcut menu at the specified location. /// </summary> /// <remarks> /// Calling this method invokes the <see cref="OnShowContextMenu"/> event. /// </remarks> /// <seealso cref="System.ComponentModel.Design.CommandID"/> /// <param name="menuID">The System.ComponentModel.Design.CommandID for the shortcut menu to show.</param> /// <param name="x">The x-coordinate at which to display the menu, in screen coordinates.</param> /// <param name="y">The y-coordinate at which to display the menu, in screen coordinates.</param> public void ShowContextMenu(System.ComponentModel.Design.CommandID menuID, int x, int y) { if (OnShowContextMenu != null) { System.Web.UI.Control element = null; element = this.editor.GenericElementFactory.CreateElement(GetPrimaryElement()); OnShowContextMenu(this, new ShowContextMenuEventArgs(new System.Drawing.Point(x, y), false, 0, element)); } }
/// This is called whenever the user right-clicks on a designer. It removes any local verbs /// added by a previous, different selection and adds the local verbs for the current (primary) /// selection. Then it displays the ContextMenu. public void ShowContextMenu(System.ComponentModel.Design.CommandID menuID, int x, int y) { ISelectionService ss = host.GetService(typeof(ISelectionService)) as ISelectionService; // If this is the same component as was last right-clicked on, then we don't need to // make any changes to our collection of local verbs. // if ((lastSelection != null) && (lastSelection != ss.PrimarySelection)) { IDesigner d = host.GetDesigner(lastSelection); if (d != null) { foreach (DesignerVerb verb in d.Verbs) { RemoveLocalVerb(verb); } } } // Update the local verbs for the new selection, if it is indeed new. if (lastSelection != ss.PrimarySelection) { IDesigner d = host.GetDesigner(ss.PrimarySelection as IComponent); if (d.Verbs.Count == 0) { FillVerbs(ss.PrimarySelection as IComponent, d); } foreach (DesignerVerb verb in d.Verbs) { AddLocalVerb(verb); } } // Display our ContextMenu! Note that the coordinate parameters to this method // are in screen coordinates, so we've got to translate them into client coordinates. // //if (cm != null) { Control ps = ss.PrimarySelection as Control; if (ps == null) { ps = VisualPascalABC.Form1.Form1_object; } Point s = ps.PointToScreen(new Point(0, 0)); VisualPascalABC.Form1.Form1_object.cm_Designer.Show(ps, new Point(x - s.X, y - s.Y)); //VisualPascalABC.Form1.Form1_object.cm_Designer.Show(ps, Cursor.Position); } // ss.PrimarySelection might be old news by the next right-click. We need to // be able to remove its verbs if we get a different selection next time // this method is called. We can't remove them right now because we aren't sure // if the MenuItem click events have finished yet (and removing verbs kills // their MenuItem mapping). So we save the selection and do it next time if necessary. // lastSelection = ss.PrimarySelection as IComponent; }
public bool Execute(System.ComponentModel.Design.CommandID cmdId) { var des = GetSelectedDesigner(); if (des == null) { return(false); } return(des.Execute(cmdId)); }
/// We only invoke commands that have been added. public override bool GlobalInvoke(System.ComponentModel.Design.CommandID commandID) { MenuCommand command = FindCommand(commandID); if (command != null) { command.Invoke(); return(true); } return(false); }
/// <summary> /// Searches for the specified command ID and returns the menu command associated /// with it. /// </summary> /// <param name="commandID">The System.ComponentModel.Design.CommandID to search for.</param> /// <returns>The System.ComponentModel.Design.MenuCommand associated with the command /// ID, or <c>null</c> if no command is found.</returns> public System.ComponentModel.Design.MenuCommand FindCommand(System.ComponentModel.Design.CommandID commandID) { foreach (MenuCommand command in commands) { if (command.CommandID == commandID) { return(command); } } return(null); }
public bool PostExecCommand(System.ComponentModel.Design.CommandID command) { ThreadHelper.ThrowIfNotOnUIThread(); if (command == null) { throw new ArgumentNullException("command"); } return(PostExecCommand(command, null)); }
/// <summary> /// Invokes a menu or designer verb command matching the specified command ID. /// </summary> /// <remarks> /// This is widely used by plug-ins to add commands to the base control. /// </remarks> /// <seealso cref="System.ComponentModel.Design.CommandID"/> /// <param name="commandID">The System.ComponentModel.Design.CommandID of the command to search for and execute.</param> /// <returns><c>True</c> if the command was found and invoked successfully; otherwise, <c>false</c>.</returns> public bool GlobalInvoke(System.ComponentModel.Design.CommandID commandID) { foreach (MenuCommand command in commands) { if (command.CommandID.Equals(commandID)) { command.Invoke(); return(true); } } return(false); }
/// called to invoke a command public bool GlobalInvoke(System.ComponentModel.Design.CommandID commandID) { bool result = false; MenuCommand command = FindCommand(commandID); if (command != null) { command.Invoke(); result = true; } return(result); }
/// Find a command based on its CommandID. public System.ComponentModel.Design.MenuCommand FindCommand(System.ComponentModel.Design.CommandID commandID) { if (commands != null) { MenuCommand command = commands[commandID] as MenuCommand; if (command != null) { return(command); } } return(null); }
public bool GlobalInvoke(System.ComponentModel.Design.CommandID commandID) { foreach (MenuCommand command in menuCommands) { if (command.CommandID == commandID) { command.Invoke(); break; } } return(false); }
public override void AddCommandHandlers(IMenuCommandService menuCommandService) { //ModelExplorerCut = new CommandID(GuidSymbol, CutIDSymbol); ModelExplorerCopy = new CommandID(GuidSymbol, CopyIDSymbol); ModelExplorerPaste = new CommandID(GuidSymbol, PasteIDSymbol); //menuCommandService.AddCommand( // new DynamicStatusMenuCommand(new EventHandler(OnStatusCut), new EventHandler(OnMenuCut), ModelExplorerCut)); menuCommandService.AddCommand( new DynamicStatusMenuCommand(new EventHandler(OnStatusCopy), new EventHandler(OnMenuCopy), ModelExplorerCopy)); menuCommandService.AddCommand( new DynamicStatusMenuCommand(new EventHandler(OnStatusPaste), new EventHandler(OnMenuPaste), ModelExplorerPaste)); base.AddCommandHandlers(menuCommandService); }
public bool Execute(System.ComponentModel.Design.CommandID cmdId) { var des = GetSelectedDesigner(); if (des != null) { if (des.Execute(cmdId)) { return(true); } } if (cmdId.Guid == CmdSets.GuidReko) { switch (cmdId.ID) { case CmdIds.CollapseAllNodes: tree.CollapseAll(); break; } } return(false); }
/// <summary> /// 弹出右键菜单 /// </summary> /// <param name="menuID"></param> /// <param name="x"></param> /// <param name="y"></param> public override void ShowContextMenu(System.ComponentModel.Design.CommandID menuID, int x, int y) { ISelectionService selection = GetService(typeof(ISelectionService)) as ISelectionService; IDesignerHost idh = GetService(typeof(IDesignerHost)) as IDesignerHost; //if (selection.PrimarySelection != idh.RootComponent) //{ ContextMenuStrip cm = new ContextMenuStrip(); cm.Items.AddRange(BuildMenuItems()); ISelectionService ss = GetService(typeof(ISelectionService)) as ISelectionService; Control ps = ss.PrimarySelection as Control; if (ps != null) { Point s = ps.PointToScreen(new Point(0, 0)); cm.Show(ps, new Point(x - s.X, y - s.Y)); } //} }
/// called to show the context menu for the selected component. public void ShowContextMenu(System.ComponentModel.Design.CommandID menuID, int x, int y) { ISelectionService selectionService = host.GetService(typeof(ISelectionService)) as ISelectionService; // get the primary component IComponent primarySelection = selectionService.PrimarySelection as IComponent; // if the he clicked on the same component again then just show the context // menu. otherwise, we have to throw away the previous // set of local menu items and create new ones for the newly // selected component if (lastSelectedComponent != primarySelection) { // remove all non-global menu items from the context menu ResetContextMenu(); // get the designer IDesigner designer = host.GetDesigner(primarySelection); // not all controls need a desinger if (designer != null) { // get designer's verbs DesignerVerbCollection verbs = designer.Verbs; foreach (DesignerVerb verb in verbs) { // add new menu items to the context menu CreateAndAddLocalVerb(verb); } } } // we only show designer context menus for controls if (primarySelection is Control) { Control comp = primarySelection as Control; Point pt = comp.PointToScreen(new Point(0, 0)); contextMenu.Show(comp, new Point(x - pt.X, y - pt.Y)); } // keep the selected component for next time lastSelectedComponent = primarySelection; }
/// <summary> /// Searches for the given command ID and returns the MenuCommand /// associated with it. /// </summary> public MenuCommand FindCommand(CommandID commandID) { return(FindCommand(commandID.Guid, commandID.ID)); }
static StandardCommands() { Guid menuGroup = new Guid("5efc7975-14bc-11cf-9b2b-00aa00573819"); Guid menuGroup2 = new Guid("74d21313-2aee-11d1-8bfb-00a0c90f26f7"); StandardCommands.AlignBottom = new CommandID(menuGroup, 1); StandardCommands.AlignHorizontalCenters = new CommandID(menuGroup, 2); StandardCommands.AlignLeft = new CommandID(menuGroup, 3); StandardCommands.AlignRight = new CommandID(menuGroup, 4); StandardCommands.AlignToGrid = new CommandID(menuGroup, 5); StandardCommands.AlignTop = new CommandID(menuGroup, 6); StandardCommands.AlignVerticalCenters = new CommandID(menuGroup, 7); StandardCommands.ArrangeBottom = new CommandID(menuGroup, 8); StandardCommands.ArrangeIcons = new CommandID(menuGroup2, 12298); StandardCommands.ArrangeRight = new CommandID(menuGroup, 9); StandardCommands.BringForward = new CommandID(menuGroup, 10); StandardCommands.BringToFront = new CommandID(menuGroup, 11); StandardCommands.CenterHorizontally = new CommandID(menuGroup, 12); StandardCommands.CenterVertically = new CommandID(menuGroup, 13); StandardCommands.Copy = new CommandID(menuGroup, 15); StandardCommands.Cut = new CommandID(menuGroup, 16); StandardCommands.Delete = new CommandID(menuGroup, 17); StandardCommands.F1Help = new CommandID(menuGroup, 377); StandardCommands.Group = new CommandID(menuGroup, 20); StandardCommands.HorizSpaceConcatenate = new CommandID(menuGroup, 21); StandardCommands.HorizSpaceDecrease = new CommandID(menuGroup, 22); StandardCommands.HorizSpaceIncrease = new CommandID(menuGroup, 23); StandardCommands.HorizSpaceMakeEqual = new CommandID(menuGroup, 24); StandardCommands.LineupIcons = new CommandID(menuGroup2, 12299); StandardCommands.LockControls = new CommandID(menuGroup, 369); StandardCommands.MultiLevelRedo = new CommandID(menuGroup, 30); StandardCommands.MultiLevelUndo = new CommandID(menuGroup, 44); StandardCommands.Paste = new CommandID(menuGroup, 26); StandardCommands.Properties = new CommandID(menuGroup, 28); StandardCommands.PropertiesWindow = new CommandID(menuGroup, 235); StandardCommands.Redo = new CommandID(menuGroup, 29); StandardCommands.Replace = new CommandID(menuGroup, 230); StandardCommands.SelectAll = new CommandID(menuGroup, 31); StandardCommands.SendBackward = new CommandID(menuGroup, 32); StandardCommands.SendToBack = new CommandID(menuGroup, 33); StandardCommands.ShowGrid = new CommandID(menuGroup, 103); StandardCommands.ShowLargeIcons = new CommandID(menuGroup2, 12300); StandardCommands.SizeToControl = new CommandID(menuGroup, 35); StandardCommands.SizeToControlHeight = new CommandID(menuGroup, 36); StandardCommands.SizeToControlWidth = new CommandID(menuGroup, 37); StandardCommands.SizeToFit = new CommandID(menuGroup, 38); StandardCommands.SizeToGrid = new CommandID(menuGroup, 39); StandardCommands.SnapToGrid = new CommandID(menuGroup, 40); StandardCommands.TabOrder = new CommandID(menuGroup, 41); StandardCommands.Undo = new CommandID(menuGroup, 43); StandardCommands.Ungroup = new CommandID(menuGroup, 45); StandardCommands.VerbFirst = new CommandID(menuGroup2, 8192); StandardCommands.VerbLast = new CommandID(menuGroup2, 8448); StandardCommands.VertSpaceConcatenate = new CommandID(menuGroup, 46); StandardCommands.VertSpaceDecrease = new CommandID(menuGroup, 47); StandardCommands.VertSpaceIncrease = new CommandID(menuGroup, 48); StandardCommands.VertSpaceMakeEqual = new CommandID(menuGroup, 49); StandardCommands.ViewGrid = new CommandID(menuGroup, 125); StandardCommands.DocumentOutline = new CommandID(menuGroup, 239); StandardCommands.ViewCode = new CommandID(menuGroup, 333); }
public DesignerVerb(string text, EventHandler handler, CommandID startCommandID) : base(handler, startCommandID) { this.Properties["Text"] = (text == null) ? null : Regex.Replace(text, @"\(\&.\)", ""); }
public DesignerVerb(string text, EventHandler handler, CommandID startCommandID) : base(handler, startCommandID) { this.text = text; }
public bool PostExecCommand(System.ComponentModel.Design.CommandID command, object args) { return(PostExecCommand(command, args, CommandPrompt.DoDefault)); }
public CommandResult ExecCommand(System.ComponentModel.Design.CommandID command) { return(ExecCommand(command, true)); }
public CommandResult ExecCommand(System.ComponentModel.Design.CommandID command, bool verifyEnabled) { return(ExecCommand(command, verifyEnabled, null)); }
public CommandResult ExecCommand(System.ComponentModel.Design.CommandID command, bool verifyEnabled, object argument) { if (command == null) { throw new ArgumentNullException("command"); } // TODO: Assert that we are in the UI thread IOleCommandTarget dispatcher = CommandDispatcher; if (dispatcher == null) { return(new CommandResult(false)); } Guid g = command.Guid; if (verifyEnabled) { OLECMD[] cmd = new OLECMD[1]; cmd[0].cmdID = unchecked ((uint)command.ID); if (VSErr.S_OK != dispatcher.QueryStatus(ref g, 1, cmd, IntPtr.Zero)) { return(new CommandResult(false)); } OLECMDF flags = (OLECMDF)cmd[0].cmdf; if ((flags & OLECMDF.OLECMDF_SUPPORTED) == (OLECMDF)0) { return(new CommandResult(false)); // Not supported } if ((flags & OLECMDF.OLECMDF_ENABLED) == (OLECMDF)0) { return(new CommandResult(false)); // Not enabled } } IntPtr vIn = IntPtr.Zero; IntPtr vOut = IntPtr.Zero; try { vOut = Marshal.AllocCoTaskMem(128); NativeMethods.VariantInit(vOut); if (argument != null) { vIn = Marshal.AllocCoTaskMem(128); Marshal.GetNativeVariantForObject(argument, vIn); } bool ok = VSErr.Succeeded(dispatcher.Exec(ref g, unchecked ((uint)command.ID), (uint)OLECMDEXECOPT.OLECMDEXECOPT_DODEFAULT, IntPtr.Zero, IntPtr.Zero)); return(new CommandResult(ok, Marshal.GetObjectForNativeVariant(vOut))); } finally { if (vIn != IntPtr.Zero) { NativeMethods.VariantClear(vIn); Marshal.FreeCoTaskMem(vIn); } if (vOut != IntPtr.Zero) { NativeMethods.VariantClear(vOut); Marshal.FreeCoTaskMem(vOut); } } }
private const int SUPPORTED = 0x01; // tagOLECMDF.OLECMDF_SUPPORTED /// <summary> /// Initializes a new instance of <see cref='System.ComponentModel.Design.MenuCommand'/>. /// </summary> public MenuCommand(EventHandler handler, CommandID command) { _execHandler = handler; CommandID = command; _status = SUPPORTED | ENABLED; }
/// <summary> /// Locates the requested command. This will throw an appropriate /// ComFailException if the command couldn't be found. /// </summary> protected MenuCommand FindCommand(Guid guid, int id) { Debug.WriteLineIf(MENUSERVICE.TraceVerbose, "MCS Searching for command: " + guid.ToString() + " : " + id.ToString(CultureInfo.CurrentCulture)); // Search in the list of commands only if the command group is known ArrayList commands; lock (_commandGroupsLock) { _commandGroups.TryGetValue(guid, out commands); } if (commands != null) { Debug.WriteLineIf(MENUSERVICE.TraceVerbose, "\t...MCS Found group"); foreach (MenuCommand command in commands) { if (command.CommandID.ID == id) { Debug.WriteLineIf(MENUSERVICE.TraceVerbose, "\t... MCS Found Command"); return(command); } } } // Next, search the verb list as well. // EnsureVerbs(); if (_currentVerbs != null) { int currentID = StandardCommands.VerbFirst.ID; foreach (DesignerVerb verb in _currentVerbs) { CommandID cid = verb.CommandID; if (cid.ID == id) { Debug.WriteLineIf(MENUSERVICE.TraceVerbose, "\t...MCS Found verb"); if (cid.Guid.Equals(guid)) { Debug.WriteLineIf(MENUSERVICE.TraceVerbose, "\t...MCS Found group"); return(verb); } } // We assign virtual sequential IDs to verbs we get from the component. This allows users // to not worry about assigning these IDs themselves. // if (currentID == id) { Debug.WriteLineIf(MENUSERVICE.TraceVerbose, "\t...MCS Found verb"); if (cid.Guid.Equals(guid)) { Debug.WriteLineIf(MENUSERVICE.TraceVerbose, "\t...MCS Found group"); return(verb); } } if (cid.Equals(StandardCommands.VerbFirst)) { currentID++; } } } return(null); }
/// <summary> /// Shows the context menu with the given command ID at the given /// location. /// </summary> public virtual void ShowContextMenu(CommandID menuID, int x, int y) { }