Example #1
0
        public MessageLabel(User user)
        {
            this.user = user;
            InitializeComponent();
            try
            {
                mailRepository = new MailRepository(
                    "imap.gmail.com",
                    993,
                    true,
                    user.Email,
                    user.Password
                    );

                emailList = mailRepository.GetAllMails("inbox");
                mailbox   = new MailBox(emailList);
                mailbox.Serialize();
            }
            catch (System.Net.Sockets.SocketException)
            {
                mailbox   = MailBox.Deserialize();
                emailList = mailbox.emailList;
            }


            ListViewInit();
            PopulateListView(emailList);
            InitWorker();
            timer1.Enabled = true;
        }
Example #2
0
 void DoWork(object sender, DoWorkEventArgs e)
 {
     try
     {
         emailList = mailRepository.GetAllMails("inbox");
         mailbox   = new MailBox(emailList);
     }
     catch (System.Net.Sockets.SocketException)
     {
         mailbox   = MailBox.Deserialize();
         emailList = mailbox.emailList;
     }
 }
Example #3
0
 private async void LoadEmailList([Optional] IMailFolder folder)
 {
     if (maxMailComboBox.SelectedItem != null)
     {
         mailRepository.MaxEmails = int.Parse(maxMailComboBox.SelectedItem.ToString());
     }
     else
     {
         mailRepository.MaxEmails = defaultMax;
     }
     var progress = new Progress <MailInfo>(email => LoadListViewItem(email));
     await Task.Factory.StartNew(() => mailRepository.GetAllMails(progress, folder), TaskCreationOptions.LongRunning);
 }