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


C# ICommandService.RegisterMenu方法代码示例

本文整理汇总了C#中ICommandService.RegisterMenu方法的典型用法代码示例。如果您正苦于以下问题:C# ICommandService.RegisterMenu方法的具体用法?C# ICommandService.RegisterMenu怎么用?C# ICommandService.RegisterMenu使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ICommandService的用法示例。


在下文中一共展示了ICommandService.RegisterMenu方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SledTargetService

        public SledTargetService(
            MainForm mainForm,
            ICommandService commandService,
            ISettingsService settingsService)
        {
            m_mainForm = mainForm;

            // Create a new menu for target options
            var targetMenuInfo =
                commandService.RegisterMenu(
                    Menu.Target,
                    Localization.SledTargetMenuTitle,
                    Localization.SledTargetMenuTitleComment);

            commandService.RegisterCommand(
                Command.ShowDialog,
                Menu.Target,
                CommandGroup.Target,
                Localization.SledTargetMenuManageTargets,
                Localization.SledTargetMenuManageTargetsComment,
                Keys.Control | Keys.T,
                SledIcon.DebugManageTargets,
                CommandVisibility.All,
                this);

            m_remoteTargetComboBox = new ToolStripComboBox(Resources.Resource.RemoteTargets);
            m_remoteTargetComboBox.SelectedIndexChanged += RemoteTargetComboBoxSelectedIndexChanged;
            m_remoteTargetComboBox.IntegralHeight = true;
            m_remoteTargetComboBox.DropDownWidth += 100;
            if (m_remoteTargetComboBox.ComboBox != null)
            {
                var iWidth = m_remoteTargetComboBox.ComboBox.Width;
                m_remoteTargetComboBox.ComboBox.Width = iWidth + 100;
            }

            if (targetMenuInfo != null)
                targetMenuInfo.GetToolStrip().Items.Add(m_remoteTargetComboBox);

            settingsService.RegisterSettings(
                this,
                new BoundPropertyDescriptor(
                    this,
                    () => SledTargets,
                    "Sled Targets",
                    null,
                    null));
        }
开发者ID:arsaccol,项目名称:SLED,代码行数:47,代码来源:SledTargetService.cs

示例2: SledBreakpointService

        public SledBreakpointService(MainForm mainForm, ICommandService commandService)
        {
            m_mainForm = mainForm;

            var menuInfoContext =
                commandService.RegisterMenu(
                    Menu.Context,
                    "Breakpoint Context",
                    "Breakpoint Context Menu");

            commandService.RegisterCommand(
                Command.BreakpointAdd,
                Menu.Context,
                CommandGroup.Context,
                Localization.SledBreakpointMenuBreakpointAdd,
                Localization.SledBreakpointMenuBreakpointAddComment,
                this);

            commandService.RegisterCommand(
                Command.BreakpointRemove,
                Menu.Context,
                CommandGroup.Context,
                Localization.SledBreakpointMenuBreakpointRemove,
                Localization.SledBreakpointMenuBreakpointRemoveComment,
                this);

            commandService.RegisterCommand(
                Command.BreakpointEnable,
                Menu.Context,
                CommandGroup.Context,
                Localization.SledBreakpointMenuBreakpointEnable,
                Localization.SledBreakpointMenuBreakpointEnableComment,
                this);

            commandService.RegisterCommand(
                Command.BreakpointDisable,
                Menu.Context,
                CommandGroup.Context,
                Localization.SledBreakpointMenuBreakpointDisable,
                Localization.SledBreakpointMenuBreakpointDisableComment,
                this);

            commandService.RegisterCommand(
                Command.BreakpointCondition,
                Menu.Context,
                CommandGroup.Context,
                Localization.SledBreakpointMenuBreakpointCondition,
                Localization.SledBreakpointMenuBreakpointConditionComment,
                this);

            commandService.RegisterCommand(
                Command.BreakpointRemoveAll,
                Menu.Context,
                CommandGroup.Context,
                Localization.SledBreakpointMenuBreakpointRemoveAll,
                Localization.SledBreakpointMenuBreakpointRemoveAllComment,
                this);

            menuInfoContext.GetMenuItem().Visible = false;

            var menuInfoWindow =
                commandService.RegisterMenu(
                    Menu.Window,
                    "Breakpoint Window",
                    "Breakpoint Window Menu");

            commandService.RegisterCommand(
                Command.BreakpointWindowRemove,
                Menu.Window,
                CommandGroup.Window,
                Localization.BreakpointWindowRemove,
                Localization.BreakpointWindowRemoveComment,
                this);

            commandService.RegisterCommand(
                Command.BreakpointWindowEnable,
                Menu.Window,
                CommandGroup.Window,
                Localization.BreakpointWindowEnable,
                Localization.BreakpointWindowEnableComment,
                this);

            commandService.RegisterCommand(
                Command.BreakpointWindowDisable,
                Menu.Window,
                CommandGroup.Window,
                Localization.BreakpointWindowDisable,
                Localization.BreakpointWindowDisableComment,
                this);

            commandService.RegisterCommand(
                Command.BreakpointWindowCondition,
                Menu.Window,
                CommandGroup.Window,
                Localization.BreakpointWindowCondition,
                Localization.BreakpointWindowConditionComment,
                this);

            commandService.RegisterCommand(
                Command.BreakpointWindowConditionEnable,
//.........这里部分代码省略.........
开发者ID:arsaccol,项目名称:SLED,代码行数:101,代码来源:SledBreakpointService.cs

示例3: SledSourceControlService

        public SledSourceControlService(
            MainForm mainForm,
            ICommandService commandService,
            ISettingsService settingsService,
            IControlHostService controlHostService,
            ISledProjectService projectService,
            ISledDocumentService documentService,
            IContextRegistry contextRegistry)
        {
            m_mainForm = mainForm;
            m_projectService = projectService;
            m_documentService = documentService;
            m_contextRegistry = contextRegistry;

            // Associate values for commands the 'public' can use
            m_dictPublicCommands.Add(SledSourceControlCommand.Add, Command.Add);
            m_dictPublicCommands.Add(SledSourceControlCommand.CheckIn, Command.CheckIn);
            m_dictPublicCommands.Add(SledSourceControlCommand.CheckOut, Command.CheckOut);
            m_dictPublicCommands.Add(SledSourceControlCommand.Refresh, Command.Refresh);
            m_dictPublicCommands.Add(SledSourceControlCommand.Revert, Command.Revert);
            m_dictPublicCommands.Add(SledSourceControlCommand.History, Command.History);

            commandService.RegisterMenu(
                Menu.SourceControl,
                SourceControlText,
                "Source Control Menu");

            try
            {
                m_go = ResourceUtil.GetImageList16().Images[SledIcon.Go];
            }
            catch (Exception ex)
            {
                SledOutDevice.OutLine(
                    SledMessageType.Error,
                    "Exception acquiring \"{0}\" image: {1}",
                    SledIcon.Go, ex.Message);

                m_go = null;
            }

            try
            {
                m_stop = ResourceUtil.GetImageList16().Images[SledIcon.Stop];
            }
            catch (Exception ex)
            {
                SledOutDevice.OutLine(
                    SledMessageType.Error,
                    "Exception acquiring \"{0}\" image: {1}",
                    SledIcon.Stop, ex.Message);

                m_stop = null;
            }

            m_status =
                commandService.RegisterCommand(
                    Command.Enabled,
                    Menu.SourceControl,
                    Group.SourceControl,
                    "No source control plugin found!",
                    "Enable or disable using the source control plugin",
                    Keys.None,
                    SledIcon.Stop,
                    CommandVisibility.All,
                    this);

            commandService.RegisterCommand(
                Command.Add,
                Menu.SourceControl,
                Group.SourceControl,
                SourceControlCommandPrefix + "Add",
                "Add to source control",
                Keys.None,
                Atf.Resources.DocumentAddImage,
                CommandVisibility.All,
                this);

            commandService.RegisterCommand(
                Command.Revert,
                Menu.SourceControl,
                Group.SourceControl,
                SourceControlCommandPrefix + "Revert",
                "Revert add or check out from source control",
                Keys.None,
                Atf.Resources.DocumentRevertImage,
                CommandVisibility.All,
                this);

            commandService.RegisterCommand(
                Command.CheckIn,
                Menu.SourceControl,
                Group.SourceControl,
                SourceControlCommandPrefix + "Check In",
                "Check in to source control",
                Keys.None,
                Atf.Resources.DocumentLockImage,
                CommandVisibility.All,
                this);

//.........这里部分代码省略.........
开发者ID:arsaccol,项目名称:SLED,代码行数:101,代码来源:SledSourceControlService.cs

示例4: SledTtyService

        public SledTtyService(
            MainForm mainForm,
            ICommandService commandService,
            ISettingsService settingsService,
            IControlHostService controlHostService)
        {
            m_mainForm = mainForm;
            m_commandService = commandService;
            m_lastFlush = DateTime.Now;

            // Create GUI
            m_control =
                new SledTtyGui
                    {
                        Name = "TTY",
                        ColumnNames = new[] {"Time", "Data"}
                    };
            m_control.SendClicked += ControlSendClicked;

            // Register menu
            commandService.RegisterMenu(
                Menu.Tty,
                Localization.SledTTY,
                Localization.SledTTYOptions);

            // Register command to bring up TTY filters
            commandService.RegisterCommand(
                Command.Filter,
                Menu.Tty,
                CommandGroup.Tty,
                Localization.SledTTYFilterTTYOutput,
                Localization.SledTTYFilterTTYOutputComment,
                Keys.None,
                null,
                CommandVisibility.Menu,
                this);

            // Register clear TTY window command
            commandService.RegisterCommand(
                Command.Clear,
                Menu.Tty,
                CommandGroup.Tty,
                Localization.SledTTYClearTTYWindow,
                Localization.SledTTYClearTTYWindowComment,
                Keys.None,
                null,
                CommandVisibility.Menu,
                this);

            // Save the TTY filter list
            settingsService.RegisterSettings(
                this,
                new BoundPropertyDescriptor(
                    this,
                    () => TtyFilters,
                    Resources.Resource.TTYFilterListTitle,
                    Resources.Resource.TTY,
                    Resources.Resource.TTYFilterListComment));

            // Save GUI settings
            settingsService.RegisterSettings(
                this,
                new BoundPropertyDescriptor(
                    this,
                    () => GuiSettings,
                    "Tty GUI Settings",
                    Resources.Resource.TTY,
                    "Tty GUI settings"));
        }
开发者ID:arsaccol,项目名称:SLED,代码行数:69,代码来源:SledTTYService.cs


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