创建Visual Studio扩展时如何在“源代码管理历史记录"窗口中获取选定的项目? [英] How to get the selected items on Source Control History window when creating a Visual Studio Extension?

查看:146
本文介绍了创建Visual Studio扩展时如何在“源代码管理历史记录"窗口中获取选定的项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了 Visual Studio扩展.我在源代码控制历史记录"窗口的上下文菜单(具有变更集详细信息",比较"等的菜单)上附加了一个按钮

I develop a Visual Studio extension. I attached a button to the Source Control History Window's Context Menu (the menu with 'changeset details', 'compare', etc.. on it)

我需要从窗口中获取选定的历史记录项,但无法弄清楚该怎么做.

I need to get the selected History items from the window, but couldn't figure it out how to do it.

更新:

我正在使用Team Foundation Server作为源代码管理.这是我要访问的窗口的屏幕截图. 屏幕截图

I'm using team foundation server as source control. Here's the screenshot of the window i want to access to. Screenshot

我找到了一种检索窗口对象数据的方法,但仍然存在一些问题:

I have found a way to retrieve the window object's data, but i still have some issues:

package.FindToolWindow(typeof(/*I don't know the type of the window*/), 0, false);

(程序包是Microsoft.VisualStudio.Shell.Package类的实例)

源代码管理历史记录"窗口的类型是什么(屏幕截图中的一种)?这是我认为的难题的缺失部分.

What is the type of the Source Control History window (the one on the screenshot)? This is the missing part of the puzzle i think.

请帮助:) 谢谢.

推荐答案

也许这将对您的需求有所帮助: 工具窗口

Maybe this will be helpful for your needs: Tool Window

我不知道您的其他代码部分,但是我想您启动了一个窗口应用程序,您要在其中呈现历史记录列表. 该窗口应用程序需要:

I dont know your other code parts, but I guess you initiate a window application, where you want to render the history list. This window application needs:

private FirstToolWindow window;
private void ShowToolWindow(object sender, EventArgs e)  
{ 
     window = (FirstToolWindow) this.package.FindToolWindow(typeof(FirstToolWindow), 0, true); 
...

这篇关于创建Visual Studio扩展时如何在“源代码管理历史记录"窗口中获取选定的项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆