Ejemplo n.º 1
0
        public static void BuildStatusMessageCellPainting(DataGridViewCellPaintingEventArgs e, GitRevision revision, Color foreColor, Font rowFont)
        {
            if (revision.BuildStatus != null)
            {
                var buildStatusForeColor = foreColor;

                switch (revision.BuildStatus.Status)
                {
                case BuildInfo.BuildStatus.Success:
                    buildStatusForeColor = Color.DarkGreen;
                    break;

                case BuildInfo.BuildStatus.Failure:
                    buildStatusForeColor = Color.DarkRed;
                    break;

                case BuildInfo.BuildStatus.InProgress:
                    buildStatusForeColor = Color.Blue;
                    break;

                case BuildInfo.BuildStatus.Unstable:
                    buildStatusForeColor = Color.OrangeRed;
                    break;

                case BuildInfo.BuildStatus.Stopped:
                    buildStatusForeColor = Color.Gray;
                    break;
                }

                var text = (string)e.FormattedValue;
                var rect = RevisionGridUtils.GetCellRectangle(e);
                RevisionGridUtils.DrawColumnText(e.Graphics, text, rowFont, buildStatusForeColor, rect);
            }
        }
        public static void BuildStatusMessageCellPainting(DataGridViewCellPaintingEventArgs e, GitRevision revision, Color foreColor, Font rowFont, bool isSelected)
        {
            if (revision.BuildStatus == null)
            {
                return;
            }

            var color = GetColor();
            var text  = (string)e.FormattedValue;
            var rect  = RevisionGridUtils.GetCellRectangle(e);

            RevisionGridUtils.DrawColumnText(e.Graphics, text, rowFont, color, rect);

            Color GetColor()
            {
                switch (revision.BuildStatus.Status)
                {
                case BuildInfo.BuildStatus.Success:
                    return(isSelected ? Color.LightGreen : Color.DarkGreen);

                case BuildInfo.BuildStatus.Failure:
                    return(isSelected ? Color.Red : Color.DarkRed);

                case BuildInfo.BuildStatus.InProgress:
                    return(isSelected ? Color.LightBlue : Color.Blue);

                case BuildInfo.BuildStatus.Unstable:
                    return(Color.OrangeRed);

                case BuildInfo.BuildStatus.Stopped:
                    return(isSelected ? Color.LightGray : Color.Gray);

                case BuildInfo.BuildStatus.Unknown:
                    return(foreColor);

                default:
                    throw new InvalidOperationException("Unsupported build status enum value.");
                }
            }
        }
Ejemplo n.º 3
0
        public static void BuildStatusMessageCellPainting(DataGridViewCellPaintingEventArgs e, GitRevision revision, Color foreColor, Font rowFont)
        {
            if (revision.BuildStatus == null)
            {
                return;
            }

            var color = GetColor();
            var text  = (string)e.FormattedValue;
            var rect  = RevisionGridUtils.GetCellRectangle(e);

            RevisionGridUtils.DrawColumnText(e.Graphics, text, rowFont, color, rect);

            Color GetColor()
            {
                switch (revision.BuildStatus.Status)
                {
                case BuildInfo.BuildStatus.Success:
                    return(Color.DarkGreen);

                case BuildInfo.BuildStatus.Failure:
                    return(Color.DarkRed);

                case BuildInfo.BuildStatus.InProgress:
                    return(Color.Blue);

                case BuildInfo.BuildStatus.Unstable:
                    return(Color.OrangeRed);

                case BuildInfo.BuildStatus.Stopped:
                    return(Color.Gray);

                default:
                    return(foreColor);
                }
            }
        }