Changeset 15445


Ignore:
Timestamp:
11/03/17 09:45:03 (22 months ago)
Author:
pfleck
Message:

#2845: Removed progressbar state (green/orange/red).

Location:
branches/EnhancedProgress
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/EnhancedProgress/HeuristicLab.MainForm.WindowsForms/3.3/Controls/ProgressView.cs

    r15417 r15445  
    2121
    2222using System;
    23 using System.Runtime.InteropServices;
    2423using System.Windows.Forms;
    2524
     
    147146      else
    148147        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       }
    163148    }
    164149
     
    171156      messageLabel.Text = content.Message;
    172157    }
    173 
    174158
    175159    private void UpdateProgressValue() {
     
    191175      } else {
    192176        progressBar.Style = ProgressBarStyle.Marquee;
     177        progressBar.Value = 0;
    193178      }
    194179    }
     
    220205    }
    221206  }
    222 
    223   // https://stackoverflow.com/a/9753302
    224   internal enum ProgressBarState {
    225     Normal = 1, Error = 2, Warning = 3
    226   }
    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   }
    234207}
  • branches/EnhancedProgress/HeuristicLab.MainForm/3.3/Progress.cs

    r15417 r15445  
    100100    }
    101101
     102    /// <summary>
     103    /// Starts an "undefined" progress in marquee-mode
     104    /// </summary>
    102105    public void Start(string message) {
    103106      ProgressState = ProgressState.Started;
     
    105108      Message = message;
    106109    }
     110    /// <summary>
     111    /// Starts a progress in continuous-mode
     112    /// </summary>
    107113    public void Start(string message, double progressValue) {
    108114      ProgressState = ProgressState.Started;
Note: See TracChangeset for help on using the changeset viewer.