Changeset 13691
- Timestamp:
- 03/11/16 15:29:05 (9 years ago)
- Location:
- trunk/sources
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Clients.OKB.Views/3.3/RunCreation/Views/OKBProblemView.Designer.cs
r13666 r13691 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 -
trunk/sources/HeuristicLab.Clients.OKB.Views/3.3/RunCreation/Views/OKBProblemView.cs
r13684 r13691 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 SetEnabledStateOfControls(); 95 107 } 96 108 … … 100 112 problemComboBox.SelectedIndex = -1; 101 113 parameterCollectionView.Content = null; 114 solutionsViewHost.Content = null; 102 115 } else { 103 116 problemComboBox.SelectedItem = RunCreationClient.Instance.Problems.FirstOrDefault(x => x.Id == Content.ProblemId); 104 117 parameterCollectionView.Content = Content.Parameters; 118 solutionsViewHost.Content = Content.Solutions; 105 119 } 106 120 UpdateCharacteristicCalculators(); … … 118 132 && characteristicsMatrixView.Content != null && characteristicsMatrixView.Content.Rows > 0; 119 133 calculateButton.Enabled = Content != null && Content.ProblemId != -1 && !Locked && !ReadOnly && calculatorList.CheckedItems.Any(); 134 refreshSolutionsButton.Enabled = Content != null && !ReadOnly && !Locked && Content.ProblemId != -1; 135 uploadSolutionsButton.Enabled = Content != null && !ReadOnly && !Locked && Content.ProblemId != -1 && Content.Solutions.Any(x => x.SolutionId == -1); 120 136 } 121 137 … … 217 233 } 218 234 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]); 235 try { 236 for (var i = 0; i < matrix.Rows; i++) { 237 Value r; 238 if (results.TryGetValue(matrix[i, 0], out r)) { 239 matrix[i, 1] = r.GetValue(); 240 matrix[i, 2] = r.GetType().Name; 241 results.Remove(matrix[i, 0]); 242 } 225 243 } 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;244 if (results.Count == 0) return; 245 var resultsList = results.ToList(); 246 var counter = resultsList.Count - 1; 247 for (var i = 0; i < matrix.Rows; i++) { 248 if (string.IsNullOrEmpty(matrix[i, 0])) { 249 matrix[i, 0] = resultsList[counter].Key; 250 matrix[i, 1] = resultsList[counter].Value.GetValue(); 251 matrix[i, 2] = resultsList[counter].Value.GetType().Name; 252 resultsList.RemoveAt(counter); 253 counter--; 254 if (counter < 0) return; 255 } 238 256 } 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--;257 if (counter >= 0) { 258 ((IStringConvertibleMatrix)matrix).Rows += counter + 1; 259 for (var i = matrix.Rows - 1; counter >= 0; i--) { 260 matrix[i, 0] = resultsList[0].Key; 261 matrix[i, 1] = resultsList[0].Value.GetValue(); 262 matrix[i, 2] = resultsList[0].Value.GetType().Name; 263 resultsList.RemoveAt(0); 264 counter--; 265 } 248 266 } 249 } 250 characteristicsMatrixView.Content = matrix; 251 SetEnabledStateOfControls(); 267 } finally { 268 characteristicsMatrixView.Content = matrix; 269 SetEnabledStateOfControls(); 270 } 252 271 } 253 272 #endregion … … 261 280 #endregion 262 281 282 private void refreshSolutionsButton_Click(object sender, EventArgs e) { 283 Content.RefreshSolutions(); 284 } 285 286 private void uploadSolutionsButton_Click(object sender, EventArgs e) { 287 foreach (var solution in Content.Solutions.Where(x => x.SolutionId == -1)) 288 solution.Upload(); 289 } 290 263 291 } 264 292 } -
trunk/sources/HeuristicLab.Clients.OKB/3.3/HeuristicLab.Clients.OKB-3.3.csproj
r13534 r13691 114 114 <Compile Include="Administration\ServiceClient\ProblemClass.cs" /> 115 115 <Compile Include="OKBRoles.cs" /> 116 <Compile Include="RunCreation\OKBSolution.cs" /> 116 117 <Compile Include="Plugin.cs" /> 117 118 <Compile Include="Query\QueryClient.cs" /> … … 156 157 <Compile Include="RunCreation\OKBProblem.cs" /> 157 158 <Compile Include="RunCreation\OKBRun.cs" /> 159 <Compile Include="RunCreation\SingleObjectiveOKBSolution.cs" /> 158 160 <Compile Include="RunCreation\RunCreationClient.cs" /> 159 161 <Compile Include="RunCreation\ServiceClient\Algorithm.cs" /> -
trunk/sources/HeuristicLab.Clients.OKB/3.3/RunCreation/OKBProblem.cs
r13684 r13691 29 29 using System.Drawing; 30 30 using System.IO; 31 using System.Linq; 31 32 32 33 namespace HeuristicLab.Clients.OKB.RunCreation { … … 63 64 OnOperatorsChanged(); 64 65 OnReset(); 66 67 solutions.Clear(); 65 68 } 66 69 } 67 70 } 71 } 72 73 [Storable] 74 private ItemList<OKBSolution> solutions; 75 public ItemList<OKBSolution> Solutions { 76 get { return solutions; } 68 77 } 69 78 … … 135 144 problemId = original.problemId; 136 145 problem = cloner.Clone(original.problem); 146 solutions = cloner.Clone(original.solutions); 137 147 RegisterProblemEvents(); 138 148 } … … 142 152 problemId = -1; 143 153 problem = initialProblem; 154 solutions = new ItemList<OKBSolution>(); 144 155 RegisterProblemEvents(); 145 156 } … … 159 170 } 160 171 172 public void RefreshSolutions() { 173 Solutions.Clear(); 174 if (ProblemId != -1) { 175 Solutions.AddRange(RunCreationClient.Instance.GetSolutions(ProblemId).Select(OKBSolution.Convert)); 176 } 177 } 178 161 179 public IProblem CloneProblem() { 162 180 return (IProblem)Problem.Clone();
Note: See TracChangeset
for help on using the changeset viewer.