• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Design.CommandID类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: SetupCommands

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


示例17: AliaserCommand

        /// <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);
            }
        }
开发者ID:jiriKuba,项目名称:Aliaser,代码行数:31,代码来源:AliaserCommand.cs


示例18: Initialize

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


示例19: Register

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


示例20: Initialize

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Design.ComponentChangedEventArgs类代码示例发布时间:2022-05-26
下一篇:
C# DataAnnotations.ValidationResult类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap