Changeset 15082 for stable/HeuristicLab.Clients.OKB.Views/3.3/RunCreation
- Timestamp:
- 06/28/17 22:14:18 (7 years ago)
- Location:
- stable
- Files:
-
- 3 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 13682-13684,13690-13693,13709,13746
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Clients.OKB.Views/3.3/RunCreation/Views/OKBProblemView.Designer.cs
r15081 r15082 52 52 this.parametersTabPage = new System.Windows.Forms.TabPage(); 53 53 this.parameterCollectionView = new HeuristicLab.Core.Views.ParameterCollectionView(); 54 this.solutionsTabPage = new System.Windows.Forms.TabPage(); 54 55 this.flaAnalysisTabPage = new System.Windows.Forms.TabPage(); 56 this.flaSplitContainer = new System.Windows.Forms.SplitContainer(); 55 57 this.calculateButton = new System.Windows.Forms.Button(); 56 this.flaSplitContainer = new System.Windows.Forms.SplitContainer();57 58 this.characteristicsMatrixView = new HeuristicLab.Data.Views.StringConvertibleMatrixView(); 58 59 this.uploadCharacteristicsButton = new System.Windows.Forms.Button(); 59 60 this.downloadCharacteristicsButton = new System.Windows.Forms.Button(); 61 this.solutionsViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 62 this.refreshSolutionsButton = new System.Windows.Forms.Button(); 63 this.uploadSolutionsButton = new System.Windows.Forms.Button(); 60 64 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 61 65 this.tabControl.SuspendLayout(); 62 66 this.parametersTabPage.SuspendLayout(); 67 this.solutionsTabPage.SuspendLayout(); 63 68 this.flaAnalysisTabPage.SuspendLayout(); 64 69 ((System.ComponentModel.ISupportInitialize)(this.flaSplitContainer)).BeginInit(); … … 135 140 | System.Windows.Forms.AnchorStyles.Right))); 136 141 this.tabControl.Controls.Add(this.parametersTabPage); 142 this.tabControl.Controls.Add(this.solutionsTabPage); 137 143 this.tabControl.Controls.Add(this.flaAnalysisTabPage); 138 144 this.tabControl.Location = new System.Drawing.Point(6, 53); … … 148 154 this.parametersTabPage.Name = "parametersTabPage"; 149 155 this.parametersTabPage.Padding = new System.Windows.Forms.Padding(3); 150 this.parametersTabPage.Size = new System.Drawing.Size( 692, 314);156 this.parametersTabPage.Size = new System.Drawing.Size(728, 447); 151 157 this.parametersTabPage.TabIndex = 0; 152 158 this.parametersTabPage.Text = "Parameters"; … … 163 169 this.parameterCollectionView.ReadOnly = true; 164 170 this.parameterCollectionView.ShowDetails = true; 165 this.parameterCollectionView.Size = new System.Drawing.Size( 686, 308);171 this.parameterCollectionView.Size = new System.Drawing.Size(722, 441); 166 172 this.parameterCollectionView.TabIndex = 8; 173 // 174 // solutionsTabPage 175 // 176 this.solutionsTabPage.Controls.Add(this.uploadSolutionsButton); 177 this.solutionsTabPage.Controls.Add(this.refreshSolutionsButton); 178 this.solutionsTabPage.Controls.Add(this.solutionsViewHost); 179 this.solutionsTabPage.Location = new System.Drawing.Point(4, 22); 180 this.solutionsTabPage.Name = "solutionsTabPage"; 181 this.solutionsTabPage.Padding = new System.Windows.Forms.Padding(3); 182 this.solutionsTabPage.Size = new System.Drawing.Size(728, 447); 183 this.solutionsTabPage.TabIndex = 3; 184 this.solutionsTabPage.Text = "Solutions"; 185 this.solutionsTabPage.UseVisualStyleBackColor = true; 167 186 // 168 187 // flaAnalysisTabPage … … 177 196 this.flaAnalysisTabPage.UseVisualStyleBackColor = true; 178 197 // 198 // flaSplitContainer 199 // 200 this.flaSplitContainer.Dock = System.Windows.Forms.DockStyle.Fill; 201 this.flaSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2; 202 this.flaSplitContainer.Location = new System.Drawing.Point(3, 3); 203 this.flaSplitContainer.Name = "flaSplitContainer"; 204 // 205 // flaSplitContainer.Panel1 206 // 207 this.flaSplitContainer.Panel1.Controls.Add(this.calculateButton); 208 // 209 // flaSplitContainer.Panel2 210 // 211 this.flaSplitContainer.Panel2.Controls.Add(this.characteristicsMatrixView); 212 this.flaSplitContainer.Panel2.Controls.Add(this.uploadCharacteristicsButton); 213 this.flaSplitContainer.Panel2.Controls.Add(this.downloadCharacteristicsButton); 214 this.flaSplitContainer.Size = new System.Drawing.Size(722, 441); 215 this.flaSplitContainer.SplitterDistance = 363; 216 this.flaSplitContainer.TabIndex = 7; 217 // 179 218 // calculateButton 180 219 // … … 186 225 this.calculateButton.UseVisualStyleBackColor = true; 187 226 this.calculateButton.Click += new System.EventHandler(this.calculateButton_Click); 188 //189 // flaSplitContainer190 //191 this.flaSplitContainer.Dock = System.Windows.Forms.DockStyle.Fill;192 this.flaSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;193 this.flaSplitContainer.Location = new System.Drawing.Point(3, 3);194 this.flaSplitContainer.Name = "flaSplitContainer";195 //196 // flaSplitContainer.Panel1197 //198 this.flaSplitContainer.Panel1.Controls.Add(this.calculateButton);199 //200 // flaSplitContainer.Panel2201 //202 this.flaSplitContainer.Panel2.Controls.Add(this.characteristicsMatrixView);203 this.flaSplitContainer.Panel2.Controls.Add(this.uploadCharacteristicsButton);204 this.flaSplitContainer.Panel2.Controls.Add(this.downloadCharacteristicsButton);205 this.flaSplitContainer.Size = new System.Drawing.Size(722, 441);206 this.flaSplitContainer.SplitterDistance = 363;207 this.flaSplitContainer.TabIndex = 7;208 227 // 209 228 // characteristicsMatrixView … … 241 260 this.downloadCharacteristicsButton.UseVisualStyleBackColor = true; 242 261 this.downloadCharacteristicsButton.Click += new System.EventHandler(this.downloadCharacteristicsButton_Click); 262 // 263 // solutionsViewHost 264 // 265 this.solutionsViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 266 | System.Windows.Forms.AnchorStyles.Left) 267 | System.Windows.Forms.AnchorStyles.Right))); 268 this.solutionsViewHost.Caption = "View"; 269 this.solutionsViewHost.Content = null; 270 this.solutionsViewHost.Enabled = false; 271 this.solutionsViewHost.Location = new System.Drawing.Point(0, 35); 272 this.solutionsViewHost.Name = "solutionsViewHost"; 273 this.solutionsViewHost.ReadOnly = false; 274 this.solutionsViewHost.Size = new System.Drawing.Size(728, 412); 275 this.solutionsViewHost.TabIndex = 0; 276 this.solutionsViewHost.ViewsLabelVisible = true; 277 this.solutionsViewHost.ViewType = null; 278 // 279 // refreshSolutionsButton 280 // 281 this.refreshSolutionsButton.Location = new System.Drawing.Point(6, 6); 282 this.refreshSolutionsButton.Name = "refreshSolutionsButton"; 283 this.refreshSolutionsButton.Size = new System.Drawing.Size(26, 23); 284 this.refreshSolutionsButton.TabIndex = 1; 285 this.refreshSolutionsButton.Text = "Refresh"; 286 this.refreshSolutionsButton.UseVisualStyleBackColor = true; 287 this.refreshSolutionsButton.Click += new System.EventHandler(this.refreshSolutionsButton_Click); 288 // 289 // uploadSolutionsButton 290 // 291 this.uploadSolutionsButton.Location = new System.Drawing.Point(38, 6); 292 this.uploadSolutionsButton.Name = "uploadSolutionsButton"; 293 this.uploadSolutionsButton.Size = new System.Drawing.Size(26, 23); 294 this.uploadSolutionsButton.TabIndex = 1; 295 this.uploadSolutionsButton.Text = "Upload"; 296 this.uploadSolutionsButton.UseVisualStyleBackColor = true; 297 this.uploadSolutionsButton.Click += new System.EventHandler(this.uploadSolutionsButton_Click); 243 298 // 244 299 // OKBProblemView … … 264 319 this.tabControl.ResumeLayout(false); 265 320 this.parametersTabPage.ResumeLayout(false); 321 this.solutionsTabPage.ResumeLayout(false); 266 322 this.flaAnalysisTabPage.ResumeLayout(false); 267 323 this.flaSplitContainer.Panel1.ResumeLayout(false); … … 289 345 private System.Windows.Forms.Button uploadCharacteristicsButton; 290 346 private System.Windows.Forms.Button downloadCharacteristicsButton; 347 private System.Windows.Forms.TabPage solutionsTabPage; 348 private MainForm.WindowsForms.ViewHost solutionsViewHost; 349 private System.Windows.Forms.Button uploadSolutionsButton; 350 private System.Windows.Forms.Button refreshSolutionsButton; 291 351 292 352 -
stable/HeuristicLab.Clients.OKB.Views/3.3/RunCreation/Views/OKBProblemView.cs
r15081 r15082 73 73 uploadCharacteristicsButton.Text = string.Empty; 74 74 uploadCharacteristicsButton.Image = VSImageLibrary.PublishToWeb; 75 refreshSolutionsButton.Text = string.Empty; 76 refreshSolutionsButton.Image = VSImageLibrary.Refresh; 77 uploadSolutionsButton.Text = string.Empty; 78 uploadSolutionsButton.Image = VSImageLibrary.PublishToWeb; 75 79 } 76 80 … … 93 97 base.RegisterContentEvents(); 94 98 Content.ProblemChanged += new EventHandler(Content_ProblemChanged); 99 Content.Solutions.ItemsAdded += SolutionsOnChanged; 100 Content.Solutions.ItemsReplaced += SolutionsOnChanged; 101 Content.Solutions.ItemsRemoved += SolutionsOnChanged; 102 Content.Solutions.CollectionReset += SolutionsOnChanged; 103 } 104 105 private void SolutionsOnChanged(object sender, EventArgs e) { 106 if (InvokeRequired) { Invoke((Action<object, EventArgs>)SolutionsOnChanged, sender, e); return; } 107 SetEnabledStateOfControls(); 95 108 } 96 109 … … 100 113 problemComboBox.SelectedIndex = -1; 101 114 parameterCollectionView.Content = null; 115 solutionsViewHost.Content = null; 102 116 } else { 103 117 problemComboBox.SelectedItem = RunCreationClient.Instance.Problems.FirstOrDefault(x => x.Id == Content.ProblemId); 104 118 parameterCollectionView.Content = Content.Parameters; 119 solutionsViewHost.Content = Content.Solutions; 105 120 } 106 121 UpdateCharacteristicCalculators(); … … 118 133 && characteristicsMatrixView.Content != null && characteristicsMatrixView.Content.Rows > 0; 119 134 calculateButton.Enabled = Content != null && Content.ProblemId != -1 && !Locked && !ReadOnly && calculatorList.CheckedItems.Any(); 135 refreshSolutionsButton.Enabled = Content != null && !ReadOnly && !Locked && Content.ProblemId != -1; 136 uploadSolutionsButton.Enabled = Content != null && !ReadOnly && !Locked && Content.ProblemId != -1 && Content.Solutions.Any(x => x.SolutionId == -1); 120 137 } 121 138 … … 183 200 } 184 201 private void downloadCharacteristicsButton_Click(object sender, EventArgs e) { 185 var values = RunCreationClient. GetCharacteristicValues(Content.ProblemId).ToList();202 var values = RunCreationClient.Instance.GetCharacteristicValues(Content.ProblemId).ToList(); 186 203 var content = new StringMatrix(values.Count, 3); 187 204 for (var i = 0; i < values.Count; i++) { … … 204 221 } 205 222 try { 206 RunCreationClient. SetCharacteristicValues(Content.ProblemId, values);223 RunCreationClient.Instance.SetCharacteristicValues(Content.ProblemId, values); 207 224 } catch (Exception ex) { ErrorHandling.ShowErrorDialog(ex); } 208 225 } … … 217 234 } 218 235 var matrix = (characteristicsMatrixView.Content as StringMatrix) ?? (new StringMatrix(results.Count, 3)); 219 for (var i = 0; i < matrix.Rows; i++) { 220 Value r; 221 if (results.TryGetValue(matrix[i, 0], out r)) { 222 matrix[i, 1] = r.GetValue(); 223 matrix[i, 2] = r.GetType().Name; 224 results.Remove(matrix[i, 0]); 236 try { 237 for (var i = 0; i < matrix.Rows; i++) { 238 Value r; 239 if (results.TryGetValue(matrix[i, 0], out r)) { 240 matrix[i, 1] = r.GetValue(); 241 matrix[i, 2] = r.GetType().Name; 242 results.Remove(matrix[i, 0]); 243 } 225 244 } 226 }227 if (results.Count == 0) return;228 var resultsList = results.ToList();229 var counter = resultsList.Count - 1;230 for (var i = 0; i < matrix.Rows; i++) {231 if (string.IsNullOrEmpty(matrix[i, 0])) {232 matrix[i, 0] = resultsList[counter].Key;233 matrix[i, 1] = resultsList[counter].Value.GetValue();234 matrix[i, 2] = resultsList[counter].Value.GetType().Name;235 resultsList.RemoveAt(counter);236 counter--;237 if (counter < 0) return;245 if (results.Count == 0) return; 246 var resultsList = results.ToList(); 247 var counter = resultsList.Count - 1; 248 for (var i = 0; i < matrix.Rows; i++) { 249 if (string.IsNullOrEmpty(matrix[i, 0])) { 250 matrix[i, 0] = resultsList[counter].Key; 251 matrix[i, 1] = resultsList[counter].Value.GetValue(); 252 matrix[i, 2] = resultsList[counter].Value.GetType().Name; 253 resultsList.RemoveAt(counter); 254 counter--; 255 if (counter < 0) return; 256 } 238 257 } 239 }240 if (counter >= 0) {241 ((IStringConvertibleMatrix)matrix).Rows += counter + 1;242 for (var i = matrix.Rows - 1; counter >= 0; i--) {243 matrix[i, 0] = resultsList[0].Key;244 matrix[i, 1] = resultsList[0].Value.GetValue();245 matrix[i, 2] = resultsList[0].Value.GetType().Name;246 resultsList.RemoveAt(0);247 counter--;258 if (counter >= 0) { 259 ((IStringConvertibleMatrix)matrix).Rows += counter + 1; 260 for (var i = matrix.Rows - 1; counter >= 0; i--) { 261 matrix[i, 0] = resultsList[0].Key; 262 matrix[i, 1] = resultsList[0].Value.GetValue(); 263 matrix[i, 2] = resultsList[0].Value.GetType().Name; 264 resultsList.RemoveAt(0); 265 counter--; 266 } 248 267 } 249 } 250 characteristicsMatrixView.Content = matrix; 251 SetEnabledStateOfControls(); 268 } finally { 269 characteristicsMatrixView.Content = matrix; 270 SetEnabledStateOfControls(); 271 } 252 272 } 253 273 #endregion … … 261 281 #endregion 262 282 283 private void refreshSolutionsButton_Click(object sender, EventArgs e) { 284 Content.RefreshSolutions(); 285 } 286 287 private void uploadSolutionsButton_Click(object sender, EventArgs e) { 288 foreach (var solution in Content.Solutions.Where(x => x.SolutionId == -1)) 289 solution.Upload(); 290 SetEnabledStateOfControls(); 291 } 292 263 293 } 264 294 }
Note: See TracChangeset
for help on using the changeset viewer.