Changeset 3454 for trunk/sources/HeuristicLab.Optimization.Views
- Timestamp:
- 04/21/10 06:14:03 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Optimization.Views/3.3
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization.Views/3.3/AlgorithmView.Designer.cs
r3299 r3454 52 52 this.problemPanel = new System.Windows.Forms.Panel(); 53 53 this.problemViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 54 this.saveProblemButton = new System.Windows.Forms.Button();55 54 this.openProblemButton = new System.Windows.Forms.Button(); 56 55 this.newProblemButton = new System.Windows.Forms.Button(); … … 65 64 this.executionTimeTextBox = new System.Windows.Forms.TextBox(); 66 65 this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); 67 this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();68 66 this.stopButton = new System.Windows.Forms.Button(); 69 67 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); … … 127 125 // 128 126 this.problemTabPage.Controls.Add(this.problemPanel); 129 this.problemTabPage.Controls.Add(this.saveProblemButton);130 127 this.problemTabPage.Controls.Add(this.openProblemButton); 131 128 this.problemTabPage.Controls.Add(this.newProblemButton); … … 163 160 this.problemViewHost.ViewType = null; 164 161 // 165 // saveProblemButton166 //167 this.saveProblemButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Save;168 this.saveProblemButton.Location = new System.Drawing.Point(66, 6);169 this.saveProblemButton.Name = "saveProblemButton";170 this.saveProblemButton.Size = new System.Drawing.Size(24, 24);171 this.saveProblemButton.TabIndex = 2;172 this.toolTip.SetToolTip(this.saveProblemButton, "Save Problem");173 this.saveProblemButton.UseVisualStyleBackColor = true;174 this.saveProblemButton.Click += new System.EventHandler(this.saveProblemButton_Click);175 //176 162 // openProblemButton 177 163 // … … 303 289 this.openFileDialog.Filter = "HeuristicLab Files|*.hl|All Files|*.*"; 304 290 this.openFileDialog.Title = "Open Problem"; 305 //306 // saveFileDialog307 //308 this.saveFileDialog.DefaultExt = "hl";309 this.saveFileDialog.FileName = "Problem";310 this.saveFileDialog.Filter = "Uncompressed HeuristicLab Files|*.hl|HeuristicLab Files|*.hl|All Files|*.*";311 this.saveFileDialog.FilterIndex = 2;312 this.saveFileDialog.Title = "Save Problem";313 291 // 314 292 // stopButton … … 368 346 protected HeuristicLab.MainForm.WindowsForms.ViewHost problemViewHost; 369 347 protected System.Windows.Forms.Button newProblemButton; 370 protected System.Windows.Forms.Button saveProblemButton;371 348 protected System.Windows.Forms.Button openProblemButton; 372 349 protected System.Windows.Forms.Button startButton; … … 376 353 protected System.Windows.Forms.TextBox executionTimeTextBox; 377 354 protected System.Windows.Forms.OpenFileDialog openFileDialog; 378 protected System.Windows.Forms.SaveFileDialog saveFileDialog;379 355 protected System.Windows.Forms.TabPage resultsTabPage; 380 356 protected HeuristicLab.Optimization.Views.ResultCollectionView resultsView; -
trunk/sources/HeuristicLab.Optimization.Views/3.3/AlgorithmView.cs
r3416 r3454 97 97 resultsView.Content = null; 98 98 runsView.Content = null; 99 tabControl.Enabled = false;100 startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = resetButton.Enabled = false;101 99 executionTimeTextBox.Text = "-"; 102 executionTimeTextBox.Enabled = false;103 100 } else { 104 101 parameterCollectionView.Content = Content.Parameters; 105 saveProblemButton.Enabled = Content.Problem != null;106 102 problemViewHost.ViewType = null; 107 103 problemViewHost.Content = Content.Problem; 108 104 resultsView.Content = Content.Results.AsReadOnly(); 109 105 runsView.Content = Content.Runs; 110 tabControl.Enabled = true;111 EnableDisableButtons();112 106 executionTimeTextBox.Text = Content.ExecutionTime.ToString(); 113 executionTimeTextBox.Enabled = true;114 107 } 115 108 SetEnableStateOfControls(); … … 121 114 } 122 115 private void SetEnableStateOfControls() { 116 parameterCollectionView.Enabled = Content != null; 123 117 parameterCollectionView.ReadOnly = ReadOnly; 118 newProblemButton.Enabled = Content != null && !ReadOnly; 119 openProblemButton.Enabled = Content != null && !ReadOnly; 120 problemViewHost.Enabled = Content != null; 124 121 problemViewHost.ReadOnly = ReadOnly; 122 resultsView.Enabled = Content != null; 125 123 resultsView.ReadOnly = ReadOnly; 124 runsView.Enabled = Content != null; 126 125 runsView.ReadOnly = ReadOnly; 126 executionTimeTextBox.Enabled = Content != null; 127 SetEnabledStateOfExecutableButtons(); 127 128 } 128 129 … … 139 140 problemViewHost.ViewType = null; 140 141 problemViewHost.Content = Content.Problem; 141 saveProblemButton.Enabled = Content.Problem != null;142 142 } 143 143 } … … 152 152 Invoke(new EventHandler(Content_ExecutionStateChanged), sender, e); 153 153 else { 154 this.ReadOnly = Content.ExecutionState == ExecutionState.Started;154 ReadOnly = Content.ExecutionState == ExecutionState.Started; 155 155 Locked = Content.ExecutionState == ExecutionState.Started; 156 EnableDisableButtons();156 SetEnabledStateOfExecutableButtons(); 157 157 } 158 158 } … … 192 192 if (openFileDialog.ShowDialog(this) == DialogResult.OK) { 193 193 this.Cursor = Cursors.AppStarting; 194 newProblemButton.Enabled = openProblemButton.Enabled = saveProblemButton.Enabled =false;194 newProblemButton.Enabled = openProblemButton.Enabled = false; 195 195 problemViewHost.Enabled = false; 196 196 … … 211 211 Content.Problem = problem; 212 212 problemViewHost.Enabled = true; 213 newProblemButton.Enabled = openProblemButton.Enabled = saveProblemButton.Enabled = true; 214 this.Cursor = Cursors.Default; 215 })); 216 }, null); 217 } 218 } 219 protected virtual void saveProblemButton_Click(object sender, EventArgs e) { 220 saveFileDialog.Title = "Save Problem"; 221 if (saveFileDialog.ShowDialog(this) == DialogResult.OK) { 222 this.Cursor = Cursors.AppStarting; 223 newProblemButton.Enabled = openProblemButton.Enabled = saveProblemButton.Enabled = false; 224 problemViewHost.Enabled = false; 225 226 var call = new Action<IProblem, string, int>(XmlGenerator.Serialize); 227 int compression = 9; 228 if (saveFileDialog.FilterIndex == 1) compression = 0; 229 call.BeginInvoke(Content.Problem, saveFileDialog.FileName, compression, delegate(IAsyncResult a) { 230 try { 231 call.EndInvoke(a); 232 } 233 catch (Exception ex) { 234 Auxiliary.ShowErrorMessageBox(ex); 235 } 236 Invoke(new Action(delegate() { 237 problemViewHost.Enabled = true; 238 newProblemButton.Enabled = openProblemButton.Enabled = saveProblemButton.Enabled = true; 213 newProblemButton.Enabled = openProblemButton.Enabled = true; 239 214 this.Cursor = Cursors.Default; 240 215 })); … … 282 257 283 258 #region Helpers 284 private void EnableDisableButtons() { 285 startButton.Enabled = (Content.ExecutionState == ExecutionState.Prepared) || (Content.ExecutionState == ExecutionState.Paused); 286 pauseButton.Enabled = Content.ExecutionState == ExecutionState.Started; 287 stopButton.Enabled = (Content.ExecutionState == ExecutionState.Started) || (Content.ExecutionState == ExecutionState.Paused); 288 resetButton.Enabled = Content.ExecutionState != ExecutionState.Started; 259 private void SetEnabledStateOfExecutableButtons() { 260 if (Content == null) { 261 startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = resetButton.Enabled = false; 262 } else { 263 startButton.Enabled = (Content.ExecutionState == ExecutionState.Prepared) || (Content.ExecutionState == ExecutionState.Paused); 264 pauseButton.Enabled = Content.ExecutionState == ExecutionState.Started; 265 stopButton.Enabled = (Content.ExecutionState == ExecutionState.Started) || (Content.ExecutionState == ExecutionState.Paused); 266 resetButton.Enabled = Content.ExecutionState != ExecutionState.Started; 267 } 289 268 } 290 269 #endregion -
trunk/sources/HeuristicLab.Optimization.Views/3.3/BatchRunView.Designer.cs
r3299 r3454 50 50 this.algorithmPanel = new System.Windows.Forms.Panel(); 51 51 this.algorithmViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 52 this.saveAlgorithmButton = new System.Windows.Forms.Button();53 52 this.openAlgorithmButton = new System.Windows.Forms.Button(); 54 53 this.newAlgorithmButton = new System.Windows.Forms.Button(); … … 61 60 this.executionTimeTextBox = new System.Windows.Forms.TextBox(); 62 61 this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); 63 this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();64 62 this.repetitionsLabel = new System.Windows.Forms.Label(); 65 63 this.repetitionsNumericUpDown = new System.Windows.Forms.NumericUpDown(); … … 99 97 // 100 98 this.algorithmTabPage.Controls.Add(this.algorithmPanel); 101 this.algorithmTabPage.Controls.Add(this.saveAlgorithmButton);102 99 this.algorithmTabPage.Controls.Add(this.openAlgorithmButton); 103 100 this.algorithmTabPage.Controls.Add(this.newAlgorithmButton); … … 135 132 this.algorithmViewHost.ViewType = null; 136 133 // 137 // saveAlgorithmButton138 //139 this.saveAlgorithmButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Save;140 this.saveAlgorithmButton.Location = new System.Drawing.Point(66, 6);141 this.saveAlgorithmButton.Name = "saveAlgorithmButton";142 this.saveAlgorithmButton.Size = new System.Drawing.Size(24, 24);143 this.saveAlgorithmButton.TabIndex = 2;144 this.toolTip.SetToolTip(this.saveAlgorithmButton, "Save Problem");145 this.saveAlgorithmButton.UseVisualStyleBackColor = true;146 this.saveAlgorithmButton.Click += new System.EventHandler(this.saveAlgorithmButton_Click);147 //148 134 // openAlgorithmButton 149 135 // … … 252 238 this.openFileDialog.Filter = "HeuristicLab Files|*.hl|All Files|*.*"; 253 239 this.openFileDialog.Title = "Open Algorithm"; 254 //255 // saveFileDialog256 //257 this.saveFileDialog.DefaultExt = "hl";258 this.saveFileDialog.FileName = "Algorithm";259 this.saveFileDialog.Filter = "Uncompressed HeuristicLab Files|*.hl|HeuristicLab Files|*.hl|All Files|*.*";260 this.saveFileDialog.FilterIndex = 2;261 this.saveFileDialog.Title = "Save Algorithm";262 240 // 263 241 // repetitionsLabel … … 353 331 private HeuristicLab.MainForm.WindowsForms.ViewHost algorithmViewHost; 354 332 private System.Windows.Forms.Button newAlgorithmButton; 355 private System.Windows.Forms.Button saveAlgorithmButton;356 333 private System.Windows.Forms.Button openAlgorithmButton; 357 334 private System.Windows.Forms.Button startButton; … … 361 338 private System.Windows.Forms.TextBox executionTimeTextBox; 362 339 private System.Windows.Forms.OpenFileDialog openFileDialog; 363 private System.Windows.Forms.SaveFileDialog saveFileDialog;364 340 private System.Windows.Forms.TabPage runsTabPage; 365 341 private System.Windows.Forms.Label repetitionsLabel; -
trunk/sources/HeuristicLab.Optimization.Views/3.3/BatchRunView.cs
r3416 r3454 78 78 if (Content == null) { 79 79 repetitionsNumericUpDown.Value = 1; 80 repetitionsNumericUpDown.Enabled = false;81 80 algorithmViewHost.Content = null; 82 81 runsView.Content = null; 83 tabControl.Enabled = false;84 startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = resetButton.Enabled = false;85 82 executionTimeTextBox.Text = "-"; 86 executionTimeTextBox.Enabled = false;87 83 } else { 88 84 repetitionsNumericUpDown.Value = Content.Repetitions; 89 repetitionsNumericUpDown.Enabled = true;90 saveAlgorithmButton.Enabled = Content.Algorithm != null;91 85 algorithmViewHost.ViewType = null; 92 86 algorithmViewHost.Content = Content.Algorithm; 93 87 runsView.Content = Content.Runs; 94 tabControl.Enabled = true;95 EnableDisableButtons();96 88 executionTimeTextBox.Text = Content.ExecutionTime.ToString(); 97 executionTimeTextBox.Enabled = true;98 89 } 99 90 SetEnableStateOfControls(); … … 104 95 } 105 96 private void SetEnableStateOfControls() { 106 repetitionsNumericUpDown.ReadOnly = ReadOnly; 97 repetitionsNumericUpDown.Enabled = Content != null && !ReadOnly; 98 newAlgorithmButton.Enabled = Content != null && !ReadOnly; 99 openAlgorithmButton.Enabled = Content != null && !ReadOnly; 100 algorithmViewHost.Enabled = Content != null; 107 101 algorithmViewHost.ReadOnly = ReadOnly; 102 runsView.Enabled = Content != null; 108 103 runsView.ReadOnly = ReadOnly; 104 executionTimeTextBox.Enabled = Content != null; 105 SetEnabledStateOfExecutableButtons(); 109 106 } 110 107 … … 121 118 this.ReadOnly = Content.ExecutionState == ExecutionState.Started; 122 119 Locked = Content.ExecutionState == ExecutionState.Started; 123 newAlgorithmButton.Enabled = openAlgorithmButton.Enabled = saveAlgorithmButton.Enabled = Content.ExecutionState != ExecutionState.Started; 124 EnableDisableButtons(); 120 SetEnabledStateOfExecutableButtons(); 125 121 } 126 122 } … … 143 139 algorithmViewHost.ViewType = null; 144 140 algorithmViewHost.Content = Content.Algorithm; 145 saveAlgorithmButton.Enabled = Content.Algorithm != null;146 141 } 147 142 } … … 182 177 if (openFileDialog.ShowDialog(this) == DialogResult.OK) { 183 178 this.Cursor = Cursors.AppStarting; 184 newAlgorithmButton.Enabled = openAlgorithmButton.Enabled = saveAlgorithmButton.Enabled =false;179 newAlgorithmButton.Enabled = openAlgorithmButton.Enabled = false; 185 180 algorithmViewHost.Enabled = false; 186 181 … … 199 194 Content.Algorithm = algorithm; 200 195 algorithmViewHost.Enabled = true; 201 newAlgorithmButton.Enabled = openAlgorithmButton.Enabled = saveAlgorithmButton.Enabled = true; 202 this.Cursor = Cursors.Default; 203 })); 204 }, null); 205 } 206 } 207 private void saveAlgorithmButton_Click(object sender, EventArgs e) { 208 saveFileDialog.Title = "Save Algorithm"; 209 if (saveFileDialog.ShowDialog(this) == DialogResult.OK) { 210 this.Cursor = Cursors.AppStarting; 211 newAlgorithmButton.Enabled = openAlgorithmButton.Enabled = saveAlgorithmButton.Enabled = false; 212 algorithmViewHost.Enabled = false; 213 214 var call = new Action<IAlgorithm, string, int>(XmlGenerator.Serialize); 215 int compression = 9; 216 if (saveFileDialog.FilterIndex == 1) compression = 0; 217 call.BeginInvoke(Content.Algorithm, saveFileDialog.FileName, compression, delegate(IAsyncResult a) { 218 try { 219 call.EndInvoke(a); 220 } 221 catch (Exception ex) { 222 Auxiliary.ShowErrorMessageBox(ex); 223 } 224 Invoke(new Action(delegate() { 225 algorithmViewHost.Enabled = true; 226 newAlgorithmButton.Enabled = openAlgorithmButton.Enabled = saveAlgorithmButton.Enabled = true; 196 newAlgorithmButton.Enabled = openAlgorithmButton.Enabled = true; 227 197 this.Cursor = Cursors.Default; 228 198 })); … … 272 242 273 243 #region Helpers 274 private void EnableDisableButtons() { 275 startButton.Enabled = (Content.ExecutionState == ExecutionState.Prepared) || (Content.ExecutionState == ExecutionState.Paused); 276 pauseButton.Enabled = Content.ExecutionState == ExecutionState.Started; 277 stopButton.Enabled = (Content.ExecutionState == ExecutionState.Started) || (Content.ExecutionState == ExecutionState.Paused); 278 resetButton.Enabled = Content.ExecutionState != ExecutionState.Started; 244 private void SetEnabledStateOfExecutableButtons() { 245 if (Content == null) { 246 startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = resetButton.Enabled = false; 247 } else { 248 startButton.Enabled = (Content.ExecutionState == ExecutionState.Prepared) || (Content.ExecutionState == ExecutionState.Paused); 249 pauseButton.Enabled = Content.ExecutionState == ExecutionState.Started; 250 stopButton.Enabled = (Content.ExecutionState == ExecutionState.Started) || (Content.ExecutionState == ExecutionState.Paused); 251 resetButton.Enabled = Content.ExecutionState != ExecutionState.Started; 252 } 279 253 } 280 254 #endregion -
trunk/sources/HeuristicLab.Optimization.Views/3.3/EngineAlgorithmView.Designer.cs
r3361 r3454 52 52 this.engineViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 53 53 this.operatorGraphTabPage = new System.Windows.Forms.TabPage(); 54 this.saveOperatorGraphButton = new System.Windows.Forms.Button();55 54 this.openOperatorGraphButton = new System.Windows.Forms.Button(); 56 55 this.newOperatorGraphButton = new System.Windows.Forms.Button(); … … 99 98 this.toolTip.SetToolTip(this.newProblemButton, "New Problem"); 100 99 // 101 // saveProblemButton102 //103 this.toolTip.SetToolTip(this.saveProblemButton, "Save Problem");104 //105 100 // openProblemButton 106 101 // … … 228 223 // operatorGraphTabPage 229 224 // 230 this.operatorGraphTabPage.Controls.Add(this.saveOperatorGraphButton);231 225 this.operatorGraphTabPage.Controls.Add(this.openOperatorGraphButton); 232 226 this.operatorGraphTabPage.Controls.Add(this.newOperatorGraphButton); … … 238 232 this.operatorGraphTabPage.Text = "Operator Graph"; 239 233 this.operatorGraphTabPage.UseVisualStyleBackColor = true; 240 //241 // saveOperatorGraphButton242 //243 this.saveOperatorGraphButton.Enabled = false;244 this.saveOperatorGraphButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Save;245 this.saveOperatorGraphButton.Location = new System.Drawing.Point(63, 3);246 this.saveOperatorGraphButton.Name = "saveOperatorGraphButton";247 this.saveOperatorGraphButton.Size = new System.Drawing.Size(24, 24);248 this.saveOperatorGraphButton.TabIndex = 1;249 this.toolTip.SetToolTip(this.saveOperatorGraphButton, "Save Operator Graph");250 this.saveOperatorGraphButton.UseVisualStyleBackColor = true;251 234 // 252 235 // openOperatorGraphButton … … 328 311 protected System.Windows.Forms.TabPage operatorGraphTabPage; 329 312 protected HeuristicLab.MainForm.WindowsForms.ViewHost operatorGraphViewHost; 330 protected System.Windows.Forms.Button saveOperatorGraphButton;331 313 protected System.Windows.Forms.Button openOperatorGraphButton; 332 314 protected System.Windows.Forms.Button newOperatorGraphButton; -
trunk/sources/HeuristicLab.Optimization.Views/3.3/EngineAlgorithmView.cs
r3423 r3454 88 88 if (Content == null) { 89 89 engineViewHost.Content = null; 90 createUserDefinedAlgorithmButton.Enabled = false;91 90 operatorGraphViewHost.Content = null; 92 91 } else { … … 99 98 operatorGraphViewHost.ViewType = null; 100 99 operatorGraphViewHost.Content = Content.OperatorGraph; 101 createUserDefinedAlgorithmButton.Enabled = true;102 100 } 103 101 SetEnableStateOfControls(); … … 108 106 SetEnableStateOfControls(); 109 107 } 108 protected override void OnLockedChanged() { 109 base.OnLockedChanged(); 110 SetEnableStateOfControls(); 111 } 110 112 private void SetEnableStateOfControls() { 113 engineViewHost.Enabled = Content != null; 111 114 engineViewHost.ReadOnly = ReadOnly; 112 if (Content == null) 113 engineComboBox.Enabled = false; 114 else 115 engineComboBox.Enabled = Content.ExecutionState != ExecutionState.Started; 115 newOperatorGraphButton.Enabled = false; 116 openOperatorGraphButton.Enabled = false; 117 operatorGraphViewHost.Enabled = Content != null; 118 engineComboBox.Enabled = Content != null && !ReadOnly; 119 createUserDefinedAlgorithmButton.Enabled = Content != null && !Locked; 116 120 } 117 121 118 protected override void Content_ExecutionStateChanged(object sender, EventArgs e) {119 if (InvokeRequired)120 Invoke(new EventHandler(Content_ExecutionStateChanged), sender, e);121 else {122 createUserDefinedAlgorithmButton.Enabled = Content.ExecutionState != ExecutionState.Started;123 base.Content_ExecutionStateChanged(sender, e);124 }125 }126 122 protected virtual void Content_EngineChanged(object sender, System.EventArgs e) { 127 123 if (InvokeRequired) -
trunk/sources/HeuristicLab.Optimization.Views/3.3/ExperimentView.cs
r3416 r3454 72 72 optimizerListView.Content = null; 73 73 runsViewHost.Content = null; 74 tabControl.Enabled = false;75 startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = resetButton.Enabled = false;76 74 executionTimeTextBox.Text = "-"; 77 executionTimeTextBox.Enabled = false;78 75 } else { 79 76 optimizerListView.Content = Content.Optimizers; 80 77 runsViewHost.Content = Content.Runs; 81 tabControl.Enabled = true;82 EnableDisableButtons();83 78 executionTimeTextBox.Text = Content.ExecutionTime.ToString(); 84 executionTimeTextBox.Enabled = true;85 79 } 86 80 SetEnableStateOfControls(); … … 92 86 } 93 87 private void SetEnableStateOfControls() { 88 optimizerListView.Enabled = Content != null; 94 89 optimizerListView.ReadOnly = ReadOnly; 90 runsViewHost.Enabled = Content != null; 91 runsViewHost.ReadOnly = ReadOnly; 92 executionTimeTextBox.Enabled = Content != null; 93 SetEnabledStateOfExecutableButtons(); 95 94 } 96 95 … … 108 107 descriptionTextBox.Enabled = Content.ExecutionState != ExecutionState.Started; 109 108 Locked = Content.ExecutionState == ExecutionState.Started; 110 EnableDisableButtons();109 SetEnabledStateOfExecutableButtons(); 111 110 } 112 111 } … … 148 147 149 148 #region Helpers 150 private void EnableDisableButtons() { 151 startButton.Enabled = (Content.ExecutionState == ExecutionState.Prepared) || (Content.ExecutionState == ExecutionState.Paused); 152 pauseButton.Enabled = Content.ExecutionState == ExecutionState.Started; 153 stopButton.Enabled = (Content.ExecutionState == ExecutionState.Started) || (Content.ExecutionState == ExecutionState.Paused); 154 resetButton.Enabled = Content.ExecutionState != ExecutionState.Started; 149 private void SetEnabledStateOfExecutableButtons() { 150 if (Content == null) { 151 startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = resetButton.Enabled = false; 152 } else { 153 startButton.Enabled = (Content.ExecutionState == ExecutionState.Prepared) || (Content.ExecutionState == ExecutionState.Paused); 154 pauseButton.Enabled = Content.ExecutionState == ExecutionState.Started; 155 stopButton.Enabled = (Content.ExecutionState == ExecutionState.Started) || (Content.ExecutionState == ExecutionState.Paused); 156 resetButton.Enabled = Content.ExecutionState != ExecutionState.Started; 157 } 155 158 } 156 159 #endregion -
trunk/sources/HeuristicLab.Optimization.Views/3.3/ResultView.cs
r3362 r3454 104 104 } 105 105 private void SetEnabledStateOfControls() { 106 if (Content == null) { 107 dataTypeTextBox.Enabled = false; 108 valueGroupBox.Enabled = false; 109 viewHost.Enabled = false; 110 } else { 111 dataTypeTextBox.Enabled = true; 112 valueGroupBox.Enabled = true; 113 viewHost.Enabled = true; 114 viewHost.ReadOnly = ReadOnly; 115 } 106 dataTypeTextBox.Enabled = Content != null; 107 viewHost.Enabled = Content != null; 108 viewHost.ReadOnly = ReadOnly; 116 109 } 117 110 -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionBubbleChartView.cs
r3449 r3454 69 69 this.chart.ChartAreas[0].CursorX.Interval = 0; 70 70 this.chart.ChartAreas[0].CursorY.Interval = 0; 71 72 base.ReadOnly = true;73 71 } 74 72 -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunView.cs
r3432 r3454 82 82 SetEnabledStateOfControls(); 83 83 } 84 protected override void OnLockedChanged() { 85 base.OnLockedChanged(); 86 SetEnabledStateOfControls(); 87 } 84 88 private void SetEnabledStateOfControls() { 85 if (Content == null) { 86 parametersResultsGroupBox.Enabled = false; 87 viewHost.Enabled = false; 88 } else { 89 parametersResultsGroupBox.Enabled = true; 90 viewHost.Enabled = true; 91 viewHost.ReadOnly = ReadOnly; 92 } 89 listView.Enabled = Content != null; 90 viewHost.Enabled = Content != null; 91 viewHost.ReadOnly = ReadOnly; 92 showAlgorithmButton.Enabled = Content != null && !Locked; 93 93 } 94 94 … … 147 147 } 148 148 private void showAlgorithmButton_Click(object sender, EventArgs e) { 149 IContentView view = MainFormManager.CreateDefaultView(Content.Algorithm.Clone()); 150 if (view != null) { 151 view.ReadOnly = ReadOnly; 152 view.Locked = Locked; 153 view.Show(); 149 if (!Locked) { 150 IContentView view = MainFormManager.CreateDefaultView(Content.Algorithm.Clone()); 151 if (view != null) { 152 view.ReadOnly = ReadOnly; 153 view.Locked = Locked; 154 view.Show(); 155 } 154 156 } 155 157 } -
trunk/sources/HeuristicLab.Optimization.Views/3.3/UserDefinedAlgorithmView.Designer.cs
r3361 r3454 79 79 this.toolTip.SetToolTip(this.newProblemButton, "New Problem"); 80 80 // 81 // saveProblemButton82 //83 this.toolTip.SetToolTip(this.saveProblemButton, "Save Problem");84 //85 81 // openProblemButton 86 82 // -
trunk/sources/HeuristicLab.Optimization.Views/3.3/UserDefinedAlgorithmView.cs
r3376 r3454 69 69 } 70 70 private void SetEnableStateOfControls() { 71 globalScopeView.Enabled = Content != null; 71 72 globalScopeView.ReadOnly = ReadOnly; 73 newOperatorGraphButton.Enabled = Content != null && !ReadOnly; 74 openOperatorGraphButton.Enabled = Content != null && !ReadOnly; 72 75 operatorGraphViewHost.ReadOnly = ReadOnly; 73 if (Content == null)74 newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = saveOperatorGraphButton.Enabled = false;75 else76 newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = saveOperatorGraphButton.Enabled = Content.ExecutionState != ExecutionState.Started;77 76 } 78 77 … … 84 83 if (openFileDialog.ShowDialog(this) == DialogResult.OK) { 85 84 this.Cursor = Cursors.AppStarting; 86 newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = saveOperatorGraphButton.Enabled =false;85 newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = false; 87 86 operatorGraphViewHost.Enabled = false; 88 87 … … 102 101 Content.OperatorGraph = operatorGraph; 103 102 operatorGraphViewHost.Enabled = true; 104 newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = saveOperatorGraphButton.Enabled = true; 105 this.Cursor = Cursors.Default; 106 })); 107 }, null); 108 } 109 } 110 private void saveOperatorGraphButton_Click(object sender, EventArgs e) { 111 saveFileDialog.Title = "Save Operator Graph"; 112 if (saveFileDialog.ShowDialog(this) == DialogResult.OK) { 113 this.Cursor = Cursors.AppStarting; 114 newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = saveOperatorGraphButton.Enabled = false; 115 operatorGraphViewHost.Enabled = false; 116 117 var call = new Action<OperatorGraph, string, int>(XmlGenerator.Serialize); 118 int compression = 9; 119 if (saveFileDialog.FilterIndex == 1) compression = 0; 120 call.BeginInvoke(Content.OperatorGraph, saveFileDialog.FileName, compression, delegate(IAsyncResult a) { 121 try { 122 call.EndInvoke(a); 123 } 124 catch (Exception ex) { 125 Auxiliary.ShowErrorMessageBox(ex); 126 } 127 Invoke(new Action(delegate() { 128 operatorGraphViewHost.Enabled = true; 129 newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = saveOperatorGraphButton.Enabled = true; 103 newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = true; 130 104 this.Cursor = Cursors.Default; 131 105 }));
Note: See TracChangeset
for help on using the changeset viewer.