public IList<BuildState> GetBuilds(string projectName)
        {
            IList<BuildState> builds = new List<BuildState>();

            Connect();

            var buildConfigs = client.BuildConfigsByProjectName(projectName.ToString());
            foreach (var config in buildConfigs)
            {
                var build = client.LastBuildByBuildConfigId(config.Id);
                var buildState = new BuildState()
                {
                    Name = config.Name,
                    BuildId = config.Id,
                    Status = "NOT BUILT"
                };

                if (build != null)
                {
                    buildState.LastBuild = build.Id;
                    buildState.Status = build.Status;
                }

                builds.Add(buildState);
            }

            return builds;
        }
 private void CheckBuildState(ProjectState project, BuildState oldBuildState, BuildState newBuildState)
 {
     if (oldBuildState.LastBuild != newBuildState.LastBuild)
     {
         if ((newBuildState.Status == "FAILURE" || newBuildState.Status == "ERROR")
             && oldBuildState.Status == "FAILURE" || oldBuildState.Status == "ERROR")
         {
             PlaySound(project.StillFailingSound);
         }
         else if (newBuildState.Status == "FAILURE" || newBuildState.Status == "ERROR")
         {
             PlaySound(project.FailureSound);
         }
         else if (newBuildState.Status == "SUCCESS" && oldBuildState.Status != "SUCCESS")
         {
             PlaySound(project.FixedSound);
         }
     }
 }