Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
ProgressStatusEventArgs.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using System;
4 
5 namespace SiliconStudio.Core.Diagnostics
6 {
7  /// <summary>
8  /// An event indicating the progress of an operation.
9  /// </summary>
11  {
12  private readonly string message;
13  private readonly int currentStep;
14  private readonly int stepCount;
15  private readonly bool hasKnownSteps;
16 
17  /// <summary>
18  /// Initializes a new instance of the <see cref="ProgressStatusEventArgs"/> class.
19  /// </summary>
20  /// <param name="message">The message.</param>
21  public ProgressStatusEventArgs(string message)
22  {
23  if (message == null) throw new ArgumentNullException("message");
24  this.message = message;
25  stepCount = 1;
26  hasKnownSteps = false;
27  }
28 
29  /// <summary>
30  /// Initializes a new instance of the <see cref="ProgressStatusEventArgs"/> class.
31  /// </summary>
32  /// <param name="message">The message.</param>
33  /// <param name="currentStep">The current step.</param>
34  /// <param name="stepCount">The step count.</param>
35  public ProgressStatusEventArgs(string message, int currentStep, int stepCount)
36  {
37  if (message == null) throw new ArgumentNullException("message");
38  if (currentStep < 0) throw new ArgumentOutOfRangeException("currentStep", "Expecting value >= 0");
39  if (stepCount < 1) throw new ArgumentOutOfRangeException("stepCount", "Expecting value >= 1");
40  this.message = message;
41  this.currentStep = currentStep;
42  this.stepCount = stepCount;
43  this.hasKnownSteps = true;
44  }
45 
46  /// <summary>
47  /// Gets or sets the message associated with the progress.
48  /// </summary>
49  /// <value>The message.</value>
50  public string Message
51  {
52  get
53  {
54  return message;
55  }
56  }
57 
58  /// <summary>
59  /// Gets or sets a value indicating whether this instance has known steps (<see cref="CurrentStep"/> and
60  /// <see cref="StepCount"/> are valid).
61  /// </summary>
62  /// <value><c>true</c> if this instance has known steps; otherwise, <c>false</c>.</value>
63  public bool HasKnownSteps
64  {
65  get
66  {
67  return hasKnownSteps;
68  }
69  }
70 
71  /// <summary>
72  /// Gets or sets the current index of the indicative step. See <see cref="StepCount"/> remarks.
73  /// </summary>
74  /// <value>The index of the step.</value>
75  public int CurrentStep
76  {
77  get
78  {
79  return currentStep;
80  }
81  }
82 
83  /// <summary>
84  /// Gets or sets the step count used to indicate the number expected steps returned by this logger result. See remarks.
85  /// </summary>
86  /// <value>The step count, greater than 1. Default is 1</value>
87  /// <exception cref="System.ArgumentOutOfRangeException">Expecting value >= 1;value</exception>
88  /// <remarks>
89  /// This property providea an estimation of the duration of an operation in terms of "step counts".
90  /// The <see cref="CurrentStep"/> property returns the current step and gives indication about how much is still
91  /// being processed.
92  /// </remarks>
93  public int StepCount
94  {
95  get
96  {
97  return stepCount;
98  }
99  }
100  }
101 }
An event indicating the progress of an operation.
ProgressStatusEventArgs(string message)
Initializes a new instance of the ProgressStatusEventArgs class.
ProgressStatusEventArgs(string message, int currentStep, int stepCount)
Initializes a new instance of the ProgressStatusEventArgs class.