コード例 #1
0
        private void GetMail()
        {
            isGetting = true;
            p.Quit();
            p = new POP3Client(name, pass);
            items.Clear();
            string num = p.Stat();

            Console.WriteLine(num);
            for (int i = 1; i <= int.Parse(num); i++)
            {
                Mail     temp     = p.Retr(i.ToString());
                MailItem mailItem = new MailItem()
                {
                    Sender      = temp.sender,
                    Subject     = temp.subject,
                    TextContent = temp.textcontent,
                    Attachment  = temp.attachment,
                    Time        = temp.time,
                    Id          = (i - 1).ToString()
                };
                items.Add(mailItem);
                Dispatcher.Invoke(
                    () =>
                {
                    MailListBox.ItemsSource       = items;
                    MailListBox.SelectedValuePath = "Id";
                    MailListBox.Items.Refresh();
                });
            }
            isGetting = false;
            MessageBox.Show("该账号的所有邮件已经获取完毕", "获取完毕", MessageBoxButton.OK, MessageBoxImage.Information);
        }
コード例 #2
0
 public MainWindow(string name, string pass)
 {
     InitializeComponent();
     InitFunction();
     this.pass = pass;
     this.name = name;
     p         = new POP3Client(name, pass);
     Console.WriteLine(Directory.GetCurrentDirectory());
 }