Exemple #1
0
        /// <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);
            }
        }
Exemple #2
0
        /// <summary>
        /// Logs in to mail server, gets mail summaries (headers) and sets the first mail´s content to the
        /// webview and listview (attachments)
        /// </summary>
        /// <returns></returns>
        public bool HandleMail()
        {
            MailHandler.Login();

            ObservableCollection <MailHeader> tempMailList = MailHandler.GetMailHeaders(null);

            if (tempMailList == null)
            {
                return(false);
            }
            else
            {
                MailHeaderList = tempMailList;

                Bindings.Update();

                CurrentMessage             = MailHandler.GetSpecificMail(MailHeaderList[0].UniqueId);
                MailListView.SelectedIndex = 0;
                HandleAttachmentsAsync(CurrentMessage);
                SetContent(CurrentMessage);
            }

            return(true);
        }