public void AcknowledgeStatus(Project project, BuildStatus currentStatus)
 {
     lock (acknowledgedStatusByProject)
     {
         acknowledgedStatusByProject[project] = currentStatus;
     }
     UpdateNotifier();
 }
 private bool TreatAsFailure(BuildStatus status)
 {
     return status.Value == BuildStatusEnum.Failed
         || status.Value == BuildStatusEnum.Unstable;
 }
Beispiel #3
0
        private void LoadIcon(BuildStatusEnum statusValue, bool isInProgress, bool isStuck)
        {
            BuildStatus status = new BuildStatus(statusValue, isInProgress, isStuck);
            if (iconsByKey.ContainsKey(status.Key))
                return;

            try
            {
                string resourceName = string.Format("Hudson.TrayTracker.Resources.StatusIcons.{0}.gif", status.Key);
                Image img = ResourceImageHelper.CreateImageFromResources(resourceName, GetType().Assembly);
                byte[] imgBytes = DevExpress.XtraEditors.Controls.ByteImageConverter.ToByteArray(img, ImageFormat.Gif);
                iconsByKey.Add(status.Key, imgBytes);
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(HudsonTrayTrackerResources.FailedLoadingIcons_Text,
                    HudsonTrayTrackerResources.FailedLoadingIcons_Caption,
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                LoggingHelper.LogError(logger, ex);
                throw new Exception("Failed loading icon: " + status, ex);
            }
        }
        private void LoadIcon(BuildStatusEnum statusValue, bool isInProgress, bool isStuck)
        {
            BuildStatus status = new BuildStatus(statusValue, isInProgress, isStuck);
            if (iconsByKey.ContainsKey(status.Key))
                return;

            try
            {
                string resourceName = string.Format("Hudson.TrayTracker.Resources.TrayIcons.{0}.ico", status.Key);
                Icon icon = ResourceImageHelper.CreateIconFromResources(resourceName, GetType().Assembly);
                iconsByKey.Add(status.Key, icon);
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(HudsonTrayTrackerResources.FailedLoadingIcons_Text,
                    HudsonTrayTrackerResources.FailedLoadingIcons_Caption,
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                LoggingHelper.LogError(logger, ex);
                throw new Exception("Failed loading icon: " + statusValue, ex);
            }
        }
        private void UpdateIcon(BuildStatus buildStatus)
        {
            Icon icon = iconsByKey[buildStatus.Key];
            notifyIcon.Icon = icon;

            // update the main window's icon
            if (ConfigurationService.GeneralSettings.UpdateMainWindowIcon)
                MainForm.Instance.UpdateIcon(icon);
        }
        private void DoUpdateNotifier()
        {
            BuildStatusEnum? worstBuildStatus = null;
            bool buildInProgress = false;
            bool buildIsStuck = false;
            var errorProjects = new HashedSet<Project>();
            var regressingProjects = new HashedSet<Project>();
            bool credentialsRefreshNeeded = false;

            foreach (Server server in ConfigurationService.Servers)
            {
                if (BadCredentialsHandler.ServersWithFailedAuthorization.Contains(server))
                {
                    break;
                }

                foreach (Project project in server.Projects)
                {
                    BuildStatus status = GetProjectStatus(project);
                    if (worstBuildStatus == null || status.Value > worstBuildStatus)
                        worstBuildStatus = status.Value;
                    if (status.Value >= BuildStatusEnum.Failed)
                        errorProjects.Add(project);
                    if (status.IsInProgress)
                        buildInProgress = true;
                    if (status.IsStuck)
                        buildIsStuck = true;
                    if (IsRegressing(project))
                        regressingProjects.Add(project);
                    lastProjectsBuildDetails[project] = project.AllBuildDetails;
                }
            }

            if (worstBuildStatus == null)
                worstBuildStatus = BuildStatusEnum.Unknown;

            #if false // tests
            lastBuildStatus++;
            if (lastBuildStatus > BuildStatus.Failed_BuildInProgress)
                lastBuildStatus = 0;
            worstBuildStatus = lastBuildStatus;
            Console.WriteLine("tray:"+lastBuildStatus);
            #endif

            BuildStatus buildStatus = new BuildStatus(worstBuildStatus.Value, buildInProgress, buildIsStuck);

            UpdateIcon(buildStatus);
            UpdateBalloonTip(errorProjects, regressingProjects);

            lastBuildStatus = buildStatus;
        }
Beispiel #7
0
        private void DoUpdateNotifier()
        {
            BuildStatusEnum? worstBuildStatus = null;
            bool buildInProgress = false;
            bool buildIsStuck = false;
            var errorProjects = new HashedSet<Project>();
            var regressingProjects = new HashedSet<Project>();
            var progressingAndErrorProjects = new HashedSet<Project>();
            var interestingProjects = new HashedSet<Project>();

            foreach (Server server in ConfigurationService.Servers)
            {
                foreach (Project project in server.Projects)
                {
                    BuildStatus status = GetProjectStatus(project);
                    if (worstBuildStatus == null || status.Value > worstBuildStatus)
                        worstBuildStatus = status.Value;
                    if (status.Value >= BuildStatusEnum.Failed)
                        errorProjects.Add(project);
                    if (status.Value > BuildStatusEnum.Successful)
                        progressingAndErrorProjects.Add(project);
                    if (status.IsInProgress)
                    {
                        buildInProgress = true;
                        progressingAndErrorProjects.Add(project);
                    }
                    if (status.IsStuck)
                        buildIsStuck = true;
                    if (IsRegressing(project))
                        regressingProjects.Add(project);
                    lastProjectsBuildDetails[project] = project.AllBuildDetails;

                    if (project.Activity.HasBuildActivity)
                    {
                        interestingProjects.Add(project);
                    }
                }
            }

            if (worstBuildStatus == null)
                worstBuildStatus = BuildStatusEnum.Unknown;

            #if false // tests
            lastBuildStatus++;
            if (lastBuildStatus > BuildStatus.Failed_BuildInProgress)
                lastBuildStatus = 0;
            worstBuildStatus = lastBuildStatus;
            Console.WriteLine("tray:"+lastBuildStatus);
            #endif

            BuildStatus buildStatus = new BuildStatus(worstBuildStatus.Value, buildInProgress, buildIsStuck);

            UpdateIcon(buildStatus);
            UpdateBalloonTip(errorProjects, regressingProjects);
            UpdateTrayTooltip(progressingAndErrorProjects);
            ShowBallowTip(interestingProjects);

            lastBuildStatus = buildStatus;
        }
 public static bool IsErrorBuild(BuildStatus status)
 {
     return IsErrorBuild(status.Value);
 }
 public static BuildStatus DegradeStatus(BuildStatus status)
 {
     return new BuildStatus(status.Value, false, status.IsStuck);
 }
 public static bool IsWorse(BuildStatus status, BuildStatus thanStatus)
 {
     bool res = status.Value > thanStatus.Value;
     return res;
 }