简体   繁体   English

创建Visual Studio扩展时如何在“源代码管理历史记录”窗口中获取选定的项目?

[英]How to get the selected items on Source Control History window when creating a Visual Studio Extension?

I develop a Visual Studio extension . 我开发了Visual Studio扩展 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. 我需要从窗口中获取选定的“历史记录”项目 ,但无法弄清楚该如何进行。

Update: 更新:

I'm using team foundation server as source control. 我正在使用Team Foundation Server作为源代码管理。 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);

(package is instance of Microsoft.VisualStudio.Shell.Package class) (程序包是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. 这是我认为的难题的缺失部分。

Please help :) Thanks. 请帮助:)谢谢。

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); 
...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 获取编辑器窗口的选定文本。视觉工作室扩展 - get the selected text of the editor window..visual studio extension 如何在 Visual Studio ErrorWindow 中获取所选项目? - How to get selected items in Visual Studio ErrorWindow? Visual Studio 2010扩展获取选定的文本 - Visual Studio 2010 extension get selected text 在 Visual Studio 中为 Visual Studio 扩展 (VSIX) 获取选定的选项卡 - Get the selected tabs in Visual studio for Visual studio extension (VSIX) 如何在Visual Studio扩展中获取所选的源文件? - How do I pick up the selected source file in a visual studio extension? 从Visual Studio扩展中找出ProjectItem的源控件状态 - Find out the source control state of a ProjectItem from a Visual Studio extension 获取用户从 Visual Studio 新项目窗口中选择模板类型时选择的模板名称 - Get name of template selected when user selected the template type from the visual studio new project window 如何从 Visual Studio 扩展显示弹出 window(不是工具窗口)? - How to display popup window (not tool window) from Visual Studio extension? 如何在checkboxlist控件中获取所选项目 - how to get the selected items in the checkboxlist control 在Visual Studio文本编辑器扩展中获取当前的源文件方法 - Get current source file methods in Visual Studio Text Editor Extension
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM