public G19BuildScreenAppletModel GetBuildInformation(IBuildServer buildServer, string buildDefinition, string teamProject)
        {
            G19BuildScreenAppletModel model = new G19BuildScreenAppletModel();

            if (buildServer != null)
            {
                IQueuedBuildSpec queed = buildServer.CreateBuildQueueSpec(teamProject, buildDefinition);

                IQueuedBuildQueryResult queryResult = buildServer.QueryQueuedBuilds(queed);

                IQueuedBuild queuedBuild = queryResult.QueuedBuilds.FirstOrDefault();
                if (queuedBuild == null)
                {
                    return null;
                }
                model.BuildDefinitionName = queuedBuild.Build.BuildDefinition.Name;

                switch (queuedBuild.Status)
                {
                    case QueueStatus.InProgress:
                        model.Status = queuedBuild.Status.ToString();
                        break;
                    case QueueStatus.Canceled:
                        model.Status = queuedBuild.Status.ToString();
                        break;
                    default:
                        model.Status = queuedBuild.Status.ToString();
                        break;
                }
                model.RequestedBy = queuedBuild.RequestedBy;
                model.TeamProjectName = queuedBuild.TeamProject;
                model.TimeRequested = queuedBuild.QueueTime;
            }
            return model;
        }
        public G19BuildScreenAppletModel GetBuildInformation(IBuildServer buildServer, string buildDefinition, string teamProject)
        {
            G19BuildScreenAppletModel model = new G19BuildScreenAppletModel();

            IBuildDefinition buildDetailSpec = buildServer.GetBuildDefinition(teamProject, buildDefinition);

            IBuildDetail build = buildServer.GetBuild(buildDetailSpec.LastBuildUri);

            switch (build.Status)
            {
                case BuildStatus.Succeeded:
                    model.Status = build.Status.ToString();
                    break;
                case BuildStatus.Failed:
                    model.Status = build.Status.ToString();
                    break;
                case BuildStatus.InProgress:
                    model.Status = build.Status.ToString();
                    break;
                case BuildStatus.PartiallySucceeded:
                    model.Status = build.Status.ToString();
                    break;
                case BuildStatus.Stopped:
                    model.Status = build.Status.ToString();
                    break;
                default:
                    break;
            }


            model.RequestedBy = build.RequestedBy;
            model.TeamProjectName = build.TeamProject;
            model.TimeRequested = build.StartTime;
            model.BuildDefinitionName = build.BuildDefinition.Name;
            model.BuildUri = build.Uri;
            return model;
        }