Пример #1
0
        public void AddMailToInbox(MailItem mail)
        {
            if (!inbox.Any(m => m.ID == mail.ID))
            {
                inbox.Add(mail);

                if (mail.MailState == MailState.Unread)
                {
                    OnUnreadMailCountChanged(mail, EventArgs.Empty);
                }
            }
        }
Пример #2
0
        public void MoveMailToArchive(Guid mailId)
        {
            MailItem mail = inbox.FirstOrDefault(m => m.ID == mailId);

            if (mail != null)
            {
                inbox.Remove(mail);
                archive.Add(mail);

                if (mail.MailState == MailState.Unread)
                {
                    OnUnreadMailCountChanged(mail, EventArgs.Empty);
                }
            }
        }
Пример #3
0
        public void SendMail(MailItem mail)
        {
            Mailbox fromMailbox = AllMailboxes.FirstOrDefault(m => m.MailAddress.Address == mail.From);

            if (fromMailbox == null)
            {
                throw new Exception(String.Format("Mailbox with address {0} not found.", mail.From));
            }

            Mailbox toMailbox = AllMailboxes.FirstOrDefault(m => m.MailAddress.Address == mail.To);

            if (toMailbox == null)
            {
                throw new Exception(String.Format("Mailbox with address {0} not found.", mail.To));
            }

            fromMailbox.AddMailToOutbox(mail);
            toMailbox.AddMailToInbox(mail);
        }
Пример #4
0
 public void ArchiveMail(MailItem mailItem)
 {
     playerMailbox.MoveMailToArchive(mailItem.ID);
 }