Exemple #1
0
 /// <summary>
 /// Gets the list of mail folders.
 /// </summary>
 /// <param name="folders">The list of mail folders.</param>
 /// <param name="mailboxCollection">The mailbox children.</param>
 /// <returns>The list of mail folders.</returns>
 private List <Mailbox> GetFlatMailboxes(List <Mailbox> folders, MailboxCollection mailboxCollection)
 {
     // Loop through each mailbox
     foreach (Mailbox mailbox in mailboxCollection)
     {
         // Build the tree
         Task.Run(async() =>
         {
             UpdateStatusDictionaries(mailbox);
             folders.Add(mailbox);
             SelectMailbox(mailbox);
             StorageFolder folder    = await IOUtil.GetCreateFolder(_client.AttachmentDirectory, FolderType.Mailbox);
             StorageFile mailboxFile = await IOUtil.GetCreateFile(folder, MailboxFilename, CreationCollisionOption.OpenIfExists);
             string displayName      = await FileIO.ReadTextAsync(mailboxFile);
             if (string.IsNullOrEmpty(displayName))
             {
                 await FileIO.WriteTextAsync(mailboxFile, mailbox.DisplayName);
             }
             else if (mailbox.DisplayName != displayName)
             {
                 mailbox.DisplayName = displayName;
             }
             GetFlatMailboxes(folders, mailbox.Children);
         }).Wait();
     }
     // Return list
     return(folders);
 }
Exemple #2
0
        // Region for Mailboxes folders.
        #region MailBoxes

        /// <summary>
        /// Get all mailbox folders.
        /// </summary>
        /// <returns></returns>
        public MailboxCollection GetAllMailbox()
        {
            AccountSettings.AccountInfo accountInfo = this.GetDefaultAccountInfo();
            MailboxCollection           ret         = new MailboxCollection();

            if (accountInfo != null)
            {
                if (accountInfo.MailAccountType == AccountType.POP3)
                {
                    // TODO... check if it's possible.
                    //ret = this._pop3Controller.();
                }
                else if (accountInfo.MailAccountType == AccountType.IMAP)
                {
                    ret = this._imap4Controller.GetAllMailbox(Constants.Inbox);
                }
            }
            return(ret);
        }