I'm working on a Visual Studio 2010 add-in, and I'm trying to figure out how to determine the currently connected TFS server. I'm guessing I need to use DTE, but I'm having a brain cramp figuring out where to get the info.
Any help is, of course, appreciated.
EDIT:
Actually, I may have found the answer, which I culled from a couple places.
var dte = Package.GetGlobalService(typeof(EnvDTE.DTE)) as EnvDTE.DTE;
TeamFoundationServerExt ext = dte.GetObject("Microsoft.VisualStudio.TeamFoundation.TeamFoundationServerExt") as TeamFoundationServerExt;
TeamFoundationServer tfs = new TeamFoundationServer(ext.ActiveProjectContext.DomainUri);
VersionControlServer vcs = tfs.GetService<VersionControlServer>();
var changes = vcs.GetPendingChanges(null);
I still need to clean this up a little, but it seems to work ok.