- Timestamp:
- 06/29/12 11:15:18 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Clients.OKB.Views/3.3/RunCreation/Views/OKBExperimentUploadView.cs
r8145 r8158 109 109 private void DisplayRuns(RunCollection runs) { 110 110 if (RunCreationClient.Instance.Algorithms == null || RunCreationClient.Instance.Algorithms.Count() == 0) { 111 RunCreationClient.Instance.RefreshAsync(DisplayError); 111 Action a = new Action(delegate { 112 RunCreationClient.Instance.Refresh(); 113 CreateUI(runs); 114 }); 115 116 Task.Factory.StartNew(a).ContinueWith((t) => { DisplayError(t.Exception); }, TaskContinuationOptions.OnlyOnFaulted); 112 117 } else { 113 118 CreateUI(runs); … … 116 121 117 122 private void CreateUI(RunCollection runs) { 118 if (problems.Count == 0) 119 problems.AddRange(RunCreationClient.Instance.Problems); 120 if (algorithms.Count == 0) 121 algorithms.AddRange(RunCreationClient.Instance.Algorithms); 122 123 IItem algorithmType; 124 IItem problemType; 125 IItem algorithmName; 126 IItem problemName; 127 128 DataGridViewComboBoxColumn cmbAlgorithm = dataGridView.Columns[algorithmColumnIndex] as DataGridViewComboBoxColumn; 129 cmbAlgorithm.DataSource = algorithms; 130 cmbAlgorithm.DisplayMember = "Name"; 131 132 DataGridViewComboBoxColumn cmbProblem = dataGridView.Columns[problemColumnIndex] as DataGridViewComboBoxColumn; 133 cmbProblem.DataSource = problems; 134 cmbProblem.DisplayMember = "Name"; 135 136 foreach (IRun run in runs) { 137 int idx = dataGridView.Rows.Add(run.Name); 138 DataGridViewRow curRow = dataGridView.Rows[idx]; 139 curRow.Tag = run; 140 141 if (run.Parameters.TryGetValue(algorithmTypeParameterName, out algorithmType)) { 142 HeuristicLab.Data.StringValue algStr = algorithmType as HeuristicLab.Data.StringValue; 143 if (algStr != null) { 144 curRow.Cells[1].Value = algStr; 123 if (InvokeRequired) { 124 Invoke(new Action<RunCollection>(CreateUI), runs); 125 } else { 126 if (problems.Count == 0) 127 problems.AddRange(RunCreationClient.Instance.Problems); 128 if (algorithms.Count == 0) 129 algorithms.AddRange(RunCreationClient.Instance.Algorithms); 130 131 IItem algorithmType; 132 IItem problemType; 133 IItem algorithmName; 134 IItem problemName; 135 136 DataGridViewComboBoxColumn cmbAlgorithm = dataGridView.Columns[algorithmColumnIndex] as DataGridViewComboBoxColumn; 137 cmbAlgorithm.DataSource = algorithms; 138 cmbAlgorithm.DisplayMember = "Name"; 139 140 DataGridViewComboBoxColumn cmbProblem = dataGridView.Columns[problemColumnIndex] as DataGridViewComboBoxColumn; 141 cmbProblem.DataSource = problems; 142 cmbProblem.DisplayMember = "Name"; 143 144 foreach (IRun run in runs) { 145 int idx = dataGridView.Rows.Add(run.Name); 146 DataGridViewRow curRow = dataGridView.Rows[idx]; 147 curRow.Tag = run; 148 149 if (run.Parameters.TryGetValue(algorithmTypeParameterName, out algorithmType)) { 150 HeuristicLab.Data.StringValue algStr = algorithmType as HeuristicLab.Data.StringValue; 151 if (algStr != null) { 152 curRow.Cells[1].Value = algStr; 153 } 145 154 } 146 } 147 148 if (run.Parameters.TryGetValue(algorithmNameParameterName, out algorithmName)) {149 HeuristicLab.Data.StringValue algStr = algorithmName as HeuristicLab.Data.StringValue;150 if (algStr != null) {151 curRow.Cells[2].Value = algStr;155 156 if (run.Parameters.TryGetValue(algorithmNameParameterName, out algorithmName)) { 157 HeuristicLab.Data.StringValue algStr = algorithmName as HeuristicLab.Data.StringValue; 158 if (algStr != null) { 159 curRow.Cells[2].Value = algStr; 160 } 152 161 } 153 } 154 155 if (run.Parameters.TryGetValue(problemTypeParameterName, out problemType)) {156 HeuristicLab.Data.StringValue prbStr = problemType as HeuristicLab.Data.StringValue;157 if (prbStr != null) {158 curRow.Cells[4].Value = prbStr;162 163 if (run.Parameters.TryGetValue(problemTypeParameterName, out problemType)) { 164 HeuristicLab.Data.StringValue prbStr = problemType as HeuristicLab.Data.StringValue; 165 if (prbStr != null) { 166 curRow.Cells[4].Value = prbStr; 167 } 159 168 } 160 } 161 162 if (run.Parameters.TryGetValue(problemNameParameterName, out problemName)) {163 HeuristicLab.Data.StringValue prbStr = problemName as HeuristicLab.Data.StringValue;164 if (prbStr != null) {165 curRow.Cells[5].Value = prbStr;169 170 if (run.Parameters.TryGetValue(problemNameParameterName, out problemName)) { 171 HeuristicLab.Data.StringValue prbStr = problemName as HeuristicLab.Data.StringValue; 172 if (prbStr != null) { 173 curRow.Cells[5].Value = prbStr; 174 } 166 175 } 167 176 } … … 170 179 171 180 private void ClearRuns() { 172 dataGridView.Rows.Clear(); 173 runs.Clear(); 181 if (InvokeRequired) { 182 Invoke(new Action(ClearRuns)); 183 } else { 184 dataGridView.Rows.Clear(); 185 runs.Clear(); 186 } 174 187 } 175 188 … … 222 235 } 223 236 FinishProgressView(); 237 ClearRuns(); 224 238 } 225 239 … … 238 252 progress.Finish(); 239 253 SetEnabledStateOfControls(); 240 ClearRuns();241 254 } 242 255 }
Note: See TracChangeset
for help on using the changeset viewer.