// // ProgressEvent.cs - provide a way to signal progress to UI from non-UI code // // Author: // Michael Becker // // Copyright (c) 2011-2020 Mike Becker's Software // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . using System; using System.ComponentModel; namespace UniversalEditor { /// /// A delegate for the event that is raised when progress is made during an asynchronous operation. /// /// The control firing this event. /// A that contains additional information about this event. public delegate void ProgressEventHandler(object sender, ProgressEventArgs e); /// /// Event arguments for the event that is raised when progress is made during an asynchronous operation. /// public class ProgressEventArgs : CancelEventArgs { private long mvarTotal = 0; /// /// The total possible amount of progress represented by this progress event. /// public long Total { get { return mvarTotal; } } private long mvarCurrent = 0; /// /// The current amount of progress completed. /// public long Current { get { return mvarCurrent; } } /// /// The amount of progress remaining. /// public long Remaining { get { return mvarTotal - mvarCurrent; } } private string mvarMessage = String.Empty; /// /// The progress message /// public string Message { get { return mvarMessage; } } /// /// Creates a new instance of the event arguments for the event that is /// raised when progress is made during an asynchronous operation. /// /// The current amount of progress completed. /// The total possible amount of progress represented by this progress event. /// The progress message public ProgressEventArgs(long current, long total, string message = "") { mvarCurrent = current; mvarTotal = total; mvarMessage = message; } } }