Changeset 3262 for trunk/sources/HeuristicLab.Optimization.Views
- Timestamp:
- 04/04/10 05:22:47 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Optimization.Views/3.3
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization.Views/3.3/AlgorithmView.Designer.cs
r3226 r3262 57 57 this.resultsView = new HeuristicLab.Optimization.Views.ResultCollectionView(); 58 58 this.startButton = new System.Windows.Forms.Button(); 59 this. stopButton = new System.Windows.Forms.Button();59 this.pauseButton = new System.Windows.Forms.Button(); 60 60 this.resetButton = new System.Windows.Forms.Button(); 61 61 this.executionTimeLabel = new System.Windows.Forms.Label(); … … 63 63 this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); 64 64 this.saveFileDialog = new System.Windows.Forms.SaveFileDialog(); 65 this.stopButton = new System.Windows.Forms.Button(); 65 66 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 66 67 this.tabControl.SuspendLayout(); … … 211 212 this.startButton.Click += new System.EventHandler(this.startButton_Click); 212 213 // 213 // stopButton214 // 215 this. stopButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));216 this. stopButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Pause;217 this. stopButton.Location = new System.Drawing.Point(30, 458);218 this. stopButton.Name = "stopButton";219 this. stopButton.Size = new System.Drawing.Size(24, 24);220 this. stopButton.TabIndex = 6;221 this.toolTip.SetToolTip(this. stopButton, "Pause Algorithm");222 this. stopButton.UseVisualStyleBackColor = true;223 this. stopButton.Click += new System.EventHandler(this.stopButton_Click);214 // pauseButton 215 // 216 this.pauseButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 217 this.pauseButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Pause; 218 this.pauseButton.Location = new System.Drawing.Point(30, 458); 219 this.pauseButton.Name = "pauseButton"; 220 this.pauseButton.Size = new System.Drawing.Size(24, 24); 221 this.pauseButton.TabIndex = 6; 222 this.toolTip.SetToolTip(this.pauseButton, "Pause Algorithm"); 223 this.pauseButton.UseVisualStyleBackColor = true; 224 this.pauseButton.Click += new System.EventHandler(this.pauseButton_Click); 224 225 // 225 226 // resetButton … … 227 228 this.resetButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 228 229 this.resetButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Restart; 229 this.resetButton.Location = new System.Drawing.Point( 60, 458);230 this.resetButton.Location = new System.Drawing.Point(90, 458); 230 231 this.resetButton.Name = "resetButton"; 231 232 this.resetButton.Size = new System.Drawing.Size(24, 24); 232 this.resetButton.TabIndex = 7;233 this.resetButton.TabIndex = 8; 233 234 this.toolTip.SetToolTip(this.resetButton, "Reset Algorithm"); 234 235 this.resetButton.UseVisualStyleBackColor = true; … … 242 243 this.executionTimeLabel.Name = "executionTimeLabel"; 243 244 this.executionTimeLabel.Size = new System.Drawing.Size(83, 13); 244 this.executionTimeLabel.TabIndex = 8;245 this.executionTimeLabel.TabIndex = 9; 245 246 this.executionTimeLabel.Text = "&Execution Time:"; 246 247 // … … 252 253 this.executionTimeTextBox.ReadOnly = true; 253 254 this.executionTimeTextBox.Size = new System.Drawing.Size(137, 20); 254 this.executionTimeTextBox.TabIndex = 9;255 this.executionTimeTextBox.TabIndex = 10; 255 256 // 256 257 // openFileDialog … … 269 270 this.saveFileDialog.Title = "Save Problem"; 270 271 // 272 // stopButton 273 // 274 this.stopButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 275 this.stopButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Stop; 276 this.stopButton.Location = new System.Drawing.Point(60, 458); 277 this.stopButton.Name = "stopButton"; 278 this.stopButton.Size = new System.Drawing.Size(24, 24); 279 this.stopButton.TabIndex = 7; 280 this.toolTip.SetToolTip(this.stopButton, "Stop Algorithm"); 281 this.stopButton.UseVisualStyleBackColor = true; 282 this.stopButton.Click += new System.EventHandler(this.stopButton_Click); 283 // 271 284 // AlgorithmView 272 285 // … … 275 288 this.Controls.Add(this.tabControl); 276 289 this.Controls.Add(this.startButton); 277 this.Controls.Add(this. stopButton);290 this.Controls.Add(this.pauseButton); 278 291 this.Controls.Add(this.executionTimeTextBox); 279 292 this.Controls.Add(this.executionTimeLabel); 293 this.Controls.Add(this.stopButton); 280 294 this.Controls.Add(this.resetButton); 281 295 this.Name = "AlgorithmView"; 282 296 this.Size = new System.Drawing.Size(679, 482); 283 297 this.Controls.SetChildIndex(this.resetButton, 0); 298 this.Controls.SetChildIndex(this.stopButton, 0); 284 299 this.Controls.SetChildIndex(this.executionTimeLabel, 0); 285 300 this.Controls.SetChildIndex(this.executionTimeTextBox, 0); 286 this.Controls.SetChildIndex(this. stopButton, 0);301 this.Controls.SetChildIndex(this.pauseButton, 0); 287 302 this.Controls.SetChildIndex(this.startButton, 0); 288 303 this.Controls.SetChildIndex(this.tabControl, 0); … … 312 327 protected System.Windows.Forms.Button openProblemButton; 313 328 protected System.Windows.Forms.Button startButton; 314 protected System.Windows.Forms.Button stopButton;329 protected System.Windows.Forms.Button pauseButton; 315 330 protected System.Windows.Forms.Button resetButton; 316 331 protected System.Windows.Forms.Label executionTimeLabel; … … 320 335 protected System.Windows.Forms.TabPage resultsTabPage; 321 336 protected HeuristicLab.Optimization.Views.ResultCollectionView resultsView; 337 protected System.Windows.Forms.Button stopButton; 322 338 323 339 } -
trunk/sources/HeuristicLab.Optimization.Views/3.3/AlgorithmView.cs
r3261 r3262 24 24 using System.Windows.Forms; 25 25 using HeuristicLab.Common; 26 using HeuristicLab.Core; 26 27 using HeuristicLab.Core.Views; 27 28 using HeuristicLab.MainForm; … … 37 38 public partial class AlgorithmView : NamedItemView { 38 39 private TypeSelectorDialog problemTypeSelectorDialog; 39 private int executionTimeCounter;40 40 41 41 public new IAlgorithm Content { … … 75 75 protected override void DeregisterContentEvents() { 76 76 Content.ExceptionOccurred -= new EventHandler<EventArgs<Exception>>(Content_ExceptionOccurred); 77 Content.ExecutionStateChanged -= new EventHandler(Content_ExecutionStateChanged); 77 78 Content.ExecutionTimeChanged -= new EventHandler(Content_ExecutionTimeChanged); 78 79 Content.Prepared -= new EventHandler(Content_Prepared); 79 80 Content.ProblemChanged -= new EventHandler(Content_ProblemChanged); 80 Content.RunningChanged -= new EventHandler(Content_RunningChanged);81 81 base.DeregisterContentEvents(); 82 82 } … … 84 84 base.RegisterContentEvents(); 85 85 Content.ExceptionOccurred += new EventHandler<EventArgs<Exception>>(Content_ExceptionOccurred); 86 Content.ExecutionStateChanged += new EventHandler(Content_ExecutionStateChanged); 86 87 Content.ExecutionTimeChanged += new EventHandler(Content_ExecutionTimeChanged); 87 88 Content.Prepared += new EventHandler(Content_Prepared); 88 89 Content.ProblemChanged += new EventHandler(Content_ProblemChanged); 89 Content.RunningChanged += new EventHandler(Content_RunningChanged);90 90 } 91 91 92 92 protected override void OnContentChanged() { 93 93 base.OnContentChanged(); 94 stopButton.Enabled = false;95 94 if (Content == null) { 96 95 parameterCollectionView.Content = null; … … 98 97 resultsView.Content = null; 99 98 tabControl.Enabled = false; 100 startButton.Enabled = resetButton.Enabled = false;99 startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = resetButton.Enabled = false; 101 100 executionTimeTextBox.Text = "-"; 102 101 executionTimeTextBox.Enabled = false; … … 108 107 resultsView.Content = Content.Results.AsReadOnly(); 109 108 tabControl.Enabled = true; 110 startButton.Enabled = !Content.Finished; 111 resetButton.Enabled = true; 112 UpdateExecutionTimeTextBox(); 109 EnableDisableButtons(); 110 executionTimeTextBox.Text = Content.ExecutionTime.ToString(); 113 111 executionTimeTextBox.Enabled = true; 114 112 } … … 116 114 117 115 protected override void OnClosed(FormClosedEventArgs e) { 118 if ( Content != null) Content.Stop();116 if ((Content != null) && (Content.ExecutionState == ExecutionState.Started)) Content.Stop(); 119 117 base.OnClosed(e); 120 118 } 121 119 122 120 #region Content Events 123 protected virtual void Content_Prepared(object sender, EventArgs e) {124 if (InvokeRequired)125 Invoke(new EventHandler(Content_Prepared), sender, e);126 else {127 executionTimeCounter = 0;128 resultsView.Content = Content.Results.AsReadOnly();129 startButton.Enabled = !Content.Finished;130 UpdateExecutionTimeTextBox();131 }132 }133 121 protected virtual void Content_ProblemChanged(object sender, EventArgs e) { 134 122 if (InvokeRequired) … … 140 128 } 141 129 } 142 protected virtual void Content_RunningChanged(object sender, EventArgs e) { 143 if (InvokeRequired) 144 Invoke(new EventHandler(Content_RunningChanged), sender, e); 130 protected virtual void Content_Prepared(object sender, EventArgs e) { 131 if (InvokeRequired) 132 Invoke(new EventHandler(Content_Prepared), sender, e); 133 else 134 resultsView.Content = Content.Results.AsReadOnly(); 135 } 136 protected virtual void Content_ExecutionStateChanged(object sender, EventArgs e) { 137 if (InvokeRequired) 138 Invoke(new EventHandler(Content_ExecutionStateChanged), sender, e); 145 139 else { 146 SaveEnabled = !Content.Running; 147 parameterCollectionView.Enabled = !Content.Running; 148 newProblemButton.Enabled = openProblemButton.Enabled = saveProblemButton.Enabled = !Content.Running; 149 problemViewHost.Enabled = !Content.Running; 150 resultsView.Enabled = !Content.Running; 151 startButton.Enabled = !Content.Running && !Content.Finished; 152 stopButton.Enabled = Content.Running; 153 resetButton.Enabled = !Content.Running; 154 UpdateExecutionTimeTextBox(); 140 SaveEnabled = Content.ExecutionState != ExecutionState.Started; 141 parameterCollectionView.Enabled = Content.ExecutionState != ExecutionState.Started; 142 newProblemButton.Enabled = openProblemButton.Enabled = saveProblemButton.Enabled = Content.ExecutionState != ExecutionState.Started; 143 problemViewHost.Enabled = Content.ExecutionState != ExecutionState.Started; 144 resultsView.Enabled = Content.ExecutionState != ExecutionState.Started; 145 EnableDisableButtons(); 155 146 } 156 147 } 157 148 protected virtual void Content_ExecutionTimeChanged(object sender, EventArgs e) { 158 executionTimeCounter++; 159 if ((executionTimeCounter >= 100) || !Content.Running) { 160 executionTimeCounter = 0; 161 UpdateExecutionTimeTextBox(); 162 } 149 if (InvokeRequired) 150 Invoke(new EventHandler(Content_ExecutionTimeChanged), sender, e); 151 else 152 executionTimeTextBox.Text = Content.ExecutionTime.ToString(); 163 153 } 164 154 protected virtual void Content_ExceptionOccurred(object sender, EventArgs<Exception> e) { … … 238 228 Content.Start(); 239 229 } 230 protected virtual void pauseButton_Click(object sender, EventArgs e) { 231 Content.Pause(); 232 } 240 233 protected virtual void stopButton_Click(object sender, EventArgs e) { 241 234 Content.Stop(); … … 247 240 248 241 #region Helpers 249 pr otected virtual void UpdateExecutionTimeTextBox() {250 if (InvokeRequired)251 Invoke(new Action(UpdateExecutionTimeTextBox));252 else253 executionTimeTextBox.Text = Content.ExecutionTime.ToString();242 private void EnableDisableButtons() { 243 startButton.Enabled = (Content.ExecutionState == ExecutionState.Prepared) || (Content.ExecutionState == ExecutionState.Paused); 244 pauseButton.Enabled = Content.ExecutionState == ExecutionState.Started; 245 stopButton.Enabled = (Content.ExecutionState == ExecutionState.Started) || (Content.ExecutionState == ExecutionState.Paused); 246 resetButton.Enabled = Content.ExecutionState != ExecutionState.Started; 254 247 } 255 248 #endregion -
trunk/sources/HeuristicLab.Optimization.Views/3.3/EngineAlgorithmView.Designer.cs
r3225 r3262 98 98 // 99 99 this.startButton.Location = new System.Drawing.Point(0, 525); 100 this.toolTip.SetToolTip(this.startButton, "Start/Resume Algorithm"); 101 // 102 // pauseButton 103 // 104 this.pauseButton.Location = new System.Drawing.Point(30, 525); 105 this.toolTip.SetToolTip(this.pauseButton, "Pause Algorithm"); 106 // 107 // resetButton 108 // 109 this.resetButton.Location = new System.Drawing.Point(90, 525); 110 this.toolTip.SetToolTip(this.resetButton, "Reset Algorithm"); 111 // 112 // executionTimeLabel 113 // 114 this.executionTimeLabel.Location = new System.Drawing.Point(487, 532); 115 this.executionTimeLabel.TabIndex = 10; 116 // 117 // executionTimeTextBox 118 // 119 this.executionTimeTextBox.Location = new System.Drawing.Point(576, 529); 120 this.executionTimeTextBox.TabIndex = 11; 121 // 122 // resultsTabPage 123 // 124 this.resultsTabPage.Size = new System.Drawing.Size(705, 441); 125 // 126 // resultsView 127 // 128 this.resultsView.Size = new System.Drawing.Size(693, 429); 100 129 // 101 130 // stopButton 102 131 // 103 this.stopButton.Location = new System.Drawing.Point(30, 525); 104 // 105 // resetButton 106 // 107 this.resetButton.Location = new System.Drawing.Point(60, 525); 108 // 109 // executionTimeLabel 110 // 111 this.executionTimeLabel.Location = new System.Drawing.Point(487, 532); 112 this.executionTimeLabel.TabIndex = 9; 113 // 114 // executionTimeTextBox 115 // 116 this.executionTimeTextBox.Location = new System.Drawing.Point(576, 529); 117 this.executionTimeTextBox.TabIndex = 10; 118 // 119 // resultsTabPage 120 // 121 this.resultsTabPage.Size = new System.Drawing.Size(705, 441); 122 // 123 // resultsView 124 // 125 this.resultsView.Size = new System.Drawing.Size(693, 429); 132 this.stopButton.Location = new System.Drawing.Point(60, 525); 133 this.toolTip.SetToolTip(this.stopButton, "Stop Algorithm"); 126 134 // 127 135 // nameTextBox … … 147 155 // 148 156 this.createUserDefinedAlgorithmButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 149 this.createUserDefinedAlgorithmButton.Location = new System.Drawing.Point( 90, 525);157 this.createUserDefinedAlgorithmButton.Location = new System.Drawing.Point(150, 525); 150 158 this.createUserDefinedAlgorithmButton.Name = "createUserDefinedAlgorithmButton"; 151 159 this.createUserDefinedAlgorithmButton.Size = new System.Drawing.Size(254, 24); 152 this.createUserDefinedAlgorithmButton.TabIndex = 8;160 this.createUserDefinedAlgorithmButton.TabIndex = 9; 153 161 this.createUserDefinedAlgorithmButton.Text = "&Create User Defined Algorithm"; 154 162 this.toolTip.SetToolTip(this.createUserDefinedAlgorithmButton, "Create User Defined Algorithm from this Algorithm"); … … 164 172 this.engineComboBox.Location = new System.Drawing.Point(55, 6); 165 173 this.engineComboBox.Name = "engineComboBox"; 166 this.engineComboBox.Size = new System.Drawing.Size(6 44, 21);174 this.engineComboBox.Size = new System.Drawing.Size(610, 21); 167 175 this.engineComboBox.TabIndex = 1; 168 176 this.engineComboBox.SelectedIndexChanged += new System.EventHandler(this.engineComboBox_SelectedIndexChanged); … … 189 197 this.engineViewHost.Location = new System.Drawing.Point(6, 33); 190 198 this.engineViewHost.Name = "engineViewHost"; 191 this.engineViewHost.Size = new System.Drawing.Size(6 93, 402);199 this.engineViewHost.Size = new System.Drawing.Size(659, 335); 192 200 this.engineViewHost.TabIndex = 2; 193 201 this.engineViewHost.ViewType = null; … … 200 208 this.Name = "EngineAlgorithmView"; 201 209 this.Size = new System.Drawing.Size(713, 549); 210 this.Controls.SetChildIndex(this.stopButton, 0); 202 211 this.Controls.SetChildIndex(this.createUserDefinedAlgorithmButton, 0); 203 212 this.Controls.SetChildIndex(this.resetButton, 0); 213 this.Controls.SetChildIndex(this.pauseButton, 0); 204 214 this.Controls.SetChildIndex(this.executionTimeLabel, 0); 205 215 this.Controls.SetChildIndex(this.executionTimeTextBox, 0); 206 this.Controls.SetChildIndex(this.stopButton, 0);207 216 this.Controls.SetChildIndex(this.startButton, 0); 208 217 this.Controls.SetChildIndex(this.tabControl, 0); -
trunk/sources/HeuristicLab.Optimization.Views/3.3/EngineAlgorithmView.cs
r3261 r3262 98 98 } 99 99 100 protected override void Content_ RunningChanged(object sender, EventArgs e) {100 protected override void Content_ExecutionStateChanged(object sender, EventArgs e) { 101 101 if (InvokeRequired) 102 Invoke(new EventHandler(Content_ RunningChanged), sender, e);102 Invoke(new EventHandler(Content_ExecutionStateChanged), sender, e); 103 103 else { 104 createUserDefinedAlgorithmButton.Enabled = !Content.Running;105 engineComboBox.Enabled = !Content.Running;106 engineViewHost.Enabled = !Content.Running;107 base.Content_ RunningChanged(sender, e);104 createUserDefinedAlgorithmButton.Enabled = Content.ExecutionState != ExecutionState.Started; 105 engineComboBox.Enabled = Content.ExecutionState != ExecutionState.Started; 106 engineViewHost.Enabled = Content.ExecutionState != ExecutionState.Started; 107 base.Content_ExecutionStateChanged(sender, e); 108 108 } 109 109 } -
trunk/sources/HeuristicLab.Optimization.Views/3.3/HeuristicLab.Optimization.Views-3.3.csproj
r3260 r3262 92 92 <DependentUpon>AlgorithmView.cs</DependentUpon> 93 93 </Compile> 94 <Compile Include="BatchRunView.cs">95 <SubType>UserControl</SubType>96 </Compile>97 <Compile Include="BatchRunView.Designer.cs">98 <DependentUpon>BatchRunView.cs</DependentUpon>99 </Compile>100 94 <Compile Include="RunCollectionView.cs"> 101 95 <SubType>UserControl</SubType> -
trunk/sources/HeuristicLab.Optimization.Views/3.3/UserDefinedAlgorithmView.Designer.cs
r3225 r3262 45 45 /// </summary> 46 46 private void InitializeComponent() { 47 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UserDefinedAlgorithmView));48 47 this.operatorGraphTabPage = new System.Windows.Forms.TabPage(); 49 48 this.saveOperatorGraphButton = new System.Windows.Forms.Button(); … … 66 65 // 67 66 this.createUserDefinedAlgorithmButton.Enabled = false; 67 this.createUserDefinedAlgorithmButton.Location = new System.Drawing.Point(150, 525); 68 this.createUserDefinedAlgorithmButton.TabIndex = 9; 68 69 this.toolTip.SetToolTip(this.createUserDefinedAlgorithmButton, "Create User Defined Algorithm from this Algorithm"); 69 70 this.createUserDefinedAlgorithmButton.Visible = false; … … 91 92 // 92 93 this.toolTip.SetToolTip(this.openProblemButton, "Open Problem"); 94 // 95 // startButton 96 // 97 this.toolTip.SetToolTip(this.startButton, "Start/Resume Algorithm"); 98 // 99 // pauseButton 100 // 101 this.toolTip.SetToolTip(this.pauseButton, "Pause Algorithm"); 102 // 103 // resetButton 104 // 105 this.resetButton.Location = new System.Drawing.Point(90, 525); 106 this.toolTip.SetToolTip(this.resetButton, "Reset Algorithm"); 107 // 108 // executionTimeLabel 109 // 110 this.executionTimeLabel.TabIndex = 10; 111 // 112 // executionTimeTextBox 113 // 114 this.executionTimeTextBox.TabIndex = 11; 115 // 116 // stopButton 117 // 118 this.stopButton.Location = new System.Drawing.Point(60, 525); 119 this.toolTip.SetToolTip(this.stopButton, "Stop Algorithm"); 93 120 // 94 121 // nameTextBox -
trunk/sources/HeuristicLab.Optimization.Views/3.3/UserDefinedAlgorithmView.cs
r3261 r3262 75 75 } 76 76 77 protected override void Content_ RunningChanged(object sender, EventArgs e) {77 protected override void Content_ExecutionStateChanged(object sender, EventArgs e) { 78 78 if (InvokeRequired) 79 Invoke(new EventHandler(Content_ RunningChanged), sender, e);79 Invoke(new EventHandler(Content_ExecutionStateChanged), sender, e); 80 80 else { 81 newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = saveOperatorGraphButton.Enabled = !Content.Running;82 operatorGraphViewHost.Enabled = !Content.Running;83 globalScopeView.Enabled = !Content.Running;84 base.Content_ RunningChanged(sender, e);81 newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = saveOperatorGraphButton.Enabled = Content.ExecutionState != ExecutionState.Started; 82 operatorGraphViewHost.Enabled = Content.ExecutionState != ExecutionState.Started; 83 globalScopeView.Enabled = Content.ExecutionState != ExecutionState.Started; 84 base.Content_ExecutionStateChanged(sender, e); 85 85 } 86 86 }
Note: See TracChangeset
for help on using the changeset viewer.