Changeset 15445
- Timestamp:
- 11/03/17 09:45:03 (7 years ago)
- Location:
- branches/EnhancedProgress
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/EnhancedProgress/HeuristicLab.MainForm.WindowsForms/3.3/Controls/ProgressView.cs
r15417 r15445 21 21 22 22 using System; 23 using System.Runtime.InteropServices;24 23 using System.Windows.Forms; 25 24 … … 147 146 else 148 147 HideProgress(); 149 150 switch (content.ProgressState) {151 case ProgressState.Started:152 case ProgressState.Finished:153 progressBar.SetState(ProgressBarState.Normal);154 break;155 case ProgressState.StopRequested:156 progressBar.SetState(ProgressBarState.Warning);157 break;158 case ProgressState.CancelRequested:159 progressBar.SetState(ProgressBarState.Error);160 break;161 default: throw new NotSupportedException("The progress state " + content.ProgressState + " is not supported by the ProgressView.");162 }163 148 } 164 149 … … 171 156 messageLabel.Text = content.Message; 172 157 } 173 174 158 175 159 private void UpdateProgressValue() { … … 191 175 } else { 192 176 progressBar.Style = ProgressBarStyle.Marquee; 177 progressBar.Value = 0; 193 178 } 194 179 } … … 220 205 } 221 206 } 222 223 // https://stackoverflow.com/a/9753302224 internal enum ProgressBarState {225 Normal = 1, Error = 2, Warning = 3226 }227 internal static class ProgressBarStateExtension {228 [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)]229 private static extern IntPtr SendMessage(IntPtr hWnd, uint msg, IntPtr w, IntPtr l);230 public static void SetState(this ProgressBar pBar, ProgressBarState state) {231 SendMessage(pBar.Handle, 1040, (IntPtr)state, IntPtr.Zero);232 }233 }234 207 } -
branches/EnhancedProgress/HeuristicLab.MainForm/3.3/Progress.cs
r15417 r15445 100 100 } 101 101 102 /// <summary> 103 /// Starts an "undefined" progress in marquee-mode 104 /// </summary> 102 105 public void Start(string message) { 103 106 ProgressState = ProgressState.Started; … … 105 108 Message = message; 106 109 } 110 /// <summary> 111 /// Starts a progress in continuous-mode 112 /// </summary> 107 113 public void Start(string message, double progressValue) { 108 114 ProgressState = ProgressState.Started;
Note: See TracChangeset
for help on using the changeset viewer.