C# 团队资源管理器的全球服务';s查询结果窗口

C# 团队资源管理器的全球服务';s查询结果窗口,c#,tfs,C#,Tfs,“查询结果”窗口的全局服务(接口)是什么?代码如下: var dteService = Package.GetGlobalService(typeof(EnvDTE.DTE)) as EnvDTE.DTE; if (dteService == null) { Debug.WriteLine(""); return; } var something=Package.GetGlobalService(typeof(???)) as ???; 编辑:目标是,当我按下上下文菜单按钮时,我

“查询结果”窗口的全局服务(接口)是什么?代码如下:

var dteService = Package.GetGlobalService(typeof(EnvDTE.DTE)) as EnvDTE.DTE;
if (dteService == null)
{
   Debug.WriteLine("");
   return;
}

var something=Package.GetGlobalService(typeof(???)) as ???;
编辑:目标是,当我按下上下文菜单按钮时,我希望函数回调能够访问选中工作项的服务(或结果列表)


请在MSDN论坛中查看此案例,了解如何使其工作的详细信息:

以下代码引用自上述链接,供您快速参考:

Document activeDocument = _applicationObject.ActiveDocument;
        if (activeDocument != null)
        {
            DocumentService globalService = (DocumentService)Package.GetGlobalService(typeof(DocumentService));
            if (globalService != null)
            {
                string fullName = activeDocument.FullName;
                IWorkItemTrackingDocument document2 = globalService.FindDocument(fullName, null);
                if ((document2 != null) && (document2 is IResultsDocument))
                {
                    int[] selectedItemIds = ((IResultsDocument)document2).SelectedItemIds;
                }
            }
        }
Document activeDocument = _applicationObject.ActiveDocument;
        if (activeDocument != null)
        {
            DocumentService globalService = (DocumentService)Package.GetGlobalService(typeof(DocumentService));
            if (globalService != null)
            {
                string fullName = activeDocument.FullName;
                IWorkItemTrackingDocument document2 = globalService.FindDocument(fullName, null);
                if ((document2 != null) && (document2 is IResultsDocument))
                {
                    int[] selectedItemIds = ((IResultsDocument)document2).SelectedItemIds;
                }
            }
        }