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

戏子无情 提交于 2020-01-02 19:30:22

问题


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.

Update:

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

(package is instance of Microsoft.VisualStudio.Shell.Package class)

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.


回答1:


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


来源:https://stackoverflow.com/questions/48061180/how-to-get-the-selected-items-on-source-control-history-window-when-creating-a-v

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!