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


C# Commands.AddNamedCommand方法代码示例

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


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

示例1: CreateNavigationCommands

        void CreateNavigationCommands(Commands commands)
        {
            var previousCmd = commands.AddNamedCommand(
                m_addIn,
                "GotoPrevious",
                "goto previous location",
                "Goto the previous location in the current navigation list.",
                false,
                0,
                vsCommandDisabledFlagsValue:
                    (int) vsCommandStatus.vsCommandStatusEnabled 
                    | (int) vsCommandStatus.vsCommandStatusSupported
            );

            previousCmd.Bindings = "Global::Alt+Left Arrow";
            
            var nextCmd = commands.AddNamedCommand(
                m_addIn,
                "GotoNext",
                "goto next location",
                "Goto the next location in the current navigation list.",
                false,
                0,
                vsCommandDisabledFlagsValue:
                    (int) vsCommandStatus.vsCommandStatusEnabled 
                    | (int) vsCommandStatus.vsCommandStatusSupported
            );

            nextCmd.Bindings = "Global::Alt+Right Arrow";
        }
开发者ID:scottwis,项目名称:scottwis.visualstudio,代码行数:30,代码来源:VisualStudio.cs

示例2: CreateNamedCommand

        /// <summary>
        /// Creates a Named command.
        /// </summary>
        /// <param name="addInInstance">Addin Instance</param>
        /// <param name="cmdCollectionContainer">Collection of Command objects</param>
        /// <param name="strCtrlName">The control name</param>
        /// <param name="strCtrlCaption">The control caption</param>
        /// <param name="strCtrlToolTip">Text for tool tip</param>
        /// <param name="contextGUIDS"></param>
        /// <returns>Returns a newly create Command object or null if it fails</returns>
        protected Command CreateNamedCommand(AddIn addInInstance, Commands cmdCollectionContainer, string strCtrlName, string strCtrlCaption, string strCtrlToolTip, ref object[] contextGUIDS)
        {
            Command cmdRetVal = null;
            try
            {
                cmdRetVal = cmdCollectionContainer.AddNamedCommand(
                    addInInstance,
                    strCtrlName,
                    strCtrlCaption,
                    strCtrlToolTip,
                    true,
                    0,
                    ref contextGUIDS,
                    (int)vsCommandStatus.vsCommandStatusSupported + (int)vsCommandStatus.vsCommandStatusEnabled
                    );
            }
            catch (System.Exception exc)
            {
                Trace.WriteLine(String.Format("Exception caught in Adding Command1:\n {0}", exc.Message));
                Trace.WriteLine(String.Format("Number of commands:\n {0}", cmdCollectionContainer.Count));
            }

            return cmdRetVal;
        }
开发者ID:tgiphil,项目名称:wintools,代码行数:34,代码来源:Connect.cs

示例3: CreateNavigationModeCommands

        void CreateNavigationModeCommands(Commands commands)
        {
            foreach (var item in NavigationTargetList.Default.Values) {
                var cmd = commands.AddNamedCommand(
                    m_addIn,
                    string.Format("Navigate{0}", item.Name),
                    string.Format("Navigate {0}", item.Name),
                    string.Format("Change the navigation mode to '{0}'", item.Description),
                    false,
                    0,
                    vsCommandDisabledFlagsValue:
                        (int) vsCommandStatus.vsCommandStatusEnabled | (int) vsCommandStatus.vsCommandStatusSupported
                    );

                cmd.Bindings = new object[] {
                    string.Format("Global::ALT+N,ALT+{0}", item.Key),
                    string.Format("Global::ALT+N,{0}", item.Key)
                };
            }
        }
开发者ID:scottwis,项目名称:scottwis.visualstudio,代码行数:20,代码来源:VisualStudio.cs

示例4: CreateRegisterCommands

        void CreateRegisterCommands(Commands commands)
        {
            foreach (var item in EmacsRegisterList.Default.Values) {
                var copyCmdName = string.Format("CopyRegister{0}", item.Name);

                var copyCmd = commands.AddNamedCommand(
                    m_addIn,
                    copyCmdName,
                    string.Format("Copy Register {0}", item.Name),
                    string.Format("Copy Register {0}", item.Name),
                    false,
                    0,
                    vsCommandDisabledFlagsValue:
                        (int) vsCommandStatus.vsCommandStatusEnabled | (int) vsCommandStatus.vsCommandStatusSupported
                    );

                var pasteCmd = commands.AddNamedCommand(
                    m_addIn,
                    string.Format("PasteRegister{0}", item.Name),
                    string.Format("Paste Register {0}", item.Name),
                    string.Format("Paste Register {0}", item.Name),
                    false,
                    0,
                    vsCommandDisabledFlagsValue:
                        (int) vsCommandStatus.vsCommandStatusEnabled | (int) vsCommandStatus.vsCommandStatusSupported
                    );

                if (item.Key != null) {
                    copyCmd.Bindings = new object[] {
                        String.Format("Global::ALT+C, ALT+{0}", item.Key),
                        String.Format("Global::ALT+C, {0}", item.Key)
                    };

                    pasteCmd.Bindings = new object[] {
                        String.Format("Global::ALT+V, ALT+{0}", item.Key),
                        String.Format("Global::ALT+V, {0}", item.Key)
                    };
                }
            }
        }
开发者ID:scottwis,项目名称:scottwis.visualstudio,代码行数:40,代码来源:VisualStudio.cs


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