private void Button_Click(object sender, RoutedEventArgs e) { User = new User(TextBoxLogin.Text, TextBoxPassword.Text); Mailad = new MailAdapter("imap.gmail.com", 993, User.Email, User.Password); WindowMail winmail = new WindowMail(User, Mailad); winmail.Show(); }
public WindowMail(User user, MailAdapter mail) { InitializeComponent(); Mailadp = mail; User = user; ListBoxFolder.ItemsSource = mail.ListMailboxes(); IEnumerator messageenum = Mailadp.GetEnumerator(); MessEnumerator = messageenum; uint uid = mail.GetMailboxInfo().NextUid; IEnumerable<uint> uids = mail.Search(SearchCondition.Unseen()); foreach (uint uidd in uids) { MailMessage message = mail.GetMessage(uidd); mail.MailMessages.Add(message); ListBoxMail.Items.Add(message.From + " " + message.Subject); } }