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

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 thought on “[VS2010] HowTo: Invoke the form of selection of Team Project from C#

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.