// /*************************************************************************** // Aaru Data Preservation Suite // ---------------------------------------------------------------------------- // // Filename : Events.cs // Author(s) : Natalia Portillo // // Component : Core algorithms. // // --[ Description ] ---------------------------------------------------------- // // Events to glue user interface with sidecar creation. // // --[ License ] -------------------------------------------------------------- // // 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 . // // ---------------------------------------------------------------------------- // Copyright © 2011-2021 Natalia Portillo // ****************************************************************************/ using Aaru.CommonTypes; namespace Aaru.Core { public sealed partial class Sidecar { /// Initializes a progress indicator (e.g. makes a progress bar visible) public event InitProgressHandler InitProgressEvent; /// Updates a progress indicator with text public event UpdateProgressHandler UpdateProgressEvent; /// Uninitializes a progress indicator (e.g. adds a newline to the console) public event EndProgressHandler EndProgressEvent; /// Initializes a secondary progress indicator (e.g. makes a progress bar visible) public event InitProgressHandler2 InitProgressEvent2; /// Event raised to update the values of a determinate progress bar public event UpdateProgressHandler2 UpdateProgressEvent2; /// Event raised when the progress bar is not longer needed public event EndProgressHandler2 EndProgressEvent2; /// Updates a status indicator public event UpdateStatusHandler UpdateStatusEvent; /// Initializes a progress indicator (e.g. makes a progress bar visible) public void InitProgress() => InitProgressEvent?.Invoke(); /// Updates a progress indicator with text public void UpdateProgress(string text, long current, long maximum) => UpdateProgressEvent?.Invoke(string.Format(text, current, maximum), current, maximum); /// Uninitializes a progress indicator (e.g. adds a newline to the console) public void EndProgress() => EndProgressEvent?.Invoke(); /// Initializes a secondary progress indicator (e.g. makes a progress bar visible) public void InitProgress2() => InitProgressEvent2?.Invoke(); /// Event raised to update the values of a determinate progress bar public void UpdateProgress2(string text, long current, long maximum) => UpdateProgressEvent2?.Invoke(string.Format(text, current, maximum), current, maximum); /// Event raised when the progress bar is not longer needed public void EndProgress2() => EndProgressEvent2?.Invoke(); /// Updates a status indicator public void UpdateStatus(string text, params object[] args) => UpdateStatusEvent?.Invoke(string.Format(text, args)); } }