public void SetColumnConfig(ColumnField[] columnTextFields, ColumnConfig[] colConfig) { string key = Key.ToString(); if (GameFileViewControl is IGameFileColumnView columnView) { columnView.SuspendLayout(); var sortedColumns = SortColumns(key, columnTextFields, colConfig); columnView.SetColumnFields(sortedColumns); SetSortedColumn(key, columnView, colConfig); SetColumnWidths(key, columnView, colConfig); columnView.SetColumnFormat("ReleaseDate", CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern); columnView.SetColumnFormat("Downloaded", CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern); columnView.SetColumnFormat("LastPlayed", CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern); GameFileViewControl.ResumeLayout(); } else if (GameFileViewControl is IGameFileSortableView sortableView) { var sortedColumns = SortColumns(key, columnTextFields, colConfig); foreach (var sortColumn in sortedColumns) { ColumnConfig config = colConfig.FirstOrDefault(x => x.Sort != SortOrder.None && x.Parent == key && sortColumn.DataKey.Equals(x.Column, StringComparison.InvariantCultureIgnoreCase)); if (config != null) { sortableView.SetSortedColumn(config.Column, config.Sort); break; } } } }
public void SetColumnConfig(ColumnField[] columnTextFields, ColumnConfig[] colConfig) { GameFileViewControl.SuspendLayout(); var sortedColumns = SortColumns(Title, columnTextFields, colConfig); GameFileViewControl.SetColumnFields(sortedColumns); SetSortedColumn(Title, GameFileViewControl, colConfig); SetColumnWidths(Title, GameFileViewControl, colConfig); GameFileViewControl.SetColumnFormat("ReleaseDate", CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern); GameFileViewControl.SetColumnFormat("Downloaded", CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern); GameFileViewControl.SetColumnFormat("LastPlayed", CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern); GameFileViewControl.ResumeLayout(); }