使用TFS SDK显示项目历史记录窗口 [英] Show item history windows with TFS SDK

查看:58
本文介绍了使用TFS SDK显示项目历史记录窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个通过官方SDK与TFS集成的应用程序,以自动化并支持各种常见操作.尽管其中大多数是自动化的,并且TFS API几乎公开了我需要的所有内容,但是某些操作需要用户干预,因此我需要向用户显示信息.

I'm writing an app that integrates with TFS via the official SDKs to automate and support various common actions. Although most of it is automation and the TFS API exposes pretty much everything I need, some of the actions need user intervention so I need to display information to the user.

我发现了诸如 Difference.VisualDiffItems ,使我可以使用Visual Studio使用的相同UI轻松直观地比较文件.我还需要显示项目的历史记录(包括分支,重命名等),我希望使用内置的UI,而不必自己编写.商品历史记录用户界面实际上非常复杂,我以为MS会在SDK中提供它,但我似乎找不到它.

I've found methods such as Difference.VisualDiffItems that allow me to easily compare files visually using the same UI that Visual Studio uses. I also need to display an item's history (including branches, renames, etc.) and I would love to use a built-in UI instead of having to write my own. The item history UI is actually quite complex and I'd thought that MS would've provided it in the SDK, but I can't seem to find it.

任何人都可以确认TFS SDK没有提供必要的方法来可视化项目的历史记录,或者如果可以的话,将我指向正确的方向?

Can anyone confirm that the TFS SDK does not provide the necessary methods to visualize an item's history or point me in the right direction if it does?

推荐答案

在TF.exe实用程序上使用ILSpy,您可以看到用于查看历史记录的UI控件是 Microsoft.TeamFoundation.VersionControl.Controls.DialogHistory.此类是内部的,因此,除非您对使用反射感到满意,否则您将无法自己实例化此对象.

Using ILSpy on the TF.exe utility you can see that the UI control being used for viewing history is Microsoft.TeamFoundation.VersionControl.Controls.DialogHistory. This class is internal so unless you are happy with using reflection you won't be able to instantiate this object yourself.

实际上,搜索该类名称会显示此social.msdn页面: http://social.msdn.microsoft.com/Forums/ar/tfsversioncontrol/thread/9a10473e-d381-4e83-bde9-dd423f430feb

Actually, searching for that class name brought up this social.msdn page: http://social.msdn.microsoft.com/Forums/ar/tfsversioncontrol/thread/9a10473e-d381-4e83-bde9-dd423f430feb

与您的问题最相关的一行来自Buck Hodges:您确实可以选择通过反思来了解它们.由于它们不是公开的,因此我们可能会在发行版本之间更改它们(包括Service Pack),因此您可能会遭到破坏."

The one line that may be most relevant to your question is from Buck Hodges: "You do have the option to get to them through reflection. Since they aren't public, we may change them from release to release (including service packs), so you accept the risk of being broken"

另一种方法是直接通过命令行调用TF(直接引用TF.exe并在同一进程中加载​​它,或者通过使用所需的命令行启动新进程).无论哪种情况,您都可能需要处理将错误消息传递到stdout的情况,您可能希望也可能不希望它们出现.

The alternative would be to call TF with a command line directly (by referencing TF.exe directly and loading it in the same process OR by starting a new process with the command line required). In either case you will probably have to work with the error messages being delivered to stdout where you may or may not want them.

希望这会有所帮助.

这篇关于使用TFS SDK显示项目历史记录窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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