Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/21/13 23:08:47 (11 years ago)
Author:
ascheibe
Message:

#1042

  • applied mkommends progress view patch
  • adapted Hive views accordingly
  • made some minor improvements (more to come...)
Location:
trunk/sources/HeuristicLab.MainForm/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.MainForm/3.3/Interfaces/IProgress.cs

    r9849 r9893  
    5555    /// <exception cref="NotSupportedException">Thrown when cancellation is not supported.</exception>
    5656    /// <param name="timeoutMs">The operation is given a certain timeout to cancel. If the operation doesn't cancel in this time it will be forcibly closed.</param>
    57     void Cancel(int timeoutMs);
     57    void Cancel(int timeoutMs = 0);
    5858    /// <summary>
    5959    /// Sets the ProgressValue to 1 and the ProgressState to Finished.
    6060    /// </summary>
    6161    void Finish();
     62
     63    void Start(string status);
     64
     65    void Start();
    6266
    6367    /// <summary>
  • trunk/sources/HeuristicLab.MainForm/3.3/Progress.cs

    r9849 r9893  
    7070
    7171    public Progress() {
    72       progressState = ProgressState.Started;
     72      progressState = ProgressState.Finished;
     73      canBeCanceled = false;
    7374    }
    7475    public Progress(string status)
     
    7677      this.status = status;
    7778    }
    78     public Progress(string status, double progressValue)
    79       : this(status) {
    80       this.progressValue = progressValue;
     79    public Progress(string status, ProgressState state)
     80      : this() {
     81      this.status = status;
     82      this.progressState = state;
    8183    }
    8284
    83     public void Cancel(int timeoutMs) {
     85    public void Cancel(int timeoutMs = 0) {
    8486      if (canBeCanceled)
    8587        OnCancelRequested(timeoutMs);
     
    9193    }
    9294
     95    public void Start() {
     96      ProgressValue = 0.0;
     97      ProgressState = ProgressState.Started;
     98    }
     99
     100    public void Start(string status) {
     101      Start();
     102      Status = status;
     103    }
     104
    93105    #region Event Handler
    94106    public event EventHandler StatusChanged;
    95107    private void OnStatusChanged() {
    96108      var handler = StatusChanged;
    97       try {
    98         if (handler != null) handler(this, EventArgs.Empty);
    99       } catch { }
     109      if (handler != null) handler(this, EventArgs.Empty);
    100110    }
    101111
     
    103113    private void OnProgressChanged() {
    104114      var handler = ProgressValueChanged;
    105       try {
    106         if (handler != null) handler(this, EventArgs.Empty);
    107       } catch { }
     115      if (handler != null) handler(this, EventArgs.Empty);
    108116    }
    109117
     
    111119    private void OnProgressStateChanged() {
    112120      var handler = ProgressStateChanged;
    113       try {
    114         if (handler != null) handler(this, EventArgs.Empty);
    115       } catch { }
     121      if (handler != null) handler(this, EventArgs.Empty);
    116122    }
    117123
     
    119125    private void OnCanBeCanceledChanged() {
    120126      var handler = CanBeCanceledChanged;
    121       try {
    122         if (handler != null) handler(this, EventArgs.Empty);
    123       } catch { }
     127      if (handler != null) handler(this, EventArgs.Empty);
     128
    124129    }
    125130
     
    127132    private void OnCancelRequested(int timeoutMs) {
    128133      var handler = CancelRequested;
    129       try {
    130         if (handler == null) throw new NotSupportedException("Cancel request was ignored.");
    131         else handler(this, new EventArgs<int>(timeoutMs));
    132       } catch { }
     134      if (handler != null) throw new NotSupportedException("Cancel request was ignored.");
     135      else handler(this, new EventArgs<int>(timeoutMs));
    133136    }
    134137    #endregion
Note: See TracChangeset for help on using the changeset viewer.