GrapeCity Secure Mail for .NET 4.0J
メールの取得中に進行状況を表示する(IMAP)

メールの受信処理中には、ImapクラスのProgressイベントが発生します。このイベントを利用すると、処理の進行状況をプログレスバーで表示するといった動作が可能です。

以下のサンプルコードでは、受信メール全体とメール1件ごとの受信処理の進行状況を、プログレスバー上に表示しています。

Imports Dart.Mail
Imports Dart.Mail.Imap

Private Sub Imap1_Progress(sender As Object, e As ImapProgressEventArgs) Handles Imap1.Progress
  ' 受信メール全体の進行状況をProgressBar1に表示します。
  ' Idプロパティの値は、1〜Mailbox.Countの範囲で変化します。
  ProgressBar1.Minimum = 0
  ProgressBar1.Maximum = e.Message.Mailbox.Count
  ProgressBar1.Value = System.Convert.ToInt32(e.Message.Id)

  ' 受信メール1件ごとの進行状況をProgressBar2に表示します。
  ProgressBar2.Minimum = 0
  ProgressBar2.Maximum = e.Length
  ProgressBar2.Value = e.Position
End Sub
using Dart.Mail;
using Dart.Mail.Imap;
    
private void imap1_Progress(object sender, ImapProgressEventArgs e)
  // 受信メール全体の進行状況をProgressBar1に表示します。
  // Idプロパティの値は、1〜Mailbox.Countの範囲で変化します。
  progressBar1.Minimum = 0;
  progressBar1.Maximum = e.Message.Mailbox.Count;
  progressBar1.Value = System.Convert.ToInt32(e.Message.Id);

  // 受信メール1件ごとの進行状況をProgressBar2に表示します。
  progressBar2.Minimum = 0;
  progressBar2.Maximum = e.Length;
  progressBar2.Value = e.Position;
}

 

 


© 2003, GrapeCity inc. All rights reserved.