Ejemplo n.º 1
0
        private void InitTfsWorkspace()
        {
            tfsCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(RegisteredTfsConnections.GetProjectCollections().Single());
            versionControlServer = tfsCollection.GetService<VersionControlServer>();

            userName = tfsCollection.AuthorizedIdentity.UniqueName;

            workspace = versionControlServer.QueryWorkspaces(null, null, System.Environment.MachineName).Single();
            workingFolders = workspace.Folders.Where(f => !f.IsCloaked).ToList();

            tfsProjects = new List<TeamProject>();
            folderByProject = new Dictionary<TeamProject, WorkingFolder>();
            foreach (var folder in workingFolders)
            {
                var project = workspace.GetTeamProjectForLocalPath(folder.LocalItem);
                if (!folderByProject.ContainsKey(project))
                {
                    tfsProjects.Add(project);
                    folderByProject.Add(project, folder);
                }
            }

            ProjectsCombo.ItemsSource = tfsProjects;
            allBranches = versionControlServer.QueryRootBranchObjects(RecursionType.Full);
        }