public int Compare(object x, object y) { ProjectGridRow rowx = x as ProjectGridRow; ProjectGridRow rowy = y as ProjectGridRow; if (column == ProjectGridSortColumn.Name) { return(rowx.Name.CompareTo(rowy.Name) * (ascending ? 1 : -1)); } else if (column == ProjectGridSortColumn.LastBuildDate) { return(rowx.LastBuildDate.CompareTo(rowy.LastBuildDate) * (ascending ? 1 : -1)); } else if (column == ProjectGridSortColumn.BuildStatus) { return(rowx.BuildStatus.CompareTo(rowy.BuildStatus) * (ascending ? 1 : -1)); } else { return(0); } }
public void AddRow(ProjectGridRow row) { this.Rows.Add(row); if (row.BuildStatusHtmlColor == Color.Red.Name) { this.CategoryColor = Color.Red.Name; this.Display = true; } else if (row.BuildStatusHtmlColor == Color.Blue.Name && this.CategoryColor != Color.Red.Name) { this.CategoryColor = Color.Blue.Name; } }
private Array GenerateCategoryList(ProjectGridRow[] projectGridRows) { if (projectGridRows == null) return null; List<string> categories = new List<string>(); foreach (ProjectGridRow projectGridRow in projectGridRows) { string category = projectGridRow.Category; System.Diagnostics.Debug.WriteLine(category); if (!string.IsNullOrEmpty(category) && !categories.Contains(category)) categories.Add(category); } // sort list if at least one element exists if (categories.Count == 0) return null; categories.Sort(); return categories.ToArray(); }