I am using imap to show email headers in a listview, the way I have it working now, it waits until all the emails download and then populates the listview, how can I populate the listview as an email is loaded?
I tried to implement this answer Wpf list async update but how do I get the imap email's as they download?
EDIT: can you access each email in the mail collection as it downloads?, once I can do that, then I can add it to the listview using await
public static MessageCollection GetMessagesForFolder(string name)
{
client.Folders.Inbox.StartIdling(); // And continue to listen for more.
client.Folders.Inbox.OnNewMessagesArrived += Inbox_OnNewMessagesArrived;
var lastDays = DateTime.Today.AddDays(-15);
client.Folders[name].Messages.Download("SINCE " + lastDays.ToString("d-MMM-yyyy")); // Start the download process;
return client.Folders[name].Messages;
}
public HomePage()
{
InitializeComponent();
ContentFrame = contentFrame;
foldersList.ItemsSource = GetMessagesForFolder("INBOX");
}