Changeset 13036
- Timestamp:
- 10/19/15 17:24:53 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionTableView.cs
r12692 r13036 25 25 using System.Linq; 26 26 using System.Windows.Forms; 27 using HeuristicLab.Collections; 27 28 using HeuristicLab.Core; 28 29 using HeuristicLab.Data.Views; … … 122 123 123 124 protected override void UpdateColumnHeaders() { 124 HashSet<string> visibleColumnNames = new HashSet<string>(dataGridView.Columns.OfType<DataGridViewColumn>()125 .Where(c => c.Visible && !string.IsNullOrEmpty(c.HeaderText)).Select(c => c.HeaderText));126 127 125 for (int i = 0; i < dataGridView.ColumnCount; i++) { 128 126 if (i < base.Content.ColumnNames.Count()) … … 130 128 else 131 129 dataGridView.Columns[i].HeaderText = "Column " + (i + 1); 130 } 131 132 HashSet<string> visibleColumnNames = new HashSet<string>(dataGridView.Columns.OfType<DataGridViewColumn>() 133 .Where(c => c.Visible && !string.IsNullOrEmpty(c.HeaderText) && GetNumberOfDistinctValues(c.HeaderText) > 1).Select(c => c.HeaderText)); 134 135 for (int i = 0; i < dataGridView.ColumnCount; i++) { 132 136 dataGridView.Columns[i].Visible = visibleColumnNames.Count == 0 || visibleColumnNames.Contains(dataGridView.Columns[i].HeaderText); 133 137 } 138 } 139 140 // returns the number of different values for the parameter or result in the RunCollection 141 private int GetNumberOfDistinctValues(string columnName) { 142 Func<IRun, string, string> GetStringValue = (IRun r, string colName) => { 143 // also include missing values in the count 144 if (r.Parameters.ContainsKey(colName)) return r.Parameters[colName].ToString(); 145 if (r.Results.ContainsKey(colName)) return r.Results[colName].ToString(); 146 return string.Empty; 147 }; 148 return Content.Select(r => GetStringValue(r, columnName)).Distinct().Count(); 134 149 } 135 150
Note: See TracChangeset
for help on using the changeset viewer.