[7582] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
[12018] | 3 | * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
[7582] | 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 |
|
---|
| 22 | using System;
|
---|
[8165] | 23 | using HeuristicLab.Common;
|
---|
[7582] | 24 |
|
---|
| 25 | namespace HeuristicLab.MainForm {
|
---|
[8165] | 26 | public enum ProgressState { Started = 1, Canceled = 2, Finished = 3 };
|
---|
[7582] | 27 |
|
---|
[8165] | 28 | public interface IProgress : IContent {
|
---|
| 29 | /// <summary>
|
---|
[9849] | 30 | /// Gets or sets the currently associated status text with the progress.
|
---|
[8165] | 31 | /// </summary>
|
---|
[9849] | 32 | string Status { get; set; }
|
---|
[8165] | 33 | /// <summary>
|
---|
[9849] | 34 | /// Gets or sets the currently associated progress value in the range (0;1].
|
---|
[8165] | 35 | /// Values outside this range are permitted and need to be handled in some feasible manner.
|
---|
| 36 | /// </summary>
|
---|
[9849] | 37 | double ProgressValue { get; set; }
|
---|
[8165] | 38 | /// <summary>
|
---|
[9849] | 39 | /// Gets or sets the current state of the progress. Every progress starts in state
|
---|
[8165] | 40 | /// Started and then becomes either Canceled or Finished.
|
---|
| 41 | /// If it is reused it may be Started again.
|
---|
| 42 | /// </summary>
|
---|
[9894] | 43 | ProgressState ProgressState { get; }
|
---|
[8165] | 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; }
|
---|
[7582] | 49 |
|
---|
[8165] | 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>
|
---|
[9894] | 56 | void Cancel();
|
---|
[9849] | 57 | /// <summary>
|
---|
| 58 | /// Sets the ProgressValue to 1 and the ProgressState to Finished.
|
---|
| 59 | /// </summary>
|
---|
| 60 | void Finish();
|
---|
[8156] | 61 |
|
---|
[9894] | 62 | /// <summary>
|
---|
| 63 | /// Starts or restarts a Progress.
|
---|
| 64 | /// </summary>
|
---|
| 65 | void Start();
|
---|
| 66 |
|
---|
[9893] | 67 | void Start(string status);
|
---|
| 68 |
|
---|
[8165] | 69 | /// <summary>
|
---|
| 70 | /// The status text changed.
|
---|
| 71 | /// </summary>
|
---|
[7582] | 72 | event EventHandler StatusChanged;
|
---|
[8165] | 73 | /// <summary>
|
---|
| 74 | /// 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.
|
---|
| 75 | /// </summary>
|
---|
[7582] | 76 | event EventHandler ProgressValueChanged;
|
---|
[8165] | 77 | /// <summary>
|
---|
| 78 | /// The state of the progress changed. The handler is supposed to query the ProgressState property.
|
---|
| 79 | /// </summary>
|
---|
| 80 | event EventHandler ProgressStateChanged;
|
---|
| 81 | /// <summary>
|
---|
| 82 | /// The progress' ability to cancel changed.
|
---|
| 83 | /// </summary>
|
---|
| 84 | event EventHandler CanBeCanceledChanged;
|
---|
| 85 | /// <summary>
|
---|
[9894] | 86 | /// A cancelation is requested.
|
---|
[8165] | 87 | /// </summary>
|
---|
[9894] | 88 | event EventHandler CancelRequested;
|
---|
[7582] | 89 | }
|
---|
| 90 | }
|
---|