Dart.Mail Namespace > Pop Class : Progress Event |
Public Event Progress As EventHandler(Of PopProgressEventArgs)
Dim instance As Pop Dim handler As EventHandler(Of PopProgressEventArgs) AddHandler instance.Progress, handler
public event EventHandler<PopProgressEventArgs> Progress
public: __event EventHandler<PopProgressEventArgs*>* Progress
public: event EventHandler<PopProgressEventArgs^>^ Progress
The event handler receives an argument of type PopProgressEventArgs containing data related to this event. The following PopProgressEventArgs properties provide information specific to this event.
Property | Description |
---|---|
Final | Returns true the last time a Progress event is raised for a given message. (Inherited from Dart.Mail.ProgressEventArgs) |
Length | The length of the message data. (Inherited from Dart.Mail.ProgressEventArgs) |
Message | Gets the PopMessage representing the message currently being retrieved. |
Position | The position within the message data. (Inherited from Dart.Mail.ProgressEventArgs) |
When a message is retrieved Progress is raised as each data buffer is processed. It contains PopProgressEventArgs, providing data useful for displaying progress to the user. For example, if you wish to display progress for the retrieval of ALL messages using a ProgressBar, use 0 for System.Windows.Forms.ProgressBar.Minimum, pop1.Messages.Length for System.Windows.Forms.ProgressBar.Maximum, and MessageBase.Id as System.Windows.Forms.ProgressBar.Value. If you wish to display progress for each message, use 0 for System.Windows.Forms.ProgressBar.Minimum, ProgressEventArgs.Length for System.Windows.Forms.ProgressBar.Maximum, and ProgressEventArgs.Position for System.Windows.Forms.ProgressBar.Value.
ProgressEventArgs.Length uses MessageBase.Size, so the 'getSizes' parameter of Authenticate must be true if a valid length is desired.
Set ComponentBase.SynchronizingObject to enable marshaling of this event to the UI thread.
private void previewMessages(object sender) { //Configure server and account info pop1.Session.RemoteEndPoint = new Dart.Mail.IPEndPoint(myServer, Pop.GetDefaultPort(pop1.Session)); pop1.Session.Username = myUsername; pop1.Session.Password = myPassword; //Connect and log into the account pop1.Connect(); pop1.Authenticate(true, true); //Get header fields for each message in the account foreach (PopMessage popMessage in pop1.Messages) popMessage.Get(0); //Gracefully logout of the session pop1.Close(); } private void pop1_Progress(object sender, PopProgressEventArgs e) { //Display message header info in a listview if (e.Final) { string[] header = { e.Message.Message.From, e.Message.Message.Subject, e.Message.Message.Date.ToString() }; listView1.Items.Add(new ListViewItem(header)); } }
Private Sub previewMessages(ByVal sender As Object) 'Configure server and account info pop1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint(myServer, Pop.GetDefaultPort(pop1.Session)) pop1.Session.Username = myUsername pop1.Session.Password = myPassword 'Connect and log into the account pop1.Connect() pop1.Authenticate(True, True) 'Get header fields for each message in the account For Each popMessage As PopMessage In pop1.Messages popMessage.Get(0) Next popMessage 'Gracefully logout of the session pop1.Close() End Sub Private Sub pop1_Progress(ByVal sender As Object, ByVal e As PopProgressEventArgs) Handles pop1.Progress 'Display message header info in a listview If e.Final Then Dim header() As String = { e.Message.Message.From, e.Message.Message.Subject, e.Message.Message.Date.ToString() } listView1.Items.Add(New ListViewItem(header)) End If End Sub