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

0

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

问题描述

限时送ChatGPT账号..

我开发了一个 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 扩展时如何获取源代码管理历史记录窗口中的选定项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

C# 中的多播委托奇怪行为?
Multicast delegate weird behavior in C#?(C# 中的多播委托奇怪行为?)...
2023-11-11 C#/.NET开发问题
6

参数计数与调用不匹配?
Parameter count mismatch with Invoke?(参数计数与调用不匹配?)...
2023-11-11 C#/.NET开发问题
26

如何将代表存储在列表中
How to store delegates in a List(如何将代表存储在列表中)...
2023-11-11 C#/.NET开发问题
6

代表如何工作(在后台)?
How delegates work (in the background)?(代表如何工作(在后台)?)...
2023-11-11 C#/.NET开发问题
5

没有 EndInvoke 的 C# 异步调用?
C# Asynchronous call without EndInvoke?(没有 EndInvoke 的 C# 异步调用?)...
2023-11-11 C#/.NET开发问题
2

Delegate.CreateDelegate() 和泛型:错误绑定到目标方法
Delegate.CreateDelegate() and generics: Error binding to target method(Delegate.CreateDelegate() 和泛型:错误绑定到目标方法)...
2023-11-11 C#/.NET开发问题
14