image47dd1de4

Good,

This is a post where I said not to forget the 10 lines of code needed to launch the form of selection of Team Project inVisual Studio 2010.

The following example uses the TeamProjectPicker class and shows a form of modal selection for the selection of a Team Project Collection:

 

   1: private static Uri SelectTeamProjectCollection()

 

   2: {

 

   3:     Uri uri = null;

 

   4:     var projectPicker = new TeamProjectPicker(TeamProjectPickerMode.NoProject, false)

 

   5:                             {

 

   6:                                 Text = "Selección de Team Projects",

 

   7:                                 AcceptButtonText = "Seleccionar"

 

   8:                             };

 

   9:

 

  10:     if (projectPicker.ShowDialog() == System.Windows.Forms.DialogResult.OK)

 

  11:         uri = projectPicker.SelectedTeamProjectCollection.Uri;

 

  12:     return uri;

 

  13: }

 

 

The resulting form is as follows, where we see that we can select items at the Team Project Collection:

image

 

If on the other hand we want to select a Team Project, the following function is an example:

   1: private static Uri SelectTeamProject()

 

   2: {

 

   3:     Uri uri = null;

 

   4:     var projectPicker = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false)

 

   5:     {

 

   6:         Text = "Selección de Team Project",

 

   7:         AcceptButtonText = "Seleccionar"

 

   8:     };

 

   9:

 

  10:     if (projectPicker.ShowDialog() == System.Windows.Forms.DialogResult.OK)

 

  11:         uri = projectPicker.SelectedTeamProjectCollection.Uri;

 

  12:     return uri;

 

  13: }

 

 

And when you run it, will show the following form:

image

 

The code source of the examples can be downloaded from

http://CID-bef06dffdb192125.Office.live.com/embedicon.aspx/code%20Samples/2011%2005%2031%20ElBruno.TfsTeamPicker.zip

Greetings @ Alicante

The Bruno

   

One response to “[VS2010] HowTo: Invoke the form of selection of Team Project from C#”

  1. […] [VS2010] HowTo: Invoke the form of selection of Team Project from C# […]

    Like

Leave a comment

Discover more from El Bruno

Subscribe now to keep reading and get access to the full archive.

Continue reading