当前位置: 首页>>代码示例>>C#>>正文


C# Design.CommandID类代码示例

本文整理汇总了C#中System.ComponentModel.Design.CommandID的典型用法代码示例。如果您正苦于以下问题:C# CommandID类的具体用法?C# CommandID怎么用?C# CommandID使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CommandID类属于System.ComponentModel.Design命名空间,在下文中一共展示了CommandID类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetupCommands

 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);
 }
开发者ID:LogoPhonix,项目名称:WebEssentials2012,代码行数:7,代码来源:SolutionColors.cs

示例2: SetupCommands

 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);
 }
开发者ID:kevinderudder,项目名称:WebEssentials2013,代码行数:7,代码来源:Diff.cs

示例3: IntegrationTestServiceCommands

        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);
            }

        }
开发者ID:RoryVL,项目名称:roslyn,代码行数:30,代码来源:IntegrationTestServiceCommands.cs

示例4: Initialize

        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);
                }
            }
        }
开发者ID:modulexcite,项目名称:VSScripts,代码行数:27,代码来源:VSScriptsPackage.cs

示例5: SetupCommands

 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);
 }
开发者ID:GProulx,项目名称:WebEssentials2013,代码行数:7,代码来源:Diff.cs

示例6: Initialize

        /// <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);
            }
        }
开发者ID:alkampfergit,项目名称:AlkampferVsix,代码行数:34,代码来源:AlkampferVsix2010Package.cs

示例7: Register

 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);
 }
开发者ID:vandro,项目名称:FileNesting,代码行数:7,代码来源:RunAutoNestingButton.cs

示例8: SpadeToolWindow

        /// <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();
        }
开发者ID:Mediomondo,项目名称:codemaid,代码行数:28,代码来源:SpadeToolWindow.cs

示例9: InitializeGlobalCommands

        /*
        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);
            }
        }
开发者ID:ichengzi,项目名称:SharpDevelop,代码行数:43,代码来源:MenuCommandService.cs

示例10: BaseCommand

        /// <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;
        }
开发者ID:adontz,项目名称:codemaid,代码行数:12,代码来源:BaseCommand.cs

示例11: CompilerOutputCmds

        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);
            }
        }
开发者ID:Trass3r,项目名称:DevUtils,代码行数:25,代码来源:CompilerOutputCmds.cs

示例12: Exec

        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;
        }
开发者ID:pvginkel,项目名称:VisualGit,代码行数:32,代码来源:VSCommandInstaller.cs

示例13: AddInheritDocCommand

		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;
					};
			}
		}
开发者ID:mmahulea,项目名称:FactonExtensionPackage,代码行数:32,代码来源:AddInheritDocCommand.cs

示例14: Initialize

        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);
            }
        }
开发者ID:Quodnon,项目名称:CRMDeveloperExtensions,代码行数:26,代码来源:WebResourceDeployerPackage.cs

示例15: Initialize

        /// <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);

            }
        }
开发者ID:pmchugh,项目名称:SpecFlow,代码行数:29,代码来源:SpecFlowPackage.cs


注:本文中的System.ComponentModel.Design.CommandID类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。