private void LoadProjects()
        {
            var tempProjectList = new Projects();

            var allprojects = new List<Project>();
            try
            {
                allprojects = mClient.AllProjects();
            }
            catch (WebException exc)
            {
                
                //maybe user is not allowed to view projects
                //todo: error handling goes here
            }
            catch (Exception exc)
            {
                //todo: unable to load projects - do some good error handling here
                throw;
            }

            foreach (var projects in allprojects)
            {
                var project = new classes.Project(ProjectList)
                                  {
                                      Name = projects.Name,
                                      Href = projects.Href,
                                      Archived = projects.Archived,
                                      Id = projects.Id,
                                      Description = projects.Description,
                                      Error = false
                                  };
                foreach (BuildConfig buildConfigs in mClient.BuildConfigsByProjectName(project.Name))
                {
                    
                    var buildConfig = new BuildConfiguration {Name = buildConfigs.Name};
                    buildConfig.Description = buildConfig.Description;
                    buildConfig.WebUrl = buildConfigs.WebUrl;
                    buildConfig.Build = mClient.LastBuildByBuildConfigId(buildConfigs.Id);
                    buildConfig.ParentProject = project;

                    if ((buildConfig.Build.Status == "ERROR") || (buildConfig.Build.Status == "FAILURE"))
                    {
                        project.Error = true;
                    }
                    project.AddBuild(buildConfig);
                }
                tempProjectList.Add(project);
            }
            Dispatcher.BeginInvoke(new Action(() => SetProjects(tempProjectList)));
        }
Ejemplo n.º 2
0
 public void AddBuild(BuildConfiguration bc)
 {
     mConfigs.Add(bc);
 }