Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/29/12 23:12:32 (12 years ago)
Author:
abeham
Message:

#1762: Some changes to progress handling, see the ticket for more details

File:
1 edited

Legend:

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

    r8156 r8165  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324
    2425namespace HeuristicLab.MainForm {
    25   public interface IProgress {
    26     string Status { get; set; }
    27     double ProgressValue { get; set; }
     26  public enum ProgressState { Started = 1, Canceled = 2, Finished = 3 };
    2827
    29     void Finish();
    30     void SignalSuccessfulCancelation();
     28  public interface IProgress : IContent {
     29    /// <summary>
     30    /// Gets the currently associated status text with the progress.
     31    /// </summary>
     32    string Status { get; }
     33    /// <summary>
     34    /// Gets the currently associated progress value in the range (0;1].
     35    ///  Values outside this range are permitted and need to be handled in some feasible manner.
     36    /// </summary>
     37    double ProgressValue { get; }
     38    /// <summary>
     39    /// Gets the current state of the progress. Every progress starts in state
     40    /// Started and then becomes either Canceled or Finished.
     41    /// If it is reused it may be Started again.
     42    /// </summary>
     43    ProgressState ProgressState { get; }
     44    /// <summary>
     45    /// Returns whether the operation can be canceled or not.
     46    /// This can change during the course of the progress.
     47    /// </summary>
     48    bool CanBeCanceled { get; }
    3149
    32     bool CancelRequested { get; set; }
     50    /// <summary>
     51    /// Requests the operation behind the process to cancel.
     52    /// Check the !ProgressState property when the cancellation succeeded.
     53    /// The corresponding event will also notify of a success.
     54    /// </summary>
     55    /// <exception cref="NotSupportedException">Thrown when cancellation is not supported.</exception>
     56    /// <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);
    3358
    34     event EventHandler Finished;
     59    /// <summary>
     60    /// The status text changed.
     61    /// </summary>
    3562    event EventHandler StatusChanged;
     63    /// <summary>
     64    /// The value of the progress changed. This is the (0;1] progress value from starting to finish. Values outside this range are permitted and need to be handled in some feasible manner.
     65    /// </summary>
    3666    event EventHandler ProgressValueChanged;
    37     event EventHandler Canceled;
     67    /// <summary>
     68    /// The state of the progress changed. The handler is supposed to query the ProgressState property.
     69    /// </summary>
     70    event EventHandler ProgressStateChanged;
     71    /// <summary>
     72    /// The progress' ability to cancel changed.
     73    /// </summary>
     74    event EventHandler CanBeCanceledChanged;
     75    /// <summary>
     76    /// A cancelation is requested with a certain timeout (in ms) in which it should occur gracefully. If the timeout is surpassed, it should be forcibly canceled.
     77    /// </summary>
     78    event EventHandler<EventArgs<int>> CancelRequested;
    3879  }
    3980}
Note: See TracChangeset for help on using the changeset viewer.