Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.MainForm/3.3/Interfaces/IProgress.cs @ 8796

Last change on this file since 8796 was 8165, checked in by abeham, 12 years ago

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

File size: 3.4 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using HeuristicLab.Common;
24
25namespace HeuristicLab.MainForm {
26  public enum ProgressState { Started = 1, Canceled = 2, Finished = 3 };
27
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; }
49
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);
58
59    /// <summary>
60    /// The status text changed.
61    /// </summary>
62    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>
66    event EventHandler ProgressValueChanged;
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;
79  }
80}
Note: See TracBrowser for help on using the repository browser.