- Timestamp:
- 01/12/18 13:33:23 (7 years ago)
- Location:
- branches/GeneralizedQAP/HeuristicLab.Optimization.Views/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GeneralizedQAP/HeuristicLab.Optimization.Views/3.3/IOptimizerView.Designer.cs
r14185 r15603 45 45 /// </summary> 46 46 private void InitializeComponent() { 47 this.components = new System.ComponentModel.Container(); 47 48 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(IOptimizerView)); 48 49 this.startButton = new System.Windows.Forms.Button(); … … 52 53 this.stopButton = new System.Windows.Forms.Button(); 53 54 this.resetButton = new System.Windows.Forms.Button(); 55 this.executionTimer = new System.Windows.Forms.Timer(this.components); 54 56 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 55 57 this.SuspendLayout(); … … 132 134 this.resetButton.Click += new System.EventHandler(this.resetButton_Click); 133 135 // 136 // executionTimer 137 // 138 this.executionTimer.Interval = 200; 139 this.executionTimer.Tick += new System.EventHandler(this.executionTimer_Tick); 140 // 134 141 // IOptimizerView 135 142 // … … 166 173 protected System.Windows.Forms.Button pauseButton; 167 174 protected System.Windows.Forms.Button stopButton; 175 protected System.Windows.Forms.Timer executionTimer; 168 176 protected System.Windows.Forms.Button resetButton; 169 177 -
branches/GeneralizedQAP/HeuristicLab.Optimization.Views/3.3/IOptimizerView.cs
r15367 r15603 44 44 Content.ExceptionOccurred -= new EventHandler<EventArgs<Exception>>(Content_ExceptionOccurred); 45 45 Content.ExecutionStateChanged -= new EventHandler(Content_ExecutionStateChanged); 46 Content.ExecutionTimeChanged -= new EventHandler(Content_ExecutionTimeChanged);47 46 Content.Prepared -= new EventHandler(Content_Prepared); 48 47 Content.Started -= new EventHandler(Content_Started); … … 55 54 Content.ExceptionOccurred += new EventHandler<EventArgs<Exception>>(Content_ExceptionOccurred); 56 55 Content.ExecutionStateChanged += new EventHandler(Content_ExecutionStateChanged); 57 Content.ExecutionTimeChanged += new EventHandler(Content_ExecutionTimeChanged);58 56 Content.Prepared += new EventHandler(Content_Prepared); 59 57 Content.Started += new EventHandler(Content_Started); … … 64 62 protected override void OnContentChanged() { 65 63 base.OnContentChanged(); 66 if (Content == null) { 67 executionTimeTextBox.Text = "-"; 68 } else { 64 if (Content != null) { 69 65 Locked = ReadOnly = Content.ExecutionState == ExecutionState.Started; 70 executionTimeTextBox.Text = Content.ExecutionTime.ToString();71 66 } 67 UpdateExecutionTime(); 72 68 } 73 69 … … 90 86 else { 91 87 nameTextBox.Enabled = infoLabel.Enabled = true; 88 UpdateExecutionTime(); 92 89 ReadOnly = Locked = false; 93 90 SetEnabledStateOfExecutableButtons(); … … 98 95 Invoke(new EventHandler(Content_Started), sender, e); 99 96 else { 97 executionTimer.Start(); 100 98 nameTextBox.Enabled = infoLabel.Enabled = false; 101 99 ReadOnly = Locked = true; … … 107 105 Invoke(new EventHandler(Content_Paused), sender, e); 108 106 else { 107 executionTimer.Stop(); 108 UpdateExecutionTime(); 109 109 nameTextBox.Enabled = infoLabel.Enabled = true; 110 110 ReadOnly = Locked = false; … … 116 116 Invoke(new EventHandler(Content_Stopped), sender, e); 117 117 else { 118 executionTimer.Stop(); 119 UpdateExecutionTime(); 118 120 nameTextBox.Enabled = infoLabel.Enabled = true; 119 121 ReadOnly = Locked = false; … … 121 123 } 122 124 } 123 protected virtual void Content_ExecutionTimeChanged(object sender, EventArgs e) {124 if (InvokeRequired)125 Invoke(new EventHandler(Content_ExecutionTimeChanged), sender, e);126 else127 executionTimeTextBox.Text = Content == null ? "-" : Content.ExecutionTime.ToString();128 }129 125 protected virtual void Content_ExceptionOccurred(object sender, EventArgs<Exception> e) { 130 126 if (InvokeRequired) 131 127 Invoke(new EventHandler<EventArgs<Exception>>(Content_ExceptionOccurred), sender, e); 132 else 128 else { 129 executionTimer.Stop(); 130 UpdateExecutionTime(); 133 131 ErrorHandling.ShowErrorDialog(this, e.Value); 132 } 134 133 } 135 134 #endregion … … 147 146 protected virtual void resetButton_Click(object sender, EventArgs e) { 148 147 Content.Prepare(false); 148 } 149 private void executionTimer_Tick(object sender, EventArgs e) { 150 UpdateExecutionTime(); 151 } 152 153 private void UpdateExecutionTime() { 154 executionTimeTextBox.Text = (Content == null ? "-" : Content.ExecutionTime.ToString()); 149 155 } 150 156 #endregion
Note: See TracChangeset
for help on using the changeset viewer.