/// <summary> /// Updates mail data /// </summary> public void RefreshMail() { if (AttachedFileList != null) { AttachedFileList.Clear(); } ObservableCollection <MailHeader> tempMailList = MailHandler.GetMailHeaders(asb.Text); //If no mail was found on server, display error dialog if (tempMailList == null) { DisplayErrorDialog("Mail error", "No mail found. Try again!"); } //If mail was found, replace MailHeaderList with the list with new mail and update UI else { if (MailHeaderList != null) { MailHeaderList.Clear(); } MailHeaderList = tempMailList; Bindings.Update(); //Updates the ListView data CurrentMessage = MailHandler.GetSpecificMail(MailHeaderList[0].UniqueId); MailListView.SelectedIndex = 0; HandleAttachmentsAsync(CurrentMessage); SetContent(CurrentMessage); } }
/// <summary> /// Handles event when user clicks the listview - sets the clicked mail´s content to the webview&listview /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MailListView_ItemClicked(object sender, ItemClickEventArgs e) { AttachedFileList.Clear(); MailHeader msg = (MailHeader)e.ClickedItem; CurrentMessage = MailHandler.GetSpecificMail(msg.UniqueId); HandleAttachmentsAsync(CurrentMessage); SetContent(CurrentMessage); }