Is the DomainProjectPicker class deprecated in VSTS 2010?

What is an alternative to DomainProjectPicker if I want to select a server and its projects? I know about the new TeamProjectPicker class, but it doesn't help me. Does anyone know how to select a server from this type of dialogue?

Thanks TS.

+2


source to share


2 answers


As far as I can understand, it is more or less the same as DomainProjectPicker.

Here's a sample code how I worked with it:




    if (tpp.ShowDialog() == DialogResult.OK)
    {
         try
         {
              //here you get the TfsTeamProjectCollection (the TeamFoundationServer class is also obsolete)
              TfsTeamProjectCollection tfsProj = tpp.SelectedTeamProjectCollection;
              //here you authenticate
              tfsProj.Authenticate();
         }
etc...


      





+1


source


You can use the TeamProjectPicker class from Microsoft.TeamFoundation.Client.dll. There is a great blog post that describes how to play out a dialogue: Using the TeamProjectPicker API in TFS 2010

Here's some sample code to select multiple team projects:



Application.EnableVisualStyles(); // Makes it look nicer from a console app.

//"using" pattern is recommended as the picker needs to be disposed of
using (TeamProjectPicker tpp = new TeamProjectPicker(TeamProjectPickerMode.MultiProject, false))
{
    DialogResult result = tpp.ShowDialog();
    if (result == DialogResult.OK)
    {
        System.Console.WriteLine("Selected Team Project Collection Uri: " + tpp.SelectedTeamProjectCollection.Uri);
        System.Console.WriteLine("Selected Projects:");
        foreach(ProjectInfo projectInfo in tpp.SelectedProjects)
        {
            System.Console.WriteLine(projectInfo.Name);
        }
    }
}

      

If you don't care about the project and want the user to be able to select the server and collection, use TeamProjectPickerMode. NoProject in the constructor.

+1


source







All Articles