public void LoadProjectsAndBuilds(string teamCityServerUrl)
        {
            _teamCityAdapter.InitializeHttpClient(teamCityServerUrl);
            var projects    = _teamCityAdapter.GetAllProjects();
            var loadingNode = new TreeNode("loading...");

            treeViewTeamCityProjects.Nodes.Clear();
            treeViewTeamCityProjects.Nodes.AddRange(projects.Select(p => new TreeNode(p)
            {
                Name = p,
                Tag  = new Node {
                    IsProject = true, Loaded = false, Name = p
                }
            }).OrderBy(p => p.Name).ToArray());

            foreach (TreeNode node in treeViewTeamCityProjects.Nodes)
            {
                node.Nodes.Add((TreeNode)loadingNode.Clone());
            }

            if (!string.IsNullOrWhiteSpace(TeamCityProjectName))
            {
                foreach (TreeNode node in treeViewTeamCityProjects.Nodes)
                {
                    if (node.Name == TeamCityProjectName)
                    {
                        treeViewTeamCityProjects.SelectedNode = node;
                        node.Expand();
                        break;
                    }
                }
            }
        }
Example #2
0
        public void LoadProjects(string teamCityServerUrl)
        {
            _teamCityAdapter.InitializeHttpClient(teamCityServerUrl);
            var projects    = _teamCityAdapter.GetAllProjects();
            var loadingNode = new TreeNode("loading...");

            treeViewTeamCityProjects.Nodes.Clear();
            treeViewTeamCityProjects.Nodes.AddRange(projects.Select(p => new TreeNode(p)
            {
                Tag = new Node {
                    IsProject = true, Loaded = false, Name = p
                },
            }).ToArray());

            foreach (TreeNode node in treeViewTeamCityProjects.Nodes)
            {
                node.Nodes.Add((TreeNode)loadingNode.Clone());
            }
        }