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

C# OLECMD类代码示例

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

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



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

示例1: QueryStatus

        public int QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
        {
            if (pguidCmdGroup.Equals(Constants.guidStandardCommandSet2K) && prgCmds[0].cmdID == (uint)VSConstants.VSStd2KCmdID.INCLUDEINPROJECT)
                prgCmds[0].cmdf = (uint)OLECMDF.OLECMDF_SUPPORTED | (uint)OLECMDF.OLECMDF_ENABLED;

            return VSConstants.S_OK;
        }
开发者ID:jijo-paulose,项目名称:bistro-framework,代码行数:7,代码来源:ExcludedNode.cs


示例2: QueryStatus

        public int QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
        {
            if (!MarkdownEditorPackage.Options.EnableHotKeys)
                return _nextCommandTarget.QueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText);

            if (pguidCmdGroup != _commandGroup)
                return _nextCommandTarget.QueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText);

            for (int i = 0; i < cCmds; i++)
            {
                if (_commandId == prgCmds[i].cmdID)
                {
                    if (!_view.Selection.IsEmpty)
                    {
                        prgCmds[i].cmdf = (uint)(OLECMDF.OLECMDF_ENABLED | OLECMDF.OLECMDF_SUPPORTED);
                    }
                    else
                    {
                        prgCmds[0].cmdf = (uint)OLECMDF.OLECMDF_SUPPORTED;
                    }

                    return VSConstants.S_OK;
                }
            }

            return _nextCommandTarget.QueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText);
        }
开发者ID:xoofx,项目名称:MarkdownEditor,代码行数:27,代码来源:BoldCommandTarget.cs


示例3:

		int IOleCommandTarget.QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
		{
			if (_nextTarget != null)
			{
				var result = _nextTarget.QueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText);
				if (result != (int)VSConstants.S_OK)
				{
					return result;
				}
			}

			for (uint i = 0; i < cCmds; ++i)
			{
				if (pguidCmdGroup == typeof(VSStd2KCmdID).GUID)
				{
					ICommandHandler handler;
					if (pguidCmdGroup == typeof(VSStd2KCmdID).GUID && _commandHandlers.TryGetValue((VSStd2KCmdID)prgCmds[i].cmdID, out handler))
					{
						if (_textView.TextBuffer.CheckEditAccess() && handler.IsEnabled(_textView))
						{
							prgCmds[i].cmdf = (uint)(OLECMDF.OLECMDF_SUPPORTED | OLECMDF.OLECMDF_ENABLED);
						}
						else
						{
							prgCmds[i].cmdf = (uint)OLECMDF.OLECMDF_SUPPORTED;
						}
					}
				}
			}

			return VSConstants.S_OK;
		}
开发者ID:modulexcite,项目名称:YamlDotNet.Editor,代码行数:32,代码来源:CommandHandlerDispatcher.cs


示例4: QueryStatus

            public int QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
            {
                if (commandFilter.QueryStatus(editorContext, pguidCmdGroup, prgCmds[0]))
                    return VSConstants.S_OK;

                return Next.QueryStatus(pguidCmdGroup, cCmds, prgCmds, pCmdText);
            }
开发者ID:rdumont,项目名称:SpecFlow,代码行数:7,代码来源:GherkinTextViewCreationListener.cs


示例5: QueryStatus

    public int QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
    {
      if (pguidCmdGroup == GUID_VSStandardCommandSet97)
      {
        switch ((VSStd97CmdID)prgCmds[0].cmdID)
        {
          case VSStd97CmdID.GotoRef:
          case VSStd97CmdID.GotoDefn:
            return (int)OLECMDF.OLECMDF_SUPPORTED | (int)OLECMDF.OLECMDF_ENABLED;
        }
      }
      else if (pguidCmdGroup == VSStd2K)
      {
        switch ((VSStd2KCmdID)prgCmds[0].cmdID)
        {
          case VSStd2KCmdID.AUTOCOMPLETE:
          case VSStd2KCmdID.SHOWMEMBERLIST:
          case VSStd2KCmdID.COMPLETEWORD: 
            prgCmds[0].cmdf = (uint)OLECMDF.OLECMDF_ENABLED | (int)OLECMDF.OLECMDF_SUPPORTED;
            return S_OK;
        }
      }

      return _nextTarget.QueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText);
    }
开发者ID:rsdn,项目名称:nitra,代码行数:25,代码来源:KeyBindingCommandFilter.cs


示例6:

        int IOleCommandTarget.QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
        {
            Debug.Assert(this.sqmCommandHandler != null, "SQM handler should not be null");

            // Delegate to SQM handler to see if the if commandIds are in SQM range. 
            int result = this.sqmCommandHandler.QueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText);

            Debug.Assert(result == (int)OLEConstants.OLECMDERR_E_NOTSUPPORTED ||
                result == VSConstants.S_OK, "Unexpected return value from the generated SQM target handler");

            if (!ErrorHandler.Succeeded(result))
            {
                // Otherwise delegate to the package's default implementation.
                IOleCommandTarget target = this.GetService(typeof(IOleCommandTarget)) as IOleCommandTarget;
                if (target != null)
                {
                    result = target.QueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText);
                }
                else
                {
                    result = VSConstants.OLE_E_ADVISENOTSUPPORTED;
                }
            }
            return result;
        }
开发者ID:SonarSource-VisualStudio,项目名称:sonarlint-visualstudio,代码行数:25,代码来源:SonarLintIntegrationPackage.IOleCommandTarget.cs


示例7: QueryStatus

        public int QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
        {
            var hr = (int)Constants.OLECMDERR_E_NOTSUPPORTED;
            
            // we want the VSConstants.VSStd97CmdID.NewWindow and the VSConstants.VSStd97CmdID.ViewCode to be handled by the 
            // WindowPane rather than the text editor host.
            if (pguidCmdGroup == VSConstants.GUID_VSStandardCommandSet97)
            {
                if (cCmds == 1 && (prgCmds[0].cmdID == (int)VSConstants.VSStd97CmdID.NewWindow ||
                                   prgCmds[0].cmdID == (int)VSConstants.VSStd97CmdID.ViewCode ||
                                   prgCmds[0].cmdID == (int)VSConstants.VSStd97CmdID.ViewForm))
                {
                    var oleCommandTarget = GetService(typeof(IOleCommandTarget)) as IOleCommandTarget;
                    if (oleCommandTarget != null)
                    {
                        return oleCommandTarget.QueryStatus(pguidCmdGroup, cCmds, prgCmds, pCmdText);
                    }
                }
            }

            if (OleCommandTarget != null)
            {
                hr = OleCommandTarget.QueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText);
            }
            return hr;
        }
开发者ID:abdelkarim,项目名称:PerspexVS,代码行数:26,代码来源:PerspexDesignerPane.IOleCommandTarget.cs


示例8: WrapQueryStatus

    public static int WrapQueryStatus(
      IOleCommandTarget receiver,
      IOleCommandTarget implementer,
      ref System.Guid pguidCmdGroup,
      uint cCmds,
      OLECMD[] prgCmds,
      System.IntPtr pCmdText) {
      Debug.Assert(receiver != null);

      var commandId = new CommandID(pguidCmdGroup, (int)prgCmds[0].cmdID);
      if (LogCommand(commandId)) {
        Logger.LogInfo("WrapQueryStatus: => recv={0}, impl={1}, parent={2}",
          receiver,
          GetImplementerString(implementer),
          GetParentTargetString(implementer));
      }

      var hr = (implementer == null)
        ? (int)Constants.OLECMDERR_E_NOTSUPPORTED
        : implementer.QueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText);

      if (LogCommand(commandId)) {
        Logger.LogInfo("WrapQueryStatus: <= recv={0}, impl={1}, parent={2}, hr={3}, cmdf={4}",
          receiver,
          GetImplementerString(implementer),
          GetParentTargetString(implementer),
          HrToString(hr),
          CmdFlagsToString(prgCmds));
      }
      return hr;
    }
开发者ID:mbbill,项目名称:vs-chromium,代码行数:31,代码来源:OleCommandTargetSpy.cs


示例9: QueryStatus

        public int QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
        {
            if (pguidCmdGroup == GuidList.guidLocalRefactorCmdSet &&
                (prgCmds[0].cmdID == PkgCmdIDList.cmdidExtractVariable || prgCmds[0].cmdID == PkgCmdIDList.cmdidExtractConstant))
            {
                if (codeManipulator.HasExpressionSelected)
                    prgCmds[0].cmdf = (uint)(OLECMDF.OLECMDF_ENABLED | OLECMDF.OLECMDF_SUPPORTED);
                else
                    prgCmds[0].cmdf = (uint)(OLECMDF.OLECMDF_SUPPORTED);

                return VSConstants.S_OK;
            }

            if (pguidCmdGroup == GuidList.guidLocalRefactorCmdSet &&
                (prgCmds[0].cmdID == PkgCmdIDList.cmdidAssignParameter || prgCmds[0].cmdID == PkgCmdIDList.cmdidConvertVariable))
            {
                if (codeManipulator.HasCode)
                    prgCmds[0].cmdf = (uint)(OLECMDF.OLECMDF_ENABLED | OLECMDF.OLECMDF_SUPPORTED);
                else
                    prgCmds[0].cmdf = (uint)(OLECMDF.OLECMDF_SUPPORTED);

                return VSConstants.S_OK;
            }

            return Next.QueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText);
        }
开发者ID:hotspot-developments,项目名称:LocalRefactor,代码行数:26,代码来源:CommandFilter.cs


示例10: QueryStatus

        public int QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
        {
            if (pguidCmdGroup == VSConstants.VSStd2K && prgCmds != null)
            {
                switch (prgCmds[0].cmdID)
                {
                    case (uint)VSConstants.VSStd2KCmdID.SHOWCONTEXTMENU:
                        {
                            prgCmds[0].cmdf = (uint)OLECMDF.OLECMDF_SUPPORTED | (uint)OLECMDF.OLECMDF_ENABLED;
                            return VSConstants.S_OK;
                        }
                    case (uint)VSConstants.VSStd2KCmdID.ECMD_LEFTCLICK:
                        {
                            prgCmds[0].cmdf = (uint)OLECMDF.OLECMDF_SUPPORTED | (uint)OLECMDF.OLECMDF_ENABLED;
                            return VSConstants.S_OK;
                        }
                    default:
                        {
                            return oldFilter.QueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText);
                        }
                }
            }

            else
            {
                return oldFilter.QueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText);
            }
        }
开发者ID:mmanela,项目名称:TextFormatPicker,代码行数:28,代码来源:CommandFilter.cs


示例11: QueryStatus

        public int QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
        {

            if (pguidCmdGroup != VsConstants.COMMANDS_GROUP_GLOBAL_GUID &&
                pguidCmdGroup != VsConstants.COMMANDS_GROUP_SOLUTION_GUID &&
                pguidCmdGroup != VsConstants.COMMANDS_GROUP_PROJECT_GUID)
                return OLECMDERR_E_UNKNOWNGROUP;
            if (cCmds < 1) return S_OK;


            var command = this[pguidCmdGroup, prgCmds[0].cmdID];

            if (command == null) return OLECMDERR_E_NOTSUPPORTED;

            var status = command.Status;
            if (status == UICommandState.Disabled)
                prgCmds[0].cmdf = 0u;
            else
                prgCmds[0].cmdf = (uint)OLECMDF.SUPPORTED;

            if (status == UICommandState.Enabled)
                prgCmds[0].cmdf |= (uint)OLECMDF.ENABLED;
            else if (status == UICommandState.Hidden)
                prgCmds[0].cmdf |= (uint)OLECMDF.INVISIBLE;


            return S_OK;
        }
开发者ID:modulexcite,项目名称:openwrap,代码行数:28,代码来源:VsCommandManager.cs


示例12: QueryStatus

      public int QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText) {
        var commandId = new CommandID(pguidCmdGroup, (int)prgCmds[0].cmdID);

        bool isSupported = false;
        try {
          isSupported = _owner._commandTarget.HandlesCommand(commandId);
        }
        catch (Exception e) {
          Logger.LogError(e, "Error in {0}.HandlesCommand.", _owner._commandTarget.GetType().FullName);
        }
        if (!isSupported) {
          if (_owner.NextCommandTarget == null) {
            return (int)Constants.OLECMDERR_E_NOTSUPPORTED;
          } else {
            return OleCommandTargetSpy.WrapQueryStatus(_owner, _owner.NextCommandTarget, ref pguidCmdGroup, cCmds, prgCmds, pCmdText);
          }
        }

        bool isEnabled = _owner._commandTarget.IsEnabled(commandId);

        prgCmds[0].cmdf = (uint)(OLECMDF.OLECMDF_SUPPORTED);
        if (isEnabled)
          prgCmds[0].cmdf |= (uint)(OLECMDF.OLECMDF_ENABLED);
        return VSConstants.S_OK;
      }
开发者ID:mbbill,项目名称:vs-chromium,代码行数:25,代码来源:OleCommandTarget.cs


示例13:

        int IOleCommandTarget.QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
        {
            if (_queryStatus != null && _cmdSet == pguidCmdGroup)
                for (int i = 0; i < prgCmds.Length; i++)
                    prgCmds[i].cmdf = _queryStatus((T)prgCmds[i].cmdID);

            return VSConstants.S_OK;
        }
开发者ID:vestild,项目名称:nemerle,代码行数:8,代码来源:NemerleSmartTagData.cs


示例14: OnQueryStatus

        protected override int OnQueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
        {
            // Using just as a means that indicates that the status was invalidated and it needs to be recalculate
            // in response to IVsUIShell.UpdateCommandUI which is triggered for the various UI context changes
            this.BindCommand.RequeryCanExecute();

            return base.OnQueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText);
        }
开发者ID:SonarSource-VisualStudio,项目名称:sonarlint-visualstudio,代码行数:8,代码来源:BindingController.cs


示例15: QueryStatus

        public int QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
        {
            if (this.NextCommandTarget != null)
            {
                return this.NextCommandTarget.QueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText);
            }

            return (int)OLEConstants.OLECMDERR_E_NOTSUPPORTED;
        }
开发者ID:jango2015,项目名称:VS-Macros,代码行数:9,代码来源:EditorCommandFilter.cs


示例16:

 int IOleCommandTarget.QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
 {
     if (pguidCmdGroup.Equals(Guids.guidProjectExtenderCmdSet) && prgCmds[0].cmdID == (uint)PkgCmdIDList.cmdidProjectExtender)
     {
         prgCmds[0].cmdf = (uint)OLECMDF.OLECMDF_SUPPORTED | (uint)OLECMDF.OLECMDF_INVISIBLE;
         return VSConstants.S_OK;
     }
     return innerTarget.QueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText);
 }
开发者ID:jijo-paulose,项目名称:bistro-framework,代码行数:9,代码来源:ProjectManager.cs


示例17:

 int IOleCommandTarget.QueryStatus(ref Guid guidGroup, uint nCmdId, OLECMD[] nCmdExcept, IntPtr pCmdText)
 {
     IOleCommandTarget oleCommandTarget = (IOleCommandTarget)this.GetService(typeof(IOleCommandTarget));
     if (oleCommandTarget != null)
     {
         return oleCommandTarget.QueryStatus(ref guidGroup, nCmdId, nCmdExcept, pCmdText);
     }
     return -2147221248;
 }
开发者ID:pgourlain,项目名称:CodeWeaver,代码行数:9,代码来源:CodeWeaverPackage.cs


示例18: QueryStatus

        public int QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
        {
            int hr = InternalQueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText);

            if (hr == OLECMDERR_E_NOTSUPPORTED) {
                hr = OldChain.QueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText);
            }

            return hr;
        }
开发者ID:grendello,项目名称:nuget,代码行数:10,代码来源:OleCommandFilter.cs


示例19: Status

        public CommandStatus Status(Guid group, int id) {
            OLECMD[] oleCmd = new OLECMD[1];

            oleCmd[0].cmdID = (uint)id;
            oleCmd[0].cmdf = 0;

            int oleStatus = OleTarget.QueryStatus(ref group, 1, oleCmd, IntPtr.Zero);

            return OleCommand.MakeCommandStatus(oleStatus, oleCmd[0].cmdf);
        }
开发者ID:Microsoft,项目名称:RTVS,代码行数:10,代码来源:OleToCommandTargetShim.cs


示例20: QueryStatus

        public int QueryStatus(ref Guid cmdGroup, uint cmdCount, OLECMD[] cmds, IntPtr cmdText)
        {
            if (cmdGroup != CommandGuid)
                return Next.QueryStatus(ref cmdGroup, cmdCount, cmds, cmdText);

            foreach (var cmd in cmds)
                cmds[0].cmdf = (uint)CanExecuteResult(cmd.cmdID);

            return VSConstants.S_OK;
        }
开发者ID:NicholasBuse,项目名称:codealignment,代码行数:10,代码来源:CommandFilter.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# OLECRINFO类代码示例发布时间:2022-05-24
下一篇:
C# OID类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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