Changeset 14287
- Timestamp:
- 09/17/16 18:59:47 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/Controls/ProgressView.cs
r14185 r14287 141 141 142 142 private void UpdateProgressValue() { 143 if (InvokeRequired) Invoke((Action)UpdateProgressValue); 144 else { 143 // prevent problems with object disposal and invoke as suggested by http://stackoverflow.com/a/18647091 144 if (!IsHandleCreated) return; 145 if (InvokeRequired) { 146 try { 147 Invoke((Action)UpdateProgressValue); 148 } 149 catch (InvalidOperationException) { 150 if (this.IsHandleCreated) throw; 151 } 152 } else { 145 153 if (content != null) { 146 154 double progressValue = content.ProgressValue; … … 149 157 } else { 150 158 progressBar.Style = ProgressBarStyle.Blocks; 151 progressBar.Value = (int)Math.Round(progressBar.Minimum + progressValue * (progressBar.Maximum - progressBar.Minimum)); 159 progressBar.Value = 160 (int)Math.Round(progressBar.Minimum + progressValue * (progressBar.Maximum - progressBar.Minimum)); 152 161 } 153 162 }
Note: See TracChangeset
for help on using the changeset viewer.