- Timestamp:
- 09/17/14 17:34:43 (10 years ago)
- Location:
- branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/ChartAnalysisView.cs
r11376 r11378 114 114 private void RegisterRunEvents(IEnumerable<IRun> runs) { 115 115 foreach (IRun run in runs) { 116 RegisterRunParametersEvents(run);117 116 RegisterRunResultsEvents(run); 118 117 } … … 121 120 private void DeregisterRunEvents(IEnumerable<IRun> runs) { 122 121 foreach (IRun run in runs) { 123 DeregisterRunParametersEvents(run);124 122 DeregisterRunResultsEvents(run); 125 123 } 126 }127 128 private void RegisterRunParametersEvents(IRun run) {129 IObservableDictionary<string, IItem> dict = run.Parameters;130 dict.ItemsAdded += run_Changed;131 dict.ItemsRemoved += run_Changed;132 dict.ItemsReplaced += run_Changed;133 dict.CollectionReset += run_Changed;134 124 } 135 125 … … 142 132 } 143 133 144 private void DeregisterRunParametersEvents(IRun run) {145 IObservableDictionary<string, IItem> dict = run.Parameters;146 dict.ItemsAdded -= run_Changed;147 dict.ItemsRemoved -= run_Changed;148 dict.ItemsReplaced -= run_Changed;149 dict.CollectionReset -= run_Changed;150 }151 152 134 private void DeregisterRunResultsEvents(IRun run) { 153 135 IObservableDictionary<string, IItem> dict = run.Results; … … 175 157 } 176 158 177 void Content_UpdateOfRunsInProgressChanged(object sender, EventArgs e) {159 private void Content_UpdateOfRunsInProgressChanged(object sender, EventArgs e) { 178 160 suppressUpdates = Content.UpdateOfRunsInProgress; 179 161 … … 196 178 197 179 #region Events 198 void DataGridView_RowHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) {180 private void DataGridView_RowHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { 199 181 if (e.RowIndex >= 0) { 200 182 IRun run = runs[stringConvertibleMatrixView.GetRowIndex(e.RowIndex)]; -
branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/CorrelationView.cs
r11375 r11378 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using System.Windows.Forms; 25 using HeuristicLab.Collections; 26 using HeuristicLab.Core; 26 27 using HeuristicLab.Core.Views; 27 28 using HeuristicLab.Data; … … 49 50 50 51 private Dictionary<string, ResultParameterType> resultsParameters; 52 private bool suppressUpdates = false; 51 53 52 54 public CorrelationView() { … … 61 63 62 64 if (Content != null) { 63 resultsParameters = GetRowNames();64 65 UpdateResultComboBox(); 65 66 } … … 78 79 Content.CollectionReset += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset); 79 80 Content.UpdateOfRunsInProgressChanged += Content_UpdateOfRunsInProgressChanged; 81 RegisterRunEvents(Content); 80 82 } 81 83 … … 86 88 Content.CollectionReset -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset); 87 89 Content.UpdateOfRunsInProgressChanged -= Content_UpdateOfRunsInProgressChanged; 90 DeregisterRunEvents(Content); 91 } 92 93 private void RegisterRunEvents(IEnumerable<IRun> runs) { 94 foreach (IRun run in runs) { 95 RegisterRunResultsEvents(run); 96 RegisterRunParametersEvents(run); 97 run.PropertyChanged += run_PropertyChanged; 98 } 99 } 100 101 private void DeregisterRunEvents(IEnumerable<IRun> runs) { 102 foreach (IRun run in runs) { 103 DeregisterRunResultsEvents(run); 104 DeregisterRunParametersEvents(run); 105 run.PropertyChanged -= run_PropertyChanged; 106 } 107 } 108 109 private void RegisterRunResultsEvents(IRun run) { 110 IObservableDictionary<string, IItem> dict = run.Results; 111 dict.ItemsAdded += run_Changed; 112 dict.ItemsRemoved += run_Changed; 113 dict.ItemsReplaced += run_Changed; 114 dict.CollectionReset += run_Changed; 115 } 116 117 private void DeregisterRunResultsEvents(IRun run) { 118 IObservableDictionary<string, IItem> dict = run.Results; 119 dict.ItemsAdded -= run_Changed; 120 dict.ItemsRemoved -= run_Changed; 121 dict.ItemsReplaced -= run_Changed; 122 dict.CollectionReset -= run_Changed; 123 } 124 125 private void RegisterRunParametersEvents(IRun run) { 126 IObservableDictionary<string, IItem> dict = run.Parameters; 127 dict.ItemsAdded += run_Changed; 128 dict.ItemsRemoved += run_Changed; 129 dict.ItemsReplaced += run_Changed; 130 dict.CollectionReset += run_Changed; 131 } 132 133 private void DeregisterRunParametersEvents(IRun run) { 134 IObservableDictionary<string, IItem> dict = run.Parameters; 135 dict.ItemsAdded -= run_Changed; 136 dict.ItemsRemoved -= run_Changed; 137 dict.ItemsReplaced -= run_Changed; 138 dict.CollectionReset -= run_Changed; 88 139 } 89 140 90 141 private void Content_CollectionReset(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) { 91 RebuildCorrelationTable();142 UpdateUI(); 92 143 } 93 144 94 145 private void Content_ItemsRemoved(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) { 95 RebuildCorrelationTable();146 UpdateUI(); 96 147 } 97 148 98 149 private void Content_ItemsAdded(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) { 99 RebuildCorrelationTable(); 100 } 101 102 void Content_UpdateOfRunsInProgressChanged(object sender, EventArgs e) { 103 if (!Content.UpdateOfRunsInProgress) { 150 UpdateUI(); 151 } 152 153 private void Content_UpdateOfRunsInProgressChanged(object sender, EventArgs e) { 154 suppressUpdates = Content.UpdateOfRunsInProgress; 155 UpdateUI(); 156 } 157 158 private void run_Changed(object sender, EventArgs e) { 159 if (InvokeRequired) { 160 Invoke(new EventHandler(run_Changed), sender, e); 161 } 162 UpdateUI(); 163 } 164 165 void run_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { 166 UpdateUI(); 167 } 168 #endregion 169 170 private void UpdateUI() { 171 if (!suppressUpdates) { 172 UpdateResultComboBox(); 104 173 RebuildCorrelationTable(); 105 174 } 106 175 } 107 #endregion108 176 109 177 private void UpdateResultComboBox() { 178 resultsParameters = GetRowNames(); 179 string selectedResult = (string)this.resultComboBox.SelectedItem; 110 180 resultComboBox.Items.Clear(); 111 112 181 resultComboBox.Items.AddRange(resultsParameters.Keys.ToArray()); 113 if (resultComboBox.Items.Count > 0) resultComboBox.SelectedItem = resultComboBox.Items[0]; 182 183 if (selectedResult != null && resultComboBox.Items.Contains(selectedResult)) { 184 resultComboBox.SelectedItem = selectedResult; 185 } else if (resultComboBox.Items.Count > 0) { 186 resultComboBox.SelectedItem = resultComboBox.Items[0]; 187 } 114 188 } 115 189 … … 195 269 var resultVals = GetDoublesFromResults(runs.Where(x => x.Results.ContainsKey(resultName)).Where(x => x.Results[resultName] is DoubleValue || x.Results[resultName] is IntValue).ToList(), resultName); 196 270 197 List<double> resultRowVals = new List<double>();271 List<double> resultRowVals; 198 272 if (rowName.Value == ResultParameterType.Result) { 199 273 resultRowVals = GetDoublesFromResults(runs.Where(x => x.Results.ContainsKey(rowName.Key)).Where(x => x.Results[rowName.Key] is DoubleValue || x.Results[rowName.Key] is IntValue).ToList(), rowName.Key); -
branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeInfluenceView.cs
r11376 r11378 141 141 DeregisterRunEvents(e.OldItems); 142 142 RegisterRunEvents(e.Items); 143 UpdateAll(); 143 144 } 144 145 private void Content_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IRun> e) { 145 146 DeregisterRunEvents(e.Items); 147 UpdateComboBoxes(); 146 148 } 147 149 private void Content_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IRun> e) { 148 150 RegisterRunEvents(e.Items); 151 UpdateComboBoxes(); 149 152 } 150 153 private void Content_UpdateOfRunsInProgressChanged(object sender, EventArgs e) { … … 191 194 protected override void OnContentChanged() { 192 195 base.OnContentChanged(); 196 UpdateAll(); 197 } 198 199 private void UpdateAll() { 193 200 this.categoricalMapping.Clear(); 194 201 UpdateComboBoxes(); … … 233 240 this.yAxisComboBox.Items.AddRange(Matrix.ColumnNames.ToArray()); 234 241 235 bool changed = false;236 242 if (selectedYAxis != null && yAxisComboBox.Items.Contains(selectedYAxis)) { 237 243 yAxisComboBox.SelectedItem = selectedYAxis; 238 changed = true;239 }240 if (changed)241 244 UpdateDataPoints(); 245 } 242 246 } 243 247 } … … 340 344 } 341 345 342 string columnName = string.Empty; 343 if (value != null && value is DoubleValue || value is IntValue) { 344 columnName = selectedAxis + ": "; 345 columnName += value.ToString(); 346 } else { 347 columnName = series.Name; 348 } 349 346 string columnName = series.Name; 350 347 columnNames.Add(columnName); 351 348 }
Note: See TracChangeset
for help on using the changeset viewer.