Showing the changes to Source/Libraries/GSF.Core/ProcessProgress.cs (1 of 628 files). Show all
Unified · Split
| @@ -0,0 +1,151 @@ | ||
| 1 | +//****************************************************************************************************** | |
| 2 | +// ProcessProgress.cs - Gbtc | |
| 3 | +// | |
| 4 | +// Copyright � 2010, Grid Protection Alliance. All Rights Reserved. | |
| 5 | +// | |
| 6 | +// Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See | |
| 7 | +// the NOTICE file distributed with this work for additional information regarding copyright ownership. | |
| 8 | +// The GPA licenses this file to you under the Eclipse Public License -v 1.0 (the "License"); you may | |
| 9 | +// not use this file except in compliance with the License. You may obtain a copy of the License at: | |
| 10 | +// | |
| 11 | +// http://www.opensource.org/licenses/eclipse-1.0.php | |
| 12 | +// | |
| 13 | +// Unless agreed to in writing, the subject software distributed under the License is distributed on an | |
| 14 | +// "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the | |
| 15 | +// License for the specific language governing permissions and limitations. | |
| 16 | +// | |
| 17 | +// Code Modification History: | |
| 18 | +// ---------------------------------------------------------------------------------------------------- | |
| 19 | +// 05/23/2007 - Pinal C. Patel | |
| 20 | +// Generated original version of source code. | |
| 21 | +// 09/09/2008 - J. Ritchie Carroll | |
| 22 | +// Converted to C#. | |
| 23 | +// 09/26/2008 - J. Ritchie Carroll | |
| 24 | +// Added a ProcessProgress.Handler class to allow functions with progress delegate | |
| 25 | +// to update progress information using the ProcessProgress class. | |
| 26 | +// 09/14/2009 - Stephen C. Wills | |
| 27 | +// Added new header and license agreement. | |
| 28 | +// 10/8/2012 - Danyelle Gilliam | |
| 29 | +// Modified Header | |
| 30 | +// | |
| 31 | +//****************************************************************************************************** | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | +using System; | |
| 36 | + | |
| 37 | +namespace GSF | |
| 38 | +{ | |
| 39 | + /// <summary> | |
| 40 | + /// Represents current process progress for an operation. | |
| 41 | + /// </summary> | |
| 42 | + /// <remarks> | |
| 43 | + /// Used to track total progress of an identified operation. | |
| 44 | + /// </remarks> | |
| 45 | + /// <typeparam name="TUnit">Unit of progress used (long, double, int, etc.)</typeparam> | |
| 46 | + [Serializable()] | |
| 47 | + public class ProcessProgress<TUnit> where TUnit : struct | |
| 48 | + { | |
| 49 | + #region [ Members ] | |
| 50 | + | |
| 51 | + // Fields | |
| 52 | + private string m_processName; | |
| 53 | + private string m_progressMessage; | |
| 54 | + private TUnit m_total; | |
| 55 | + private TUnit m_complete; | |
| 56 | + | |
| 57 | + #endregion | |
| 58 | + | |
| 59 | + #region [ Constructors ] | |
| 60 | + | |
| 61 | + /// <summary> | |
| 62 | + /// Constructs a new instance of the <see cref="ProcessProgress{TUnit}"/> class using specified process name. | |
| 63 | + /// </summary> | |
| 64 | + /// <param name="processName">Name of process for which progress is being monitored.</param> | |
| 65 | + public ProcessProgress(string processName) | |
| 66 | + { | |
| 67 | + m_processName = processName; | |
| 68 | + } | |
| 69 | + | |
| 70 | + /// <summary> | |
| 71 | + /// Constructs a new instance of the <see cref="ProcessProgress{TUnit}"/> class using specified parameters. | |
| 72 | + /// </summary> | |
| 73 | + /// <param name="processName">Name of process for which progress is being monitored.</param> | |
| 74 | + /// <param name="processMessage">Current processing message, if any.</param> | |
| 75 | + /// <param name="total">Total number of units to be processed.</param> | |
| 76 | + /// <param name="complete">Number of units completed processing so far.</param> | |
| 77 | + public ProcessProgress(string processName, string processMessage, TUnit total, TUnit complete) | |
| 78 | + { | |
| 79 | + m_processName = processName; | |
| 80 | + m_progressMessage = processMessage; | |
| 81 | + m_total = total; | |
| 82 | + m_complete = complete; | |
| 83 | + } | |
| 84 | + | |
| 85 | + #endregion | |
| 86 | + | |
| 87 | + #region [ Properties ] | |
| 88 | + | |
| 89 | + /// <summary> | |
| 90 | + /// Gets or sets name of process for which progress is being monitored. | |
| 91 | + /// </summary> | |
| 92 | + public string ProcessName | |
| 93 | + { | |
| 94 | + get | |
| 95 | + { | |
| 96 | + return m_processName; | |
| 97 | + } | |
| 98 | + set | |
| 99 | + { | |
| 100 | + m_processName = value; | |
| 101 | + } | |
| 102 | + } | |
| 103 | + | |
| 104 | + /// <summary> | |
| 105 | + /// Gets or sets current progress message (e.g., current file being copied, etc.) | |
| 106 | + /// </summary> | |
| 107 | + public string ProgressMessage | |
| 108 | + { | |
| 109 | + get | |
| 110 | + { | |
| 111 | + return m_progressMessage; | |
| 112 | + } | |
| 113 | + set | |
| 114 | + { | |
| 115 | + m_progressMessage = value; | |
| 116 | + } | |
| 117 | + } | |
| 118 | + | |
| 119 | + /// <summary> | |
| 120 | + /// Gets or sets total number of units to be processed. | |
| 121 | + /// </summary> | |
| 122 | + public TUnit Total | |
| 123 | + { | |
| 124 | + get | |
| 125 | + { | |
| 126 | + return m_total; | |
| 127 | + } | |
| 128 | + set | |
| 129 | + { | |
| 130 | + m_total = value; | |
| 131 | + } | |
| 132 | + } | |
| 133 | + | |
| 134 | + /// <summary> | |
| 135 | + /// Gets or sets number of units completed processing so far. | |
| 136 | + /// </summary> | |
| 137 | + public TUnit Complete | |
| 138 | + { | |
| 139 | + get | |
| 140 | + { | |
| 141 | + return m_complete; | |
| 142 | + } | |
| 143 | + set | |
| 144 | + { | |
| 145 | + m_complete = value; | |
| 146 | + } | |
| 147 | + } | |
| 148 | + | |
| 149 | + #endregion | |
| 150 | + } | |
| 151 | +} | |