PowerTCP Mail for .NET
ImapProgressEventArgs Class
Members  Example  See Also  Send comments on this topic.
Dart.PowerTCP.Mail Namespace : ImapProgressEventArgs Class




Provides data for the Imap.Progress event.

Object Model

ImapProgressEventArgs ClassImapMessage Class

Syntax

Visual Basic (Declaration) 
Public Class ImapProgressEventArgs 
   Inherits System.EventArgs
Visual Basic (Usage)Copy Code
Dim instance As ImapProgressEventArgs
C# 
public class ImapProgressEventArgs : System.EventArgs 
Managed Extensions for C++ 
public __gc class ImapProgressEventArgs : public System.EventArgs 
C++/CLI 
public ref class ImapProgressEventArgs : public System.EventArgs 

Example

The following example demonstrates displaying progress when getting messages.
Visual BasicCopy Code
Private Sub GetTest()
   ' Login
   Imap1.Login(Server, User, Pass)
   
   ' Get all messages in INBOX, this will cause the Progress event to be raised.
   Imap1.CurrentMailbox.Get()
   
   ' Logout
   Imap1.Logout()
End Sub
    
Private Sub Imap1_Progress(ByVal sender As Object, ByVal e As Dart.PowerTCP.Mail.ImapProgressEventArgs) Handles Imap1.Progress
   ProgressBar.Minimum = 0
   ProgressBar.Maximum = e.Length
   ProgressBar.Value = e.Position
   LblProgress.Text = "Processing message " + e.Message.Id

   If e.Length = e.Position Then
      LblProgress.Text = "Complete"
   End If
End Sub
C#Copy Code
private void GetTest()
{
   // Login
   imap1.Login(Server, User, Pass);
   
   // Get all messages in INBOX, this will cause the Progress event to be raised.
   imap1.CurrentMailbox.Get();
   
   // Logout
   imap1.Logout();
}

private void imap1_Progress(object sender, Dart.PowerTCP.Mail.ImapProgressEventArgs e)
{
   progressBar.Minimum = 0;
   progressBar.Maximum = (int)e.Length;
   progressBar.Value = (int)e.Position;
   lblProgress.Text = "Processing message " + e.Message.Id;

   if(e.Length == e.Position)
      lblProgress.Text = "Complete";
}

Remarks

This class provides data for the Imap.Progress event, which is raised periodically while a message or message section is being transferred. The ImapProgressEventArgs.Message property represents the actual message being transferred.

The value of ImapProgressEventArgs.Length and ImapProgressEventArgs.Position depends on the operation. For example:

  • If downloading headers, ImapProgressEventArgs.Length is the total length of the headers. ImapProgressEventArgs.Position is the count of bytes received.
  • If downloading messages, ImapProgressEventArgs.Length is the total length of the message. ImapProgressEventArgs.Position is the count of bytes received.
  • If downloading body structure or envelope, both of these values will be 0, because the total amount of data being retrieved is unknown.

Inheritance Hierarchy

System.Object
   System.EventArgs
      Dart.PowerTCP.Mail.ImapProgressEventArgs

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

Documentation Version 3.2
© 2010 Dart Communications. All Rights Reserved.