0
我正在编写一个扩展构建资源管理器的Visual Studio 2012加载项 - 基本上,我为每个构建(已完成或正在运行,但未排队)添加一个上下文菜单选项。在a blog post about doing this in VS2010之后,我设法为Builder资源管理器中出现的构建做好了准备 - 万岁!查找在团队资源管理器的“我的构建”
现在,我的上下文菜单也出现在团队资源管理器的Builds
页面,My Builds
部分。但是,当我收到回调时,我无法在任何地方找到实际的构建版本!
这里是我的beforeQueryStatus事件处理程序,在这里我试着找出我是否生成以显示或不:
private void OpenCompletedInBuildExplorerBeforeQueryStatus(object sender, EventArgs e)
{
var cmd = (OleMenuCommand)sender;
var vsTfBuild = (IVsTeamFoundationBuild)GetService(typeof(IVsTeamFoundationBuild));
// This finds builds in Build Explorer window
cmd.Enabled = (vsTfBuild.BuildExplorer.CompletedView.SelectedBuilds.Length == 1
&& vsTfBuild.BuildExplorer.QueuedView.SelectedBuilds.Length == 0); // No build _requests_ are selected
// This tries to find builds in Team Explorer's Builds page, My Builds section
var teamExplorer = (ITeamExplorer)GetService(typeof(ITeamExplorer));
var page = teamExplorer.CurrentPage as Microsoft.TeamFoundation.Controls.WPF.TeamExplorer.TeamExplorerPageBase;
var vm = page.ViewModel;
// does not compile: 'Microsoft.TeamFoundation.Build.Controls.BuildsPageViewModel' is inaccessible due to its protection level
var vm_private = vm as Microsoft.TeamFoundation.Build.Controls.BuildsPageViewModel;
// But debugger shows that if it did, my builds would be here:
var builds = vm_private.MyBuilds;
}
- 有没有办法让生成的列表?
- 更一般地说,有没有办法得到一些“这个上下文菜单所属的窗口”?目前,我只是随便看看在VS的部分我认为将有建立...