- Timestamp:
- 08/13/15 16:05:08 (9 years ago)
- Location:
- branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Views/3.3
- Files:
-
- 1 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Views/3.3/ExpertSystemView.Designer.cs
r12847 r12860 21 21 22 22 namespace HeuristicLab.OptimizationExpertSystem.Views { 23 partial class ExpertSystem OptimizerView {23 partial class ExpertSystemView { 24 24 /// <summary> 25 25 /// Required designer variable. … … 48 48 this.runsView = new HeuristicLab.Optimization.Views.RunCollectionView(); 49 49 this.okbTabPage = new System.Windows.Forms.TabPage(); 50 this.okbRunCollectionView = new HeuristicLab.Optimization.Views.RunCollectionView();51 50 this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); 51 this.algorithmInstancesViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 52 52 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 53 53 this.tabControl.SuspendLayout(); … … 58 58 this.SuspendLayout(); 59 59 // 60 // startButton61 //62 this.startButton.Location = new System.Drawing.Point(0, 440);63 this.startButton.TabIndex = 18;64 this.toolTip.SetToolTip(this.startButton, "Start/Resume Optimizer");65 //66 // executionTimeTextBox67 //68 this.executionTimeTextBox.Location = new System.Drawing.Point(412, 444);69 this.executionTimeTextBox.TabIndex = 23;70 //71 // executionTimeLabel72 //73 this.executionTimeLabel.Location = new System.Drawing.Point(323, 447);74 this.executionTimeLabel.TabIndex = 22;75 //76 // pauseButton77 //78 this.pauseButton.Location = new System.Drawing.Point(30, 440);79 this.pauseButton.TabIndex = 19;80 this.toolTip.SetToolTip(this.pauseButton, "Pause Optimizer");81 //82 // stopButton83 //84 this.stopButton.Location = new System.Drawing.Point(60, 440);85 this.stopButton.TabIndex = 20;86 this.toolTip.SetToolTip(this.stopButton, "Stop Optimizer");87 //88 // resetButton89 //90 this.resetButton.Location = new System.Drawing.Point(90, 440);91 this.resetButton.TabIndex = 21;92 this.toolTip.SetToolTip(this.resetButton, "Reset Optimizer");93 //94 60 // nameTextBox 95 61 // … … 135 101 this.tabControl.Name = "tabControl"; 136 102 this.tabControl.SelectedIndex = 0; 137 this.tabControl.Size = new System.Drawing.Size(546, 3 82);103 this.tabControl.Size = new System.Drawing.Size(546, 361); 138 104 this.tabControl.TabIndex = 17; 139 105 // … … 147 113 this.problemTabPage.Name = "problemTabPage"; 148 114 this.problemTabPage.Padding = new System.Windows.Forms.Padding(3); 149 this.problemTabPage.Size = new System.Drawing.Size(538, 3 56);115 this.problemTabPage.Size = new System.Drawing.Size(538, 335); 150 116 this.problemTabPage.TabIndex = 1; 151 117 this.problemTabPage.Text = "Problem"; … … 166 132 this.problemViewHost.Name = "problemViewHost"; 167 133 this.problemViewHost.ReadOnly = false; 168 this.problemViewHost.Size = new System.Drawing.Size(526, 314);134 this.problemViewHost.Size = new System.Drawing.Size(526, 293); 169 135 this.problemViewHost.TabIndex = 2; 170 136 this.problemViewHost.ViewsLabelVisible = true; … … 201 167 this.algorithmTabPage.Name = "algorithmTabPage"; 202 168 this.algorithmTabPage.Padding = new System.Windows.Forms.Padding(3); 203 this.algorithmTabPage.Size = new System.Drawing.Size(538, 3 56);169 this.algorithmTabPage.Size = new System.Drawing.Size(538, 335); 204 170 this.algorithmTabPage.TabIndex = 4; 205 171 this.algorithmTabPage.Text = "Algorithm"; … … 217 183 this.algorithmViewHost.Name = "algorithmViewHost"; 218 184 this.algorithmViewHost.ReadOnly = false; 219 this.algorithmViewHost.Size = new System.Drawing.Size(526, 314);185 this.algorithmViewHost.Size = new System.Drawing.Size(526, 293); 220 186 this.algorithmViewHost.TabIndex = 2; 221 187 this.algorithmViewHost.ViewsLabelVisible = true; … … 249 215 this.runsTabPage.Name = "runsTabPage"; 250 216 this.runsTabPage.Padding = new System.Windows.Forms.Padding(3); 251 this.runsTabPage.Size = new System.Drawing.Size(538, 3 56);217 this.runsTabPage.Size = new System.Drawing.Size(538, 335); 252 218 this.runsTabPage.TabIndex = 3; 253 219 this.runsTabPage.Text = "Runs"; … … 262 228 this.runsView.Name = "runsView"; 263 229 this.runsView.ReadOnly = false; 264 this.runsView.Size = new System.Drawing.Size(532, 3 50);230 this.runsView.Size = new System.Drawing.Size(532, 329); 265 231 this.runsView.TabIndex = 1; 266 232 // 267 233 // okbTabPage 268 234 // 269 this.okbTabPage.Controls.Add(this. okbRunCollectionView);235 this.okbTabPage.Controls.Add(this.algorithmInstancesViewHost); 270 236 this.okbTabPage.Location = new System.Drawing.Point(4, 22); 271 237 this.okbTabPage.Name = "okbTabPage"; 272 238 this.okbTabPage.Padding = new System.Windows.Forms.Padding(3); 273 this.okbTabPage.Size = new System.Drawing.Size(538, 3 56);239 this.okbTabPage.Size = new System.Drawing.Size(538, 335); 274 240 this.okbTabPage.TabIndex = 5; 275 241 this.okbTabPage.Text = "Knowledge Base"; 276 242 this.okbTabPage.UseVisualStyleBackColor = true; 277 //278 // okbRunCollectionView279 //280 this.okbRunCollectionView.Caption = "RunCollection View";281 this.okbRunCollectionView.Content = null;282 this.okbRunCollectionView.Dock = System.Windows.Forms.DockStyle.Fill;283 this.okbRunCollectionView.Location = new System.Drawing.Point(3, 3);284 this.okbRunCollectionView.Name = "okbRunCollectionView";285 this.okbRunCollectionView.ReadOnly = false;286 this.okbRunCollectionView.Size = new System.Drawing.Size(532, 350);287 this.okbRunCollectionView.TabIndex = 0;288 243 // 289 244 // openFileDialog … … 293 248 this.openFileDialog.Filter = "HeuristicLab Files|*.hl|All Files|*.*"; 294 249 this.openFileDialog.Title = "Open Optimizer"; 250 // 251 // algorithmInstancesViewHost 252 // 253 this.algorithmInstancesViewHost.Caption = "View"; 254 this.algorithmInstancesViewHost.Content = null; 255 this.algorithmInstancesViewHost.Dock = System.Windows.Forms.DockStyle.Fill; 256 this.algorithmInstancesViewHost.Enabled = false; 257 this.algorithmInstancesViewHost.Location = new System.Drawing.Point(3, 3); 258 this.algorithmInstancesViewHost.Name = "algorithmInstancesViewHost"; 259 this.algorithmInstancesViewHost.ReadOnly = false; 260 this.algorithmInstancesViewHost.Size = new System.Drawing.Size(532, 329); 261 this.algorithmInstancesViewHost.TabIndex = 0; 262 this.algorithmInstancesViewHost.ViewsLabelVisible = true; 263 this.algorithmInstancesViewHost.ViewType = null; 295 264 // 296 265 // ExpertSystemOptimizerView … … 301 270 this.Controls.Add(this.maxEvaluationsTextBox); 302 271 this.Name = "ExpertSystemOptimizerView"; 303 this.Size = new System.Drawing.Size(549, 4 64);272 this.Size = new System.Drawing.Size(549, 413); 304 273 this.Controls.SetChildIndex(this.maxEvaluationsTextBox, 0); 305 274 this.Controls.SetChildIndex(this.evaluationsLimitabel, 0); … … 308 277 this.Controls.SetChildIndex(this.nameTextBox, 0); 309 278 this.Controls.SetChildIndex(this.infoLabel, 0); 310 this.Controls.SetChildIndex(this.resetButton, 0);311 this.Controls.SetChildIndex(this.stopButton, 0);312 this.Controls.SetChildIndex(this.pauseButton, 0);313 this.Controls.SetChildIndex(this.executionTimeLabel, 0);314 this.Controls.SetChildIndex(this.executionTimeTextBox, 0);315 this.Controls.SetChildIndex(this.startButton, 0);316 279 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 317 280 this.tabControl.ResumeLayout(false); … … 343 306 private System.Windows.Forms.ComboBox suggestedInstancesComboBox; 344 307 private System.Windows.Forms.TabPage okbTabPage; 345 private Optimization.Views.RunCollectionView okbRunCollectionView;308 private MainForm.WindowsForms.ViewHost algorithmInstancesViewHost; 346 309 } 347 310 } -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Views/3.3/ExpertSystemView.cs
r12847 r12860 22 22 using System; 23 23 using System.ComponentModel; 24 using System.Globalization;25 using System.Linq;26 24 using System.Windows.Forms; 27 using HeuristicLab.Analysis;28 25 using HeuristicLab.Common; 29 using HeuristicLab.Core;30 26 using HeuristicLab.Core.Views; 31 27 using HeuristicLab.MainForm; 32 28 using HeuristicLab.Optimization; 33 using HeuristicLab.Optimization.Views;34 29 using HeuristicLab.PluginInfrastructure; 35 30 36 31 namespace HeuristicLab.OptimizationExpertSystem.Views { 37 32 [View("Expert-system Optimizer View")] 38 [Content(typeof(ExpertSystem Optimizer), IsDefaultView = true)]39 public partial class ExpertSystem OptimizerView : IOptimizerView {33 [Content(typeof(ExpertSystem), IsDefaultView = true)] 34 public partial class ExpertSystemView : NamedItemView { 40 35 protected TypeSelectorDialog problemTypeSelectorDialog; 41 36 protected virtual bool SuppressEvents { get; set; } 42 37 43 public new ExpertSystem OptimizerContent {44 get { return (ExpertSystem Optimizer)base.Content; }38 public new ExpertSystem Content { 39 get { return (ExpertSystem)base.Content; } 45 40 set { base.Content = value; } 46 41 } 47 42 48 public ExpertSystem OptimizerView() {43 public ExpertSystemView() { 49 44 InitializeComponent(); 50 45 } … … 87 82 algorithmViewHost.Content = null; 88 83 runsView.Content = null; 89 okbRunCollectionView.Content = null;84 algorithmInstancesViewHost.Content = null; 90 85 } else { 91 86 maxEvaluationsTextBox.Text = Content.MaximumEvaluations.ToString(); 92 87 problemViewHost.Content = Content.Problem; 93 88 runsView.Content = Content.Runs; 94 okbRunCollectionView.Content = Content.KnowledgeBase;89 algorithmInstancesViewHost.Content = Content.AlgorithmInstances; 95 90 } 96 UpdateSuggestedInstancesCombobox();97 91 } finally { SuppressEvents = false; } 92 UpdateSuggestedInstancesCombobox(); 98 93 } 99 94 … … 107 102 algorithmViewHost.Enabled = Content != null && !ReadOnly && !Locked; 108 103 runsView.Enabled = Content != null; 109 okbRunCollectionView.Enabled = Content != null; 110 } 111 112 protected override void OnClosed(FormClosedEventArgs e) { 113 if ((Content != null) && (Content.ExecutionState == ExecutionState.Started)) { 114 //The content must be stopped if no other view showing the content is available 115 var optimizers = MainFormManager.MainForm.Views.OfType<IContentView>().Where(v => v != this).Select(v => v.Content).OfType<IOptimizer>(); 116 if (!optimizers.Contains(Content)) { 117 var nestedOptimizers = optimizers.SelectMany(opt => opt.NestedOptimizers); 118 if (!nestedOptimizers.Contains(Content)) Content.Stop(); 119 } 120 } 121 base.OnClosed(e); 104 algorithmInstancesViewHost.Enabled = Content != null; 122 105 } 123 106 124 107 private void UpdateSuggestedInstancesCombobox() { 125 SuspendRepaint(); 126 try { 127 var prevSelection = (IAlgorithm)suggestedInstancesComboBox.SelectedItem; 128 var prevNewIndex = -1; 129 suggestedInstancesComboBox.Items.Clear(); 130 if (Content == null) return; 131 132 for (var i = 0; i < Content.SuggestedInstances.Count; i++) { 133 suggestedInstancesComboBox.Items.Add(Content.SuggestedInstances[i]); 134 if (prevSelection == null || Content.SuggestedInstances[i].Name == prevSelection.Name) 135 prevNewIndex = prevSelection == null ? 0 : i; 136 } 137 if (prevNewIndex >= 0) { 138 suggestedInstancesComboBox.SelectedIndex = prevNewIndex; 139 } 140 } finally { ResumeRepaint(true); } 108 var prevSelection = (IAlgorithm)suggestedInstancesComboBox.SelectedItem; 109 var prevNewIndex = -1; 110 suggestedInstancesComboBox.Items.Clear(); 111 if (Content == null) return; 112 113 for (var i = 0; i < Content.SuggestedInstances.Count; i++) { 114 suggestedInstancesComboBox.Items.Add(Content.SuggestedInstances[i]); 115 if (prevSelection == null || Content.SuggestedInstances[i].Name == prevSelection.Name) 116 prevNewIndex = prevSelection == null ? 0 : i; 117 } 118 if (prevNewIndex >= 0) { 119 suggestedInstancesComboBox.SelectedIndex = prevNewIndex; 120 } 141 121 } 142 122 … … 152 132 switch (e.PropertyName) { 153 133 case "MaximumEvaluations": maxEvaluationsTextBox.Text = Content.MaximumEvaluations.ToString(); break; 154 case "Runs": runsView.Content = Content.Runs; break;155 case "KnowledgeBase": okbRunCollectionView.Content = Content.KnowledgeBase; break;156 134 case "Problem": problemViewHost.Content = Content.Problem; break; 157 135 } … … 160 138 161 139 private void SuggestedInstancesOnChanged(object sender, EventArgs e) { 162 SuppressEvents = true; 163 try { 164 UpdateSuggestedInstancesCombobox(); 165 } finally { SuppressEvents = false; } 140 UpdateSuggestedInstancesCombobox(); 166 141 } 167 142 #endregion … … 189 164 problemTypeSelectorDialog = new TypeSelectorDialog { Caption = "Select Problem" }; 190 165 problemTypeSelectorDialog.TypeSelector.Caption = "Available Problems"; 191 problemTypeSelectorDialog.TypeSelector.Configure(typeof(I Problem)166 problemTypeSelectorDialog.TypeSelector.Configure(typeof(ISingleObjectiveHeuristicOptimizationProblem) 192 167 , showNotInstantiableTypes: false, showGenericTypes: false); 193 168 } 194 169 if (problemTypeSelectorDialog.ShowDialog(this) == DialogResult.OK) { 195 170 try { 196 Content.Problem = (I Problem)problemTypeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType();171 Content.Problem = (ISingleObjectiveHeuristicOptimizationProblem)problemTypeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(); 197 172 } catch (Exception ex) { 198 173 ErrorHandling.ShowErrorDialog(this, ex); … … 210 185 try { 211 186 if (error != null) throw error; 212 var problem = content as I Problem;187 var problem = content as ISingleObjectiveHeuristicOptimizationProblem; 213 188 if (problem == null) { 214 189 var algorithm = content as IAlgorithm; 215 if (algorithm == null || algorithm.Problem == null)190 if (algorithm == null || !(algorithm.Problem is ISingleObjectiveHeuristicOptimizationProblem)) 216 191 MessageBox.Show(this, "The selected file is not a problem, nor an algorithm with a problem.", "Invalid File", MessageBoxButtons.OK, MessageBoxIcon.Error); 217 else Content.Problem = algorithm.Problem;192 else Content.Problem = (ISingleObjectiveHeuristicOptimizationProblem)algorithm.Problem; 218 193 } else 219 194 Content.Problem = problem; … … 232 207 private void problemTabPage_DragEnterOver(object sender, DragEventArgs e) { 233 208 e.Effect = DragDropEffects.None; 234 var prob = e.Data.GetData(Constants.DragDropDataFormat) as I Problem;209 var prob = e.Data.GetData(Constants.DragDropDataFormat) as ISingleObjectiveHeuristicOptimizationProblem; 235 210 if (!ReadOnly && prob != null) { 236 211 if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link; // ALT key … … 244 219 private void problemTabPage_DragDrop(object sender, DragEventArgs e) { 245 220 if (e.Effect != DragDropEffects.None) { 246 var prob = e.Data.GetData(Constants.DragDropDataFormat) as I Problem;247 if (e.Effect.HasFlag(DragDropEffects.Copy)) prob = (I Problem)prob.Clone();221 var prob = e.Data.GetData(Constants.DragDropDataFormat) as ISingleObjectiveHeuristicOptimizationProblem; 222 if (e.Effect.HasFlag(DragDropEffects.Copy)) prob = (ISingleObjectiveHeuristicOptimizationProblem)prob.Clone(); 248 223 Content.Problem = prob; 249 224 } -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Views/3.3/HeuristicLab.OptimizationExpertSystem.Views-3.3.csproj
r12847 r12860 134 134 </ItemGroup> 135 135 <ItemGroup> 136 <Compile Include="ExpertSystem OptimizerView.cs">136 <Compile Include="ExpertSystemView.cs"> 137 137 <SubType>UserControl</SubType> 138 138 </Compile> 139 <Compile Include="ExpertSystem OptimizerView.Designer.cs">140 <DependentUpon>ExpertSystem OptimizerView.cs</DependentUpon>139 <Compile Include="ExpertSystemView.Designer.cs"> 140 <DependentUpon>ExpertSystemView.cs</DependentUpon> 141 141 </Compile> 142 142 <Compile Include="Plugin.cs" />
Note: See TracChangeset
for help on using the changeset viewer.