Exemplo n.º 1
0
        private void FetchEnvelopesAsync(Mailbox mailbox)
        {
            new Thread(() =>
            {
                try {
                    using (var client = CreateClientByAccount(mailbox.AccountState.Account)) {
                        client.Select(mailbox.Fullname);

                        var query = client.Messages.Where(x => x.Date < DateTime.Today.AddDays(1)).Select(x => new MyMessage {
                            Envelope = x.Envelope, Uid = x.Uid
                        });

                        foreach (var message in query)
                        {
                            message.Mailbox = mailbox;
                            AddMessageToViewSafely(mailbox, message);
                        }
                    }
                }
                catch (Exception ex) {
                    LogSafely(ex.Message);
                }
            }).Start();
        }
Exemplo n.º 2
0
 private static void AddMessageToView(Mailbox mailbox, MyMessage message)
 {
     mailbox.Messages.Add(message);
 }