问题描述
我开发了一个 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.
更新:
我正在使用团队基础服务器作为源代码控制.这是我要访问的窗口的屏幕截图.截图
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 扩展时如何获取源代码管理历史记录窗口中的选定项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!