Dart.Mail Namespace > Imap Class : Progress Event |
Public Event Progress As EventHandler(Of ImapProgressEventArgs)
Dim instance As Imap Dim handler As EventHandler(Of ImapProgressEventArgs) AddHandler instance.Progress, handler
public event EventHandler<ImapProgressEventArgs> Progress
public: __event EventHandler<ImapProgressEventArgs*>* Progress
public: event EventHandler<ImapProgressEventArgs^>^ Progress
The event handler receives an argument of type ImapProgressEventArgs containing data related to this event. The following ImapProgressEventArgs 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 ImapMessage being transferred. |
Position | The position within the message data. (Inherited from Dart.Mail.ProgressEventArgs) |
private void getMessageHeaders(object sender) { //Configure server and account info imap1.Session.RemoteEndPoint = new Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session)); imap1.Session.Username = myUsername; imap1.Session.Password = myPassword; //Connect and log into the account imap1.Connect(); imap1.Authenticate(); //Select a mailbox imap1.SelectedMailbox = imap1.Mailboxes["INBOX"]; //Get headers for all messages in the box imap1.SelectedMailbox.Get(imap1.SelectedMailbox.ToArray(), ImapMessageInfo.Header); //Gracefully logout of the session imap1.Close(); } private void imap1_Progress(object sender, ImapProgressEventArgs e) { //Display progress in a progress bar progressBar1.Value = (int)((e.Position/e.Length)*100); //Display message header info in a listview if (e.Final) { progressBar1.Value = 0; string[] header = { e.Message.Message.From, e.Message.Message.Subject, e.Message.Message.Date.ToString() }; listView1.Items.Add(new ListViewItem(header)); } }
Private Sub getMessageHeaders(ByVal sender As Object) 'Configure server and account info imap1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session)) imap1.Session.Username = myUsername imap1.Session.Password = myPassword 'Connect and log into the account imap1.Connect() imap1.Authenticate() 'Select a mailbox imap1.SelectedMailbox = imap1.Mailboxes("INBOX") 'Get headers for all messages in the box imap1.SelectedMailbox.Get(imap1.SelectedMailbox.ToArray(), ImapMessageInfo.Header) 'Gracefully logout of the session imap1.Close() End Sub Private Sub imap1_Progress(ByVal sender As Object, ByVal e As ImapProgressEventArgs) Handles imap1.Progress 'Display progress in a progress bar progressBar1.Value = CInt((e.Position\e.Length)*100) 'Display message header info in a listview If e.Final Then progressBar1.Value = 0 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