Changeset 3265 for trunk/sources/HeuristicLab.Optimization.Views
- Timestamp:
- 04/05/10 03:17:25 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Optimization.Views/3.3
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization.Views/3.3/AlgorithmView.cs
r3262 r3265 138 138 Invoke(new EventHandler(Content_ExecutionStateChanged), sender, e); 139 139 else { 140 nameTextBox.Enabled = Content.ExecutionState != ExecutionState.Started; 141 descriptionTextBox.Enabled = Content.ExecutionState != ExecutionState.Started; 140 142 SaveEnabled = Content.ExecutionState != ExecutionState.Started; 141 143 parameterCollectionView.Enabled = Content.ExecutionState != ExecutionState.Started; -
trunk/sources/HeuristicLab.Optimization.Views/3.3/BatchRunView.Designer.cs
r3261 r3265 53 53 this.algorithmViewHost = new HeuristicLab.Core.Views.ViewHost(); 54 54 this.runsTabPage = new System.Windows.Forms.TabPage(); 55 this.runsView = new HeuristicLab.Optimization.Views.RunCollectionView(); 55 56 this.startButton = new System.Windows.Forms.Button(); 56 57 this.stopButton = new System.Windows.Forms.Button(); … … 62 63 this.repetitionsLabel = new System.Windows.Forms.Label(); 63 64 this.repetitionsNumericUpDown = new System.Windows.Forms.NumericUpDown(); 64 this. runsView = new HeuristicLab.Optimization.Views.RunCollectionView();65 this.pauseButton = new System.Windows.Forms.Button(); 65 66 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 66 67 this.tabControl.SuspendLayout(); … … 163 164 this.runsTabPage.UseVisualStyleBackColor = true; 164 165 // 166 // runsView 167 // 168 this.runsView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 169 | System.Windows.Forms.AnchorStyles.Left) 170 | System.Windows.Forms.AnchorStyles.Right))); 171 this.runsView.Caption = "RunCollection"; 172 this.runsView.Content = null; 173 this.runsView.Location = new System.Drawing.Point(6, 6); 174 this.runsView.Name = "runsView"; 175 this.runsView.Size = new System.Drawing.Size(659, 336); 176 this.runsView.TabIndex = 0; 177 // 165 178 // startButton 166 179 // … … 178 191 // 179 192 this.stopButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 180 this.stopButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary. Pause;181 this.stopButton.Location = new System.Drawing.Point( 30, 458);193 this.stopButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Stop; 194 this.stopButton.Location = new System.Drawing.Point(60, 458); 182 195 this.stopButton.Name = "stopButton"; 183 196 this.stopButton.Size = new System.Drawing.Size(24, 24); 184 this.stopButton.TabIndex = 8;185 this.toolTip.SetToolTip(this.stopButton, " PauseBatch Run");197 this.stopButton.TabIndex = 9; 198 this.toolTip.SetToolTip(this.stopButton, "Stop Batch Run"); 186 199 this.stopButton.UseVisualStyleBackColor = true; 187 200 this.stopButton.Click += new System.EventHandler(this.stopButton_Click); … … 191 204 this.resetButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 192 205 this.resetButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Restart; 193 this.resetButton.Location = new System.Drawing.Point( 60, 458);206 this.resetButton.Location = new System.Drawing.Point(90, 458); 194 207 this.resetButton.Name = "resetButton"; 195 208 this.resetButton.Size = new System.Drawing.Size(24, 24); 196 this.resetButton.TabIndex = 9;209 this.resetButton.TabIndex = 10; 197 210 this.toolTip.SetToolTip(this.resetButton, "Reset Batch Run"); 198 211 this.resetButton.UseVisualStyleBackColor = true; … … 206 219 this.executionTimeLabel.Name = "executionTimeLabel"; 207 220 this.executionTimeLabel.Size = new System.Drawing.Size(83, 13); 208 this.executionTimeLabel.TabIndex = 1 0;221 this.executionTimeLabel.TabIndex = 11; 209 222 this.executionTimeLabel.Text = "&Execution Time:"; 210 223 // … … 216 229 this.executionTimeTextBox.ReadOnly = true; 217 230 this.executionTimeTextBox.Size = new System.Drawing.Size(137, 20); 218 this.executionTimeTextBox.TabIndex = 1 1;231 this.executionTimeTextBox.TabIndex = 12; 219 232 // 220 233 // openFileDialog … … 266 279 0, 267 280 0}); 281 this.repetitionsNumericUpDown.Validated += new System.EventHandler(repetitionsNumericUpDown_Validated); 268 282 this.repetitionsNumericUpDown.ValueChanged += new System.EventHandler(this.repetitionsNumericUpDown_ValueChanged); 269 283 // 270 // runsView271 // 272 this. runsView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)273 | System.Windows.Forms.AnchorStyles.Left)274 | System.Windows.Forms.AnchorStyles.Right)));275 this. runsView.Caption = "RunCollection";276 this. runsView.Content = null;277 this. runsView.Location = new System.Drawing.Point(6, 6);278 this. runsView.Name = "runsView";279 this. runsView.Size = new System.Drawing.Size(659, 336);280 this. runsView.TabIndex = 0;284 // pauseButton 285 // 286 this.pauseButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 287 this.pauseButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Pause; 288 this.pauseButton.Location = new System.Drawing.Point(30, 458); 289 this.pauseButton.Name = "pauseButton"; 290 this.pauseButton.Size = new System.Drawing.Size(24, 24); 291 this.pauseButton.TabIndex = 8; 292 this.toolTip.SetToolTip(this.pauseButton, "Pause Batch Run"); 293 this.pauseButton.UseVisualStyleBackColor = true; 294 this.pauseButton.Click += new System.EventHandler(this.pauseButton_Click); 281 295 // 282 296 // BatchRunView … … 286 300 this.Controls.Add(this.tabControl); 287 301 this.Controls.Add(this.startButton); 288 this.Controls.Add(this.stopButton);289 302 this.Controls.Add(this.executionTimeTextBox); 290 303 this.Controls.Add(this.executionTimeLabel); 291 this.Controls.Add(this.resetButton);292 304 this.Controls.Add(this.repetitionsNumericUpDown); 293 305 this.Controls.Add(this.repetitionsLabel); 306 this.Controls.Add(this.pauseButton); 307 this.Controls.Add(this.stopButton); 308 this.Controls.Add(this.resetButton); 294 309 this.Name = "BatchRunView"; 295 310 this.Size = new System.Drawing.Size(679, 482); 311 this.Controls.SetChildIndex(this.resetButton, 0); 312 this.Controls.SetChildIndex(this.stopButton, 0); 313 this.Controls.SetChildIndex(this.pauseButton, 0); 296 314 this.Controls.SetChildIndex(this.repetitionsLabel, 0); 297 315 this.Controls.SetChildIndex(this.repetitionsNumericUpDown, 0); 298 this.Controls.SetChildIndex(this.resetButton, 0);299 316 this.Controls.SetChildIndex(this.executionTimeLabel, 0); 300 317 this.Controls.SetChildIndex(this.executionTimeTextBox, 0); 301 this.Controls.SetChildIndex(this.stopButton, 0);302 318 this.Controls.SetChildIndex(this.startButton, 0); 303 319 this.Controls.SetChildIndex(this.tabControl, 0); … … 315 331 316 332 } 317 318 333 #endregion 319 334 … … 335 350 private System.Windows.Forms.NumericUpDown repetitionsNumericUpDown; 336 351 private RunCollectionView runsView; 352 private System.Windows.Forms.Button pauseButton; 337 353 338 354 } -
trunk/sources/HeuristicLab.Optimization.Views/3.3/BatchRunView.cs
r3261 r3265 21 21 22 22 using System; 23 using System.Collections.Generic;24 23 using System.Windows.Forms; 25 24 using HeuristicLab.Common; 25 using HeuristicLab.Core; 26 26 using HeuristicLab.Core.Views; 27 27 using HeuristicLab.MainForm; … … 58 58 59 59 protected override void DeregisterContentEvents() { 60 Content.AlgorithmChanged -= new EventHandler(Content_AlgorithmChanged); 60 61 Content.ExceptionOccurred -= new EventHandler<EventArgs<Exception>>(Content_ExceptionOccurred); 62 Content.ExecutionStateChanged -= new EventHandler(Content_ExecutionStateChanged); 61 63 Content.ExecutionTimeChanged -= new EventHandler(Content_ExecutionTimeChanged); 62 Content.Prepared -= new EventHandler(Content_Prepared);63 Content.AlgorithmChanged -= new EventHandler(Content_AlgorithmChanged);64 64 Content.RepetitionsChanged -= new EventHandler(Content_RepetitionsChanged); 65 Content.RunningChanged -= new EventHandler(Content_RunningChanged);66 65 base.DeregisterContentEvents(); 67 66 } 68 67 protected override void RegisterContentEvents() { 69 68 base.RegisterContentEvents(); 69 Content.AlgorithmChanged += new EventHandler(Content_AlgorithmChanged); 70 70 Content.ExceptionOccurred += new EventHandler<EventArgs<Exception>>(Content_ExceptionOccurred); 71 Content.ExecutionStateChanged += new EventHandler(Content_ExecutionStateChanged); 71 72 Content.ExecutionTimeChanged += new EventHandler(Content_ExecutionTimeChanged); 72 Content.Prepared += new EventHandler(Content_Prepared);73 Content.AlgorithmChanged += new EventHandler(Content_AlgorithmChanged);74 73 Content.RepetitionsChanged += new EventHandler(Content_RepetitionsChanged); 75 Content.RunningChanged += new EventHandler(Content_RunningChanged);76 74 } 77 75 78 76 protected override void OnContentChanged() { 79 77 base.OnContentChanged(); 80 stopButton.Enabled = false;81 78 if (Content == null) { 82 79 repetitionsNumericUpDown.Value = 1; … … 85 82 runsView.Content = null; 86 83 tabControl.Enabled = false; 87 startButton.Enabled = resetButton.Enabled = false;84 startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = resetButton.Enabled = false; 88 85 executionTimeTextBox.Text = "-"; 89 86 executionTimeTextBox.Enabled = false; … … 96 93 runsView.Content = Content.Runs; 97 94 tabControl.Enabled = true; 98 startButton.Enabled = !Content.Finished; 99 resetButton.Enabled = true; 100 UpdateExecutionTimeTextBox(); 95 EnableDisableButtons(); 96 executionTimeTextBox.Text = Content.ExecutionTime.ToString(); 101 97 executionTimeTextBox.Enabled = true; 102 98 } … … 104 100 105 101 protected override void OnClosed(FormClosedEventArgs e) { 106 if ( Content != null) Content.Stop();102 if ((Content != null) && (Content.ExecutionState == ExecutionState.Started)) Content.Stop(); 107 103 base.OnClosed(e); 108 104 } 109 105 110 106 #region Content Events 107 private void Content_ExecutionStateChanged(object sender, EventArgs e) { 108 if (InvokeRequired) 109 Invoke(new EventHandler(Content_ExecutionStateChanged), sender, e); 110 else { 111 nameTextBox.Enabled = Content.ExecutionState != ExecutionState.Started; 112 descriptionTextBox.Enabled = Content.ExecutionState != ExecutionState.Started; 113 SaveEnabled = Content.ExecutionState != ExecutionState.Started; 114 repetitionsNumericUpDown.Enabled = Content.ExecutionState != ExecutionState.Started; 115 newAlgorithmButton.Enabled = openAlgorithmButton.Enabled = saveAlgorithmButton.Enabled = Content.ExecutionState != ExecutionState.Started; 116 EnableDisableButtons(); 117 } 118 } 119 private void Content_ExecutionTimeChanged(object sender, EventArgs e) { 120 if (InvokeRequired) 121 Invoke(new EventHandler(Content_ExecutionTimeChanged), sender, e); 122 else 123 executionTimeTextBox.Text = Content.ExecutionTime.ToString(); 124 } 125 private void Content_ExceptionOccurred(object sender, EventArgs<Exception> e) { 126 if (InvokeRequired) 127 Invoke(new EventHandler<EventArgs<Exception>>(Content_ExceptionOccurred), sender, e); 128 else 129 Auxiliary.ShowErrorMessageBox(e.Value); 130 } 111 131 private void Content_AlgorithmChanged(object sender, EventArgs e) { 112 132 if (InvokeRequired) … … 118 138 } 119 139 } 120 private void Content_Prepared(object sender, EventArgs e) { 121 if (InvokeRequired) 122 Invoke(new EventHandler(Content_Prepared), sender, e); 123 else { 124 startButton.Enabled = !Content.Finished; 125 UpdateExecutionTimeTextBox(); 126 } 127 } 128 private void Content_RunningChanged(object sender, EventArgs e) { 129 if (InvokeRequired) 130 Invoke(new EventHandler(Content_RunningChanged), sender, e); 131 else { 132 SaveEnabled = !Content.Running; 133 repetitionsNumericUpDown.Enabled = !Content.Running; 134 newAlgorithmButton.Enabled = openAlgorithmButton.Enabled = saveAlgorithmButton.Enabled = !Content.Running; 135 startButton.Enabled = !Content.Running && !Content.Finished; 136 stopButton.Enabled = Content.Running; 137 resetButton.Enabled = !Content.Running; 138 UpdateExecutionTimeTextBox(); 139 } 140 } 141 private void Content_ExecutionTimeChanged(object sender, EventArgs e) { 142 UpdateExecutionTimeTextBox(); 143 } 144 private void Content_ExceptionOccurred(object sender, EventArgs<Exception> e) { 145 if (InvokeRequired) 146 Invoke(new EventHandler<EventArgs<Exception>>(Content_ExceptionOccurred), sender, e); 140 private void Content_RepetitionsChanged(object sender, EventArgs e) { 141 if (InvokeRequired) 142 Invoke(new EventHandler(Content_RepetitionsChanged), sender, e); 147 143 else 148 Auxiliary.ShowErrorMessageBox(e.Value);149 }150 private void Content_RepetitionsChanged(object sender, EventArgs e) {151 if (InvokeRequired)152 Invoke(new EventHandler(Content_RepetitionsChanged), sender, e);153 else {154 144 repetitionsNumericUpDown.Value = Content.Repetitions; 155 startButton.Enabled = !Content.Finished;156 }157 145 } 158 146 #endregion 159 147 160 148 #region Control events 149 private void repetitionsNumericUpDown_Validated(object sender, System.EventArgs e) { 150 if (repetitionsNumericUpDown.Text == string.Empty) 151 repetitionsNumericUpDown.Text = repetitionsNumericUpDown.Value.ToString(); 152 } 161 153 private void repetitionsNumericUpDown_ValueChanged(object sender, EventArgs e) { 162 154 Content.Repetitions = (int)repetitionsNumericUpDown.Value; … … 227 219 Content.Start(); 228 220 } 221 private void pauseButton_Click(object sender, EventArgs e) { 222 Content.Pause(); 223 } 229 224 private void stopButton_Click(object sender, EventArgs e) { 230 225 Content.Stop(); 231 226 } 232 227 private void resetButton_Click(object sender, EventArgs e) { 233 Content.Prepare(); 228 if (Content.Runs.Count > 0) { 229 if (MessageBox.Show(this, "Clear all runs executed so far?", "Clear All Runs?", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes) 230 Content.Prepare(true); 231 else 232 Content.Prepare(false); 233 } else { 234 Content.Prepare(); 235 } 234 236 } 235 237 #endregion 236 238 237 239 #region Helpers 238 private void UpdateExecutionTimeTextBox() {239 if (InvokeRequired)240 Invoke(new Action(UpdateExecutionTimeTextBox));241 else242 executionTimeTextBox.Text = Content.ExecutionTime.ToString();240 private void EnableDisableButtons() { 241 startButton.Enabled = (Content.ExecutionState == ExecutionState.Prepared) || (Content.ExecutionState == ExecutionState.Paused); 242 pauseButton.Enabled = Content.ExecutionState == ExecutionState.Started; 243 stopButton.Enabled = (Content.ExecutionState == ExecutionState.Started) || (Content.ExecutionState == ExecutionState.Paused); 244 resetButton.Enabled = Content.ExecutionState != ExecutionState.Started; 243 245 } 244 246 #endregion -
trunk/sources/HeuristicLab.Optimization.Views/3.3/HeuristicLab.Optimization.Views-3.3.csproj
r3262 r3265 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> 94 100 <Compile Include="RunCollectionView.cs"> 95 101 <SubType>UserControl</SubType>
Note: See TracChangeset
for help on using the changeset viewer.