當前位置: 首頁>>代碼示例>>C#>>正文


C# Design.MenuCommand類代碼示例

本文整理匯總了C#中System.ComponentModel.Design.MenuCommand的典型用法代碼示例。如果您正苦於以下問題:C# MenuCommand類的具體用法?C# MenuCommand怎麽用?C# MenuCommand使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MenuCommand類屬於System.ComponentModel.Design命名空間,在下文中一共展示了MenuCommand類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: PoorMansTSqlFormatterCommand

        /// <summary>
        /// Initializes a new instance of the <see cref="PoorMansTSqlFormatterCommand"/> 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 PoorMansTSqlFormatterCommand(Package package)
        {
            if (package == null)
            {
                throw new ArgumentNullException("package");
            }

            this.package = package;

            OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
            if (commandService != null)
            {
                _applicationObject = Package.GetGlobalService(typeof(DTE)) as DTE;
                _formattingManager = PoorMansTSqlFormatterPluginShared.Utils.GetFormattingManager(Properties.Settings.Default);
                //Command cmd = _applicationObject.Commands.Item("Tools.FormatTSQLCode", -1);
                //cmd.Bindings = "Text Editor::Ctrl+Shift+D";

                var menuFormatCommandID = new CommandID(CommandSet, FormatCommandId);
                var menuFormatItem = new MenuCommand(this.MenuFormatCallback, menuFormatCommandID);
                commandService.AddCommand(menuFormatItem);

                var menuOptionsCommandID = new CommandID(CommandSet, OptionsCommandId);
                var menuOptionsItem = new MenuCommand(this.MenuOptionsCallback, menuOptionsCommandID);
                commandService.AddCommand(menuOptionsItem);

                _formatCommand = _applicationObject.Commands.Item("Tools.FormatTSQLCode", -1);
                SetFormatHotkey();

            }
        }
開發者ID:GetACookie,項目名稱:PoorMansTSqlFormatter,代碼行數:35,代碼來源:PoorMansTSqlFormatterCommand.cs

示例2: 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

示例3: Initialize

        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>();
        }
開發者ID:larsw,項目名稱:Git-Source-Control-Provider,代碼行數:26,代碼來源:PendingChangesToolWindow.cs

示例4: 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();

            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);
            }
        }
開發者ID:Mozketo,項目名稱:Suction,代碼行數:29,代碼來源:SuctionPackage.cs

示例5: 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

示例6: PendingChangesToolWindow

        public PendingChangesToolWindow()
            : base(null)
        {
            // set the window title
            this.Caption = Resources.ResourceManager.GetString("PendingChangesToolWindowCaption");

            //// set the CommandID for the window ToolBar
            this.ToolBar = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.imnuPendingChangesToolWindowToolbarMenu);

            // set the icon for the frame
            this.BitmapResourceID = CommandId.ibmpToolWindowsImages;  // bitmap strip resource ID
            this.BitmapIndex = CommandId.iconSccProviderToolWindow;   // index in the bitmap strip

            control = new PendingChangesView();

            // 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);
        }
開發者ID:cocytus,項目名稱:Git-Source-Control-Provider,代碼行數:30,代碼來源:PendingChangesToolWindow.cs

示例7: 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}", 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 xBuildMenuCommandID = new CommandID(GuidList.GuidMonoHelperCmdSet, (int)PkgCmdIDList.XBuildCommandID);
                MenuCommand xBuildMenuItem = new MenuCommand(XBuildMenuItemCallback, xBuildMenuCommandID);
                mcs.AddCommand(xBuildMenuItem);

                CommandID xRebuildMenuCommandID = new CommandID(GuidList.GuidMonoHelperCmdSet, (int)PkgCmdIDList.XRebuildCommandID);
                MenuCommand xRebuildMenuItem = new MenuCommand(XRebuildMenuItemCallback, xRebuildMenuCommandID);
                mcs.AddCommand(xRebuildMenuItem);

                CommandID startNetMenuCommandID = new CommandID(GuidList.GuidMonoHelperCmdSet, (int)PkgCmdIDList.StartNetCommandID);
                MenuCommand startNetMenuItem = new MenuCommand(StartNetMenuItemCallback, startNetMenuCommandID);
                mcs.AddCommand(startNetMenuItem);

                CommandID startMonoMenuCommandID = new CommandID(GuidList.GuidMonoHelperCmdSet, (int)PkgCmdIDList.StartMonoCommandID);
                MenuCommand startMonoMenuItem = new MenuCommand(StartMonoMenuItemCallback, startMonoMenuCommandID);
                mcs.AddCommand(startMonoMenuItem);

                CommandID debugNetMenuCommandID = new CommandID(GuidList.GuidMonoHelperCmdSet, (int)PkgCmdIDList.DebugNetCommandID);
                MenuCommand debugMenuNetItem = new MenuCommand(DebugNetMenuItemCallback, debugNetMenuCommandID);
                mcs.AddCommand(debugMenuNetItem);
            }
        }
開發者ID:benhysell,項目名稱:MonoHelper,代碼行數:36,代碼來源:MonoHelperPackage.cs

示例8: 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();

            // 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.guidReviewPal2010CmdSet, (int)PkgCmdIDList.cmdidReviewPal);
                MenuCommand menuItem = new MenuCommand(MenuItemCallback, menuCommandID );
                mcs.AddCommand( menuItem );
                // Create the command for the tool window
                CommandID toolwndCommandID = new CommandID(GuidList.guidReviewPal2010CmdSet, (int)PkgCmdIDList.cmdidReviewWindow);
                MenuCommand menuToolWin = new MenuCommand(ShowToolWindow, toolwndCommandID);
                mcs.AddCommand( menuToolWin );
            }

            VSIDEHelper.VisualStudioInstance = Package.GetGlobalService(typeof(DTE)) as DTE2;

            solutionEvents = VSIDEHelper.VisualStudioInstance.Events.SolutionEvents;
            solutionEvents.Opened += new _dispSolutionEvents_OpenedEventHandler(SolutionEvents_Opened);
            solutionEvents.BeforeClosing += new _dispSolutionEvents_BeforeClosingEventHandler(solutionEvents_BeforeClosing);

            ToolWindowPane window = this.FindToolWindow(typeof(ReviewToolWindow), 0, true);
            reviewWindow = (ReviewWindow)((ReviewToolWindow)window).Content;

            //initialize the Utility class
            Utils.Initialize();
        }
開發者ID:vendettamit,項目名稱:ReviewPal,代碼行數:35,代碼來源:ReviewPal2010Package.cs

示例9: Initialize

        protected override void Initialize()
        {
            base.Initialize();

            var mcs = GetService(typeof (IMenuCommandService)) as OleMenuCommandService;
            if (null != mcs)
            {
                var menuCommandID = new CommandID(GuidList.guidSSDTDevPack_VSPackageCmdSet,
                    (int) PkgCmdIDList.SSDTDevPackQuickDeploy);

                var menuItem = new MenuCommand(MenuItemCallback, menuCommandID);
                mcs.AddCommand(menuItem);

                var toolwndCommandID = new CommandID(GuidList.guidSSDTDevPack_VSPackageCmdSet,
                    (int) PkgCmdIDList.SSDTDevPackMergeUi);
                var menuToolWin = new MenuCommand(ShowMergeToolWindow, toolwndCommandID);
                mcs.AddCommand(menuToolWin);

                menuCommandID = new CommandID(GuidList.guidSSDTDevPack_VSPackageCmdSet,
                    (int) PkgCmdIDList.SSDTDevPackNameConstraints);
                menuItem = new MenuCommand(NameConstraintsCalled, menuCommandID);
                mcs.AddCommand(menuItem);

            }
        }
開發者ID:modulexcite,項目名稱:SSDT-DevPack,代碼行數:25,代碼來源:SSDTDevPack.VSPackagePackage.cs

示例10: 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 initialization code that rely on services provided by VisualStudio.
        /// </summary>
        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.guidDuplicateFileCmdSet, (int)PkgCmdIDList.cmdidDuplicateCmd);
                MenuCommand menuItem = new MenuCommand(MenuItemCallbackDuplicate, menuCommandID);
                mcs.AddCommand(menuItem);
            }

            // Add our command handlers for menu (commands must exist in the .vsct file)
            if (null != mcs)
            {
                // Create the command for the menu item.
                CommandID menuCommandID = new CommandID(GuidList.guidRefreshCmdSet, (int)PkgCmdIDList.cmdidRefreshCmd);
                MenuCommand menuItem = new MenuCommand(MenuItemCallbackRefresh, menuCommandID);
                mcs.AddCommand(menuItem);
            }

            // Override Edit.Delete command
            _applicationObject = (DTE)GetService(typeof(DTE));
            var command = _applicationObject.Commands.Item("Edit.Delete");
            _removeEvent = _applicationObject.Events.CommandEvents[command.Guid, command.ID];
            _removeEvent.BeforeExecute += OnBeforeDeleteCommand;
        }
開發者ID:modulexcite,項目名稱:MurlTools,代碼行數:34,代碼來源:MurlToolsPackage.cs

示例11: 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();

            //Create Editor Factory. Note that the base Package class will call Dispose on it.
            base.RegisterEditorFactory(new EditorFactory(this));

            // 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.guidVSPackage2CmdSet, (int)PkgCmdIDList.cmdidMyCommand);
                MenuCommand menuItem = new MenuCommand(MenuItemCallback, menuCommandID );
                mcs.AddCommand( menuItem );

                // Create project command
                CommandID projectMenuCmd = new CommandID(GuidList.guidVSPackage2CmdSet, (int)PkgCmdIDList.cmdidMyProjectCommand);
                MenuCommand menuProjCmd = new MenuCommand(MenuItemCallback, projectMenuCmd);
                mcs.AddCommand(menuProjCmd);

                // Create the command for the tool window
                CommandID toolwndCommandID = new CommandID(GuidList.guidVSPackage2CmdSet, (int)PkgCmdIDList.cmdidMyTool);
                MenuCommand menuToolWin = new MenuCommand(ShowToolWindow, toolwndCommandID);
                mcs.AddCommand( menuToolWin );
            }
        }
開發者ID:CloudMorph,項目名稱:CloudMorph,代碼行數:32,代碼來源:VSPackage2Package.cs

示例12: Initialize

        /// <summary>
        /// Called when the package is loaded, performs package initialization tasks such as registering the source control provider
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();

            // Proffer the source control service implemented by the provider
            sccService = new SccProviderService(this);
            ((IServiceContainer)this).AddService(typeof(SccProviderService), sccService, true);

            // Add our command handlers for menu (commands must exist in the .vsct file)
            MsVsShell.OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as MsVsShell.OleMenuCommandService;
            if (mcs != null)
            {
                CommandID cmd = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdSccCommand);
                MenuCommand menuCmd = new MenuCommand(new EventHandler(OnSccCommand), cmd);
                mcs.AddCommand(menuCmd);

                // ToolWindow Command
                cmd = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdViewToolWindow);
                menuCmd = new MenuCommand(new EventHandler(ViewToolWindow), cmd);
                mcs.AddCommand(menuCmd);

                // ToolWindow's ToolBar Command
                cmd = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdToolWindowToolbarCommand);
                menuCmd = new MenuCommand(new EventHandler(ToolWindowToolbarCommand), cmd);
                mcs.AddCommand(menuCmd);
            }

            // Register the provider with the source control manager
            // If the package is to become active, this will also callback on OnActiveStateChange and the menu commands will be enabled
            IVsRegisterScciProvider rscp = (IVsRegisterScciProvider)GetService(typeof(IVsRegisterScciProvider));
            rscp.RegisterSourceControlProvider(GuidList.guidSccProvider);
        }
開發者ID:Sunzhuokai,項目名稱:VSSDK-Extensibility-Samples,代碼行數:35,代碼來源:BasicSccProvider.cs

示例13: Initialize

        /////////////////////////////////////////////////////////////////////////////
        // Overriden 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 initilaization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {            
            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 menuCommandRunCoffeeScript = new CommandID(
                    GuidList.guidCoffeeScriptRunnerVSPackageCmdSet,
                    (int)PkgCmdIDList.cmdIdRunCoffeeScript
                );
                MenuCommand menuItem = new MenuCommand(
                    MenuItemCallback,
                    menuCommandRunCoffeeScript 
                );
                mcs.AddCommand( menuItem );

                CommandID menuCommandRunJavaScript = new CommandID(
                    GuidList.guidCoffeeScriptRunnerVSPackageCmdSet,
                    (int)PkgCmdIDList.cmdIdRunJavaScript
                );
                MenuCommand menuItem2 = new MenuCommand(
                    MenuItemCallback, 
                    menuCommandRunJavaScript 
                );
                mcs.AddCommand( menuItem2 );
            }
            base.dte = (EnvDTE80.DTE2)GetService(typeof(EnvDTE.DTE));
        }
開發者ID:Teme64,項目名稱:DynamicJavaScriptRunTimes.NET,代碼行數:39,代碼來源:CoffeeScriptRunnerVSPackagePackage.cs

示例14: ProcessOnStatusDeleteCommand

 /// <summary>
 /// Virtual method for processing the Delete menu status handler.
 /// </summary>
 /// <param name="command">Menu command called from the Visual Studio</param>
 protected override void ProcessOnStatusDeleteCommand(MenuCommand command)
 {
     if (command != null)
     {
         command.Visible = command.Enabled = CanDelete();
     }
 }
開發者ID:NuPattern,項目名稱:NuPattern,代碼行數:11,代碼來源:PatternModelCommandSet.cs

示例15: Initialize

        /// <summary>
        /// Hook up the context menu handlers.
        /// </summary>
        public void Initialize(IMenuCommandService menuCommandService)
        {
            if (menuCommandService != null)
            {
                _addMenuItem = AddCommandHandler(menuCommandService, ID.RoslynCommands.AddAnalyzer, AddAnalyzerHandler);
                _projectAddMenuItem = AddCommandHandler(menuCommandService, ID.RoslynCommands.ProjectAddAnalyzer, AddAnalyzerHandler);
                _projectContextAddMenuItem = AddCommandHandler(menuCommandService, ID.RoslynCommands.ProjectContextAddAnalyzer, AddAnalyzerHandler);
                _referencesContextAddMenuItem = AddCommandHandler(menuCommandService, ID.RoslynCommands.ReferencesContextAddAnalyzer, AddAnalyzerHandler);

                _removeMenuItem = AddCommandHandler(menuCommandService, ID.RoslynCommands.RemoveAnalyzer, RemoveAnalyzerHandler);

                _openRuleSetMenuItem = AddCommandHandler(menuCommandService, ID.RoslynCommands.OpenRuleSet, OpenRuleSetHandler);

                _setSeverityErrorMenuItem = AddCommandHandler(menuCommandService, ID.RoslynCommands.SetSeverityError, SetSeverityHandler);
                _setSeverityWarningMenuItem = AddCommandHandler(menuCommandService, ID.RoslynCommands.SetSeverityWarning, SetSeverityHandler);
                _setSeverityInfoMenuItem = AddCommandHandler(menuCommandService, ID.RoslynCommands.SetSeverityInfo, SetSeverityHandler);
                _setSeverityHiddenMenuItem = AddCommandHandler(menuCommandService, ID.RoslynCommands.SetSeverityHidden, SetSeverityHandler);
                _setSeverityNoneMenuItem = AddCommandHandler(menuCommandService, ID.RoslynCommands.SetSeverityNone, SetSeverityHandler);

                UpdateMenuItemVisibility();
                UpdateMenuItemsChecked();

                if (_tracker != null)
                {
                    _tracker.SelectedHierarchyChanged += SelectedHierarchyChangedHandler;
                    _tracker.SelectedDiagnosticItemsChanged += SelectedDiagnosticItemsChangedHandler;
                    _tracker.SelectedItemIdChanged += SelectedItemIdChangedHandler;
                }

                var buildManager = (IVsSolutionBuildManager)_serviceProvider.GetService(typeof(SVsSolutionBuildManager));
                uint cookie;
                buildManager.AdviseUpdateSolutionEvents(this, out cookie);
            }
        }
開發者ID:JinGuoGe,項目名稱:roslyn,代碼行數:37,代碼來源:AnalyzersCommandHandler.cs


注:本文中的System.ComponentModel.Design.MenuCommand類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。