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的部分我認爲將有建立...