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


C# OLECMD类代码示例

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


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


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