Class ProgressEventArgs
- Namespace
- VisioForge.Core.Types.Events
- Assembly
- VisioForge.Core.dll
Provides data for progress update events, indicating the completion percentage of an operation.
public class ProgressEventArgs : EventArgsInheritance
Inherited Members
Examples
// Assume an event handler is registered for a progress event.
public void OnProgressUpdate(object sender, ProgressEventArgs e)
{
Console.WriteLine($"Operation progress: {e.Progress}%");
// Update a progress bar in a UI application.
// progressBar.Value = e.Progress;
if (e.Progress == 100)
{
Console.WriteLine("Operation completed!");
}
}
Remarks
This class is typically used to update user interfaces (e.g., progress bars) or log the progress of long-running tasks like file conversions, downloads, or processing. Progress value ranges from 0 (operation started) to 100 (operation completed). Events are raised periodically during lengthy operations to provide real-time feedback to users. Applications should update UI elements like progress bars, percentage labels, or estimated time remaining displays. Progress events help prevent applications from appearing frozen during long-running operations. Consider throttling UI updates if progress events are raised very frequently to avoid performance degradation. The frequency of progress updates depends on the operation type and may vary from every few frames to every second. Progress value of 100 indicates completion, but applications should still wait for completion events before cleanup. For operations that may fail, progress reaching 100 doesn't guarantee success - check stop or completion events for status. Progress events are typically raised on background threads, so UI updates must be marshaled to the appropriate thread. Long operations include video transcoding, file downloads, media analysis, or batch processing tasks.
Constructors
ProgressEventArgs(int)
Initializes a new instance of the VisioForge.Core.Types.Events.ProgressEventArgs class.
public ProgressEventArgs(int progress)Parameters
progressint-
The progress value in percentage (0-100).
Properties
Progress
Gets the current progress of the operation, expressed as a percentage (0-100).
public int Progress { get; }