visual studio 2012 - Finding builds in Team Explorer's "My Builds" -


i'm writing visual studio 2012 add-in extends build explorer - basically, add context menu option every build (completed or running, not queued). following a blog post doing in vs2010, managed builds appear in builder explorer - hooray!

now, context menu appear in team explorer's builds pages, my builds section. however, when callback, can't find actual builds anywhere!

here's beforequerystatus event handler, try find out whether have build show or not:

private void opencompletedinbuildexplorerbeforequerystatus(object sender, eventargs e) {     var cmd = (olemenucommand)sender;     var vstfbuild = (ivsteamfoundationbuild)getservice(typeof(ivsteamfoundationbuild));      // finds builds in build explorer window     cmd.enabled = (vstfbuild.buildexplorer.completedview.selectedbuilds.length == 1                 && vstfbuild.buildexplorer.queuedview.selectedbuilds.length == 0); // no build _requests_ selected      // tries find builds in team explorer's builds page, builds section     var teamexplorer = (iteamexplorer)getservice(typeof(iteamexplorer));     var page = teamexplorer.currentpage microsoft.teamfoundation.controls.wpf.teamexplorer.teamexplorerpagebase;       var vm = page.viewmodel;     // not compile: 'microsoft.teamfoundation.build.controls.buildspageviewmodel' inaccessible due protection level     var vm_private = vm microsoft.teamfoundation.build.controls.buildspageviewmodel;     // debugger shows if did, builds here:     var builds = vm_private.mybuilds; } 
  1. is there way list of builds?
  2. more generally, there way "window context menu belong to"? i'm looking around in parts of vs assume have builds...

i managed build using reflection:

var teamexplorer = (iteamexplorer)getservice(typeof(iteamexplorer));  var buildspage = teamexplorer.currentpage microsoft.teamfoundation.controls.wpf.teamexplorer.teamexplorerpagebase; var pageviewmodel = buildspage.viewmodel microsoft.teamfoundation.controls.wpf.teamexplorer.teamexplorerpageviewmodelbase;     // pageviewmodel microsoft.teamfoundation.build.controls.buildspageviewmodel. but, it's private, selectedbuilds through reflection var selectedbuilds = pageviewmodel.gettype().getproperty("selectedbuilds").getvalue(pageviewmodel) system.collections.ilist; if (selectedbuilds.count != 1) {     cmd.enabled = false;     return; }  object buildmodel = selectedbuilds[0];     // buildmodel microsoft.teamfoundation.build.controls.buildmodel. but, it's private, uritoopen through reflection var builduri = buildmodel.gettype().getproperty("uritoopen").getvalue(buildmodel) uri; // todo: use builduri...  cmd.enabled = true; 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -