:: thoughts on team system and more RSS 2.0
# Saturday, May 30, 2009

Ever wanted to use the TFS API to pull up a dialog to let a user browse the version control repository and select a file or a folder? Unfortunately it turns out there is no function to do so. Or atleast, no obvious way...

With pointers from Philip Kelley at Microsoft I learnt that inside the Microsoft.TeamFoundation.VersionControl.Controls assembly there's a private class called DialogChooseItem that displays the following dialog:

In order to use that dialog we'll have to invoke by using .NET reflection. The constructor can take either just the TFS to connect to (start at the root of the version control tree) or the folder and file to navigate to when the dialog is shown.

The key code to invoke the dialog is the following (based on Visual Studio 2008 SP1 and TFS 2008 SP1):

VersionControlServer versionControlServer = (VersionControlServer)tfs.GetService(typeof(VersionControlServer));
 Assembly controlsAssembly = Assembly.GetAssembly(typeof(Microsoft.TeamFoundation.VersionControl.Controls.ControlAddItemsExclude));
 Type vcChooseItemDialogType = controlsAssembly.GetType("Microsoft.TeamFoundation.VersionControl.Controls.DialogChooseItem");

ConstructorInfo ci = vcChooseItemDialogType.GetConstructor(
                   BindingFlags.Instance | BindingFlags.NonPublic,
                   null,
                   new Type[] { typeof(VersionControlServer) },
                   null);
_chooseItemDialog = (Form)ci.Invoke(new object[] { versionControlServer });
 
_chooseItemDialog.ShowDialog();
 this.DialogResult = _chooseItemDialog.DialogResult;

To get to the selected item access the SelectedItem property (again using .NET reflection):

_selectItemProperty = vcChooseItemDialogType.GetProperty("SelectedItem", BindingFlags.Instance | BindingFlags.NonPublic);
Item selectedItem = (Item)_selectItemProperty.GetValue(_chooseItemDialog, null);
selectedItem.ServerItem;

That's it. With some simple .NET reflection magic we can now use the internal item brower dialog.

The complete sample can be downloaded here: ItemBrowser.zip (15,63 KB)

Disclamer: the DialogChooseItem is an internal unsupported implementation. It may change at any time so if you use it your're on your own.

Saturday, May 30, 2009 10:24:33 AM (W. Europe Standard Time, UTC+01:00)  #    -
Team System
# Thursday, May 21, 2009

When browsing through the documentation for  Beta 1 on MSDN I found that there's also a nice training-kit available here.

The training-kit includes presentations, demos and labs on the following:

  • C# 4.0
  • Visual Basic 10
  • F#
  • Parallel Extensions
  • Windows Communication Foundation
  • Windows Workflow
  • Windows Presentation Foundation
  • ASP.NET 4
  • Entity Framework
  • ADO.NET Data Services
  • Managed Extensibility Framework
  • Visual Studio Team System

Unfortunately not so much content on VSTS, but still lots of other goodness... :-)

Thursday, May 21, 2009 12:15:20 PM (W. Europe Standard Time, UTC+01:00)  #    -
Team System | Visual Studio 2010

For Beta 1 of VSTS and TFS there's no local MSDN to install, instead the latest content can be found online at MSDN here.

There are plenty of new samples and walkthroughs to go through so it's well worth spending some time there to get into VS 2010.

Thursday, May 21, 2009 12:12:35 PM (W. Europe Standard Time, UTC+01:00)  #    -
Team System | Visual Studio 2010
# Monday, May 18, 2009

Soma posted earlier today that beta 1 of Visual Studio 2010 and .NET framework is available! It's going to be a great release for us working with VSTS!

So, time to explore the new bits. Here's some links I've found useful exploring the beta so far:

So, go get downloading! Beta 1 is now available on MSDN for subscribers.

Monday, May 18, 2009 5:37:05 PM (W. Europe Standard Time, UTC+01:00)  #    -
Team System | Visual Studio 2010
# Thursday, May 14, 2009

dotNetForum, a new .NET-community in Gothenburg, will have its first meeting May 26. The ambition is to have quarterly meetings on current subjects given by local developers.

At this first meeting Microsoft, with Johan Lindfors and Nils Stadling, will be there to present the latest on the Microsoft development platform, including .NET Services, Windows Azure and Silverlight 3.

I'm going to give a talk on what's new in VS 2010 and it's going to be a challenge to do that in 30 minutes...

Read more about the event here.

Thursday, May 14, 2009 7:42:56 PM (W. Europe Standard Time, UTC+01:00)  #    -
Team System | Visual Studio 2010
News
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2010
Mathias Olausson
Sign In
Statistics
Total Posts: 100
This Year: 0
This Month: 0
This Week: 0
Comments: 65
All Content © 2010, Mathias Olausson
DasBlog theme 'Business' created by Christoph De Baene (delarou)