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:
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:
The code source of the examples can be downloaded from
Greetings @ Alicante
The Bruno


Leave a comment