[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

   

[VS2010] HowTo: Invocar el formulario de seleccion de Team Project desde C#

image47dd1de4

Buenas,

este es un post donde me apunto para no olvidarme las 10 líneas de código que se necesitan para lanzar el formulario de selección de Team Project en Visual Studio 2010.

El siguiente ejemplo, utiliza la clase TeamProjectPicker y muestra un formulario de selección modal para la selección de una 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: }

 

El formulario resultante es el siguiente, donde vemos que podemos seleccionar elementos a nivel de Team Project Collection:

image

 

Si en cambio queremos seleccionar un Team Project, la siguiente función es el ejemplo:

   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: }

 

Y al ejecutar la misma, se nos mostrará el siguiente formulario:

image

 

El código fuente de los ejemplos se puede descargar desde

http://cid-bef06dffdb192125.office.live.com/embedicon.aspx/Code%20Samples/2011%2005%2031%20ElBruno.TfsTeamPicker.zip

Saludos @ Alicante

El Bruno