1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2018 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 |
|
---|
22 | using System;
|
---|
23 | using HeuristicLab.Common;
|
---|
24 |
|
---|
25 | namespace HeuristicLab.MainForm {
|
---|
26 | public enum ProgressState { Started, Finished, StopRequested, CancelRequested }
|
---|
27 | public enum ProgressBarMode { Continuous, Marquee }
|
---|
28 |
|
---|
29 | public interface IProgress : IContent {
|
---|
30 | ProgressState ProgressState { get; }
|
---|
31 | string Message { get; set; }
|
---|
32 | ProgressBarMode ProgressBarMode { get; set; }
|
---|
33 | /// <summary>
|
---|
34 | /// Gets or sets the currently associated progress value in the range [0;1] (values outside the range are truncated).
|
---|
35 | /// Changing the ProgressValue when ProgressBarMode is Marquee raises an Exception.
|
---|
36 | /// </summary>
|
---|
37 | /// <exception cref="InvalidOperationException">Setting the ProgressValue-property while in the Marquee state is invalid.</exception>
|
---|
38 | double ProgressValue { get; set; }
|
---|
39 | bool CanBeStopped { get; }
|
---|
40 | bool CanBeCanceled { get; }
|
---|
41 |
|
---|
42 | /// <summary>
|
---|
43 | /// Start (or Restart) a progress in ProgressBarMode Continues to display specific progress values (from 0 to 1).
|
---|
44 | /// A new progress value is reported by setting the ProgressValue-property.
|
---|
45 | /// </summary>
|
---|
46 | void Start(string message, double progressValue = 0);
|
---|
47 |
|
---|
48 | /// <summary>
|
---|
49 | /// Start (or Restart) a progress in ProgressBarMode Marquee to define an "unknown" progress state.
|
---|
50 | /// Consider using marquee when the progress is not measurable but the user should be notified that something is still happening.
|
---|
51 | /// Setting the ProgressValue-property in the Marquee state throws an exception.
|
---|
52 | /// </summary>
|
---|
53 | void StartMarquee(string message);
|
---|
54 |
|
---|
55 | void Finish();
|
---|
56 | void Stop();
|
---|
57 | void Cancel();
|
---|
58 |
|
---|
59 | event EventHandler ProgressStateChanged;
|
---|
60 | event EventHandler MessageChanged;
|
---|
61 | event EventHandler ProgressBarModeChanged;
|
---|
62 | event EventHandler ProgressValueChanged;
|
---|
63 | event EventHandler CanBeStoppedChanged;
|
---|
64 | event EventHandler CanBeCanceledChanged;
|
---|
65 | event EventHandler StopRequested;
|
---|
66 | event EventHandler CancelRequested;
|
---|
67 | }
|
---|
68 | }
|
---|