private string BuildTileColumnConfig() { if (m_tabHandler == null || GameFileViewFactory.IsUsingColumnView) { return(string.Empty); } List <ColumnConfig> viewConfig = new List <ColumnConfig>(); foreach (ITabView tab in m_tabHandler.TabViews) { viewConfig.AddRange(tab.GetColumnConfig()); } List <ColumnConfig> config = DataCache.Instance.GetColumnConfig().ToList(); // Tile views use IGameFileSortableView which only stores the single column that is sorted, so clear all sorting on all columns config.ForEach(x => x.Sort = SortOrder.None); foreach (ColumnConfig viewColumn in viewConfig) { ColumnConfig existingColumn = config.FirstOrDefault(x => x.Parent == viewColumn.Parent && x.Column == viewColumn.Column); if (existingColumn != null) { existingColumn.Sort = viewColumn.Sort; } else { config.Add(viewColumn); } } return(SerializeColumnConfig(config)); }
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; } } } }
private static void SetSortedColumn(string tab, GameFileViewControl gameFileViewControl, ColumnConfig[] colConfig) { ColumnConfig config = colConfig.FirstOrDefault(x => x.Parent == tab && x.Sort != SortOrder.None); if (config != null) { gameFileViewControl.SetSortedColumn(config.Column, config.Sort); } }
public List <ColumnConfig> GetColumnConfig() { List <ColumnConfig> config = new List <ColumnConfig>(); foreach (string key in GameFileViewControl.GetColumnKeyOrder()) { ColumnConfig col = new ColumnConfig(Title, key, GameFileViewControl.GetColumnWidth(key), GameFileViewControl.GetColumnSort(key)); config.Add(col); } return(config); }
private string BuildColumnConfig() { List <ColumnConfig> columnViewConfig = new List <ColumnConfig>(); List <ColumnConfig> tileViewConfig = new List <ColumnConfig>(); HashSet <string> tileViewKeys = new HashSet <string>(); foreach (ITabView tab in m_tabHandler.TabViews) { if (tab.GameFileViewControl is IGameFileColumnView) { columnViewConfig.AddRange(tab.GetColumnConfig()); } else { tileViewConfig.AddRange(tab.GetColumnConfig()); tileViewKeys.Add(tab.Key.ToString()); } } // Only select columns from views that are tile views List <ColumnConfig> config = DataCache.Instance.GetColumnConfig().Where(x => tileViewKeys.Contains(x.Parent)).ToList(); // Tile views use IGameFileSortableView which only stores the single column that is sorted, so clear all sorting on all columns config.ForEach(x => x.Sort = SortOrder.None); foreach (ColumnConfig viewColumn in tileViewConfig) { ColumnConfig existingColumn = config.FirstOrDefault(x => x.Parent == viewColumn.Parent && x.Column == viewColumn.Column); if (existingColumn != null) { existingColumn.Sort = viewColumn.Sort; } else { config.Add(viewColumn); } } config.AddRange(columnViewConfig); return(SerializeColumnConfig(config)); }