示例#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);
            }
        }
示例#2
0
        /// <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);
        }
示例#3
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);
        }