Dart.PowerTCP.Zip Namespace > Archive Class : Progress Event |
<DescriptionAttribute("Raised to report the progress of a zip or unzip operation.")> <CategoryAttribute("Progress")> Public Event Progress As ProgressEventHandler
Dim instance As Archive Dim handler As ProgressEventHandler AddHandler instance.Progress, handler
[Description("Raised to report the progress of a zip or unzip operation.")] [Category("Progress")] public event ProgressEventHandler Progress
[Description("Raised to report the progress of a zip or unzip operation.")] [Category("Progress")] public: __event ProgressEventHandler* Progress
[Description("Raised to report the progress of a zip or unzip operation.")] [Category("Progress")] public: event ProgressEventHandler^ Progress
The event handler receives an argument of type ProgressEventArgs containing data related to this event. The following ProgressEventArgs properties provide information specific to this event.
Property | Description |
---|---|
Item | The ArchiveItem object currently being processed. |
ItemIndex | The index of the ArchiveItem object currently being processed. |
ProcessedItemBytes | The total uncompressed bytes already processed by the ArchiveItem. |
ProcessedTotalBytes | The cumulative number of bytes that have been processed in the Archive collection during the current operation. |
Status | The status of the current on-going operation. |
TotalBytes | The total bytes to be processed for this operation. |
A ProgressEventArgs object is passed to the event handler, containing details about the operation underway.
Not using the Progress event can improve the performance of your application as marshalling data from the worker thread to the UI thread will use available resources.
' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip" ' at the top of your class. Private Sub Archive1_Progress(ByVal sender As Object, ByVal e As Dart.PowerTCP.Zip.ProgressEventArgs) Handles Archive1.Progress Try ' Set the progress bar and status when fires ' prgItem is the progress bar for an individual item and prgTotal is for all the items. Select Case (e.Status) Case Status.Unzipping ' Show item progress prgItem.Maximum = e.Item.Size prgItem.Value = e.processedItemBytes ' Show total progress prgTotal.Maximum = e.TotalBytes prgTotal.Value = e.ProcessedTotalBytes Debug.WriteLine("Unzipping " + e.Item.Name) Case Status.EndUnzip prgTotal.Value = prgTotal.Maximum End Select Catch End Try End Sub
// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;" // at the top of your class. private void archive1_Progress(object sender, Dart.PowerTCP.Zip.ProgressEventArgs e) { try { // Set the progress bar and status when fires // prgItem is the progress bar for an individual item and prgTotal is for all the items. switch (e.Status) { case Status.Unzipping: // Show item progress prgItem.Maximum = (int)e.Item.Size; prgItem.Value = (int)e.ProcessedItemBytes; // Show total progress prgTotal.Maximum = (int)e.TotalBytes; prgTotal.Value = (int)e.ProcessedTotalBytes; Debug.WriteLine("Unzipping " + e.Item.Name); break; case Status.EndUnzip: prgTotal.Value = prgTotal.Maximum; break; } } catch {} }