public void PopulateGrid() { Cell colTitleModel = new Cell { ElementText = new ActorsGrid.RotatedText(-90.0f), BackColor = Color.SteelBlue, ForeColor = Color.White, TextAlignment = ContentAlignment.BottomCenter }; Cell topleftTitleModel = new Cell { BackColor = Color.SteelBlue, ForeColor = Color.White, TextAlignment = ContentAlignment.BottomLeft }; this.grid1.Columns.Clear(); this.grid1.Rows.Clear(); int maxSeason = GetMaxSeason(showList); int cols = maxSeason + 2; int rows = showList.Count + 1; // Draw Header this.grid1.ColumnsCount = cols; this.grid1.RowsCount = rows; this.grid1.FixedColumns = 1; this.grid1.FixedRows = 1; this.grid1.Selection.EnableMultiSelection = false; this.grid1.Rows[0].AutoSizeMode = SourceGrid.AutoSizeMode.MinimumSize; this.grid1.Rows[0].Height = 65; ColumnHeader h = new ColumnHeader("Show") { AutomaticSortEnabled = false, ResizeEnabled = false }; this.grid1[0, 0] = h; this.grid1[0, 0].View = topleftTitleModel; // Draw season for (int c = 0; c < maxSeason + 1; c++) { h = new ColumnHeader(c == 0 ? "Specials" : $"Season {c}") { AutomaticSortEnabled = false, ResizeEnabled = false }; this.grid1[0, c + 1] = h; this.grid1[0, c + 1].View = colTitleModel; this.grid1.Columns[c + 1].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize; } this.grid1.Columns[0].Width = 150; // Draw Shows int r = 0; // TODO: remove reliance on index foreach (ShowSummaryData show in showList) { RowHeader rh = new RowHeader(show.ShowName) { ResizeEnabled = false }; this.grid1[r + 1, 0] = rh; this.grid1[r + 1, 0].AddController(new ShowClickEvent(this, show.ShowItem)); foreach (ShowSummaryData.ShowSummarySeasonData seasonData in show.SeasonDataList) { ShowSummaryData.SummaryOutput output = seasonData.GetOuput(); this.grid1[r + 1, seasonData.SeasonNumber + 1] = new SourceGrid.Cells.Cell(output.Details, typeof(string)); this.grid1[r + 1, seasonData.SeasonNumber + 1].View = new Cell { BackColor = output.Color, ForeColor = Color.White, TextAlignment = ContentAlignment.BottomRight }; this.grid1[r + 1, seasonData.SeasonNumber + 1].AddController(new ShowClickEvent(this, show.ShowItem, seasonData.Season)); this.grid1[r + 1, seasonData.SeasonNumber + 1].Editor.EditableMode = EditableMode.None; } r++; } this.grid1.AutoSizeCells(); }
private void PopulateGrid() { if (grid1.IsDisposed) { return; } Cell colTitleModel = new Cell { ElementText = new ActorsGrid.RotatedText(-90.0f), BackColor = Color.SteelBlue, ForeColor = Color.White, TextAlignment = ContentAlignment.BottomCenter }; Cell topleftTitleModel = new Cell { BackColor = Color.SteelBlue, ForeColor = Color.White, TextAlignment = ContentAlignment.BottomLeft }; grid1.Columns.Clear(); grid1.Rows.Clear(); int maxSeason = GetMaxSeason(showList); int cols = maxSeason + 3; int rows = showList.Count + 1; // Draw Header grid1.ColumnsCount = cols; grid1.RowsCount = rows; grid1.FixedColumns = 2; grid1.FixedRows = 1; grid1.Selection.EnableMultiSelection = false; grid1.Rows[0].AutoSizeMode = SourceGrid.AutoSizeMode.MinimumSize; grid1.Rows[0].Height = 65; ColumnHeader h = new ColumnHeader("Show") { AutomaticSortEnabled = false, ResizeEnabled = false }; grid1[0, 0] = h; grid1[0, 0].View = topleftTitleModel; ColumnHeader h2 = new ColumnHeader("Status") { AutomaticSortEnabled = false, ResizeEnabled = false }; grid1[0, 1] = h2; grid1[0, 1].View = topleftTitleModel; // Draw season for (int c = chkHideSpecials.Checked?1:0; c < maxSeason + 1; c++) { h = new ColumnHeader(ProcessedSeason.UIFullSeasonWord(c)) { AutomaticSortEnabled = false, ResizeEnabled = false }; grid1[0, c + 2] = h; grid1[0, c + 2].View = colTitleModel; grid1.Columns[c + 2].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize; } grid1.Columns[0].Width = 150; // Draw Shows int r = 0; foreach (ShowSummaryData show in showList) { //Ignore shows with no missing episodes if (chkHideComplete.Checked && !show.HasMssingEpisodes(chkHideSpecials.Checked, chkHideIgnored.Checked)) { continue; } //Ignore shows with no missing aired episodes if (chkHideUnaired.Checked && !show.HasAiredMssingEpisodes(chkHideSpecials.Checked, chkHideIgnored.Checked)) { continue; } //Ignore shows which do not have the missing check if (chkHideNotScanned.Checked && !show.ShowConfiguration.DoMissingCheck) { continue; } if (chkOnlyShowEnded.Checked && !show.ShowConfiguration.ShowStatus.Equals("Ended", StringComparison.OrdinalIgnoreCase)) { continue; } if (chkHideDiskEps.Checked && show.HasEpisodesOnDisk()) { continue; } RowHeader rh = new RowHeader(show.ShowName) { ResizeEnabled = false, View = new Cell { ForeColor = show.ShowConfiguration.DoMissingCheck ? Color.Black : Color.Gray } }; //Gray if the show is not checked for missing episodes in the scan grid1[r + 1, 0] = rh; grid1[r + 1, 0].AddController(new ShowClickEvent(this, show.ShowConfiguration)); RowHeader rh2 = new RowHeader(show.ShowConfiguration.ShowStatus) { ResizeEnabled = false, View = new Cell { ForeColor = show.ShowConfiguration.DoMissingCheck ? Color.Black : Color.Gray } }; //Gray if the show is not checked for missing episodes in the scan grid1[r + 1, 1] = rh2; foreach (ShowSummaryData.ShowSummarySeasonData seasonData in show.SeasonDataList) { ShowSummaryData.SummaryOutput output = seasonData.GetOuput(); //Ignore Season if checkbox is checked if (chkHideSpecials.Checked && output.Special) { continue; } //Ignore Season if checkbox is checked if (chkHideIgnored.Checked && output.Ignored) { continue; } grid1[r + 1, seasonData.SeasonNumber + 2] = new SourceGrid.Cells.Cell(output.Details, typeof(string)) { View = new Cell { BackColor = output.Color, ForeColor = Color.White, TextAlignment = ContentAlignment.BottomRight }, Editor = { EditableMode = EditableMode.None } }; grid1[r + 1, seasonData.SeasonNumber + 2].AddController(new ShowClickEvent(this, show.ShowConfiguration, seasonData.ProcessedSeason)); } r++; } grid1.AutoSizeCells(); }