示例#1
0
        // TODO: Special case Spam folder? Perminately delete.
        // TODO: Remove from current label, storage.
        private async void SpamClick(object sender, EventArgs e)
        {
            ProgressIndicator.IsIndeterminate = true;
            try
            {
                IEnumerable<MailMessage> messages = new MailMessage[0];
                foreach (ConversationThread conversation in MailList.SelectedItems)
                {
                    messages = messages.Concat(conversation.Messages);
                }
                if (messages.Any())
                {
                    Account account = App.AccountManager.GetCurrentAccount();
                    await account.TrashAsync(messages.ToList(), isSpam: true);

                    // Force Refresh
                    GetConversations();
                }
            }
            finally
            {
                MailList.IsSelectionEnabled = false;
                ProgressIndicator.IsIndeterminate = false;
            }
        }
示例#2
0
        private async void SetReadStatus(bool readStatus)
        {
            ProgressIndicator.IsIndeterminate = true;
            try
            {
                IEnumerable<MailMessage> messages = new MailMessage[0];
                foreach (ConversationThread conversation in MailList.SelectedItems)
                {
                    messages = messages.Concat(conversation.Messages);
                }
                messages = messages.Where(message => message.Seen != readStatus);
                if (messages.Any())
                {
                    Account account = App.AccountManager.GetCurrentAccount();
                    await account.SetReadStatusAsync(messages.ToList(), read: readStatus);

                    // Force Refresh
                    var temp = MailList.ItemsSource;
                    MailList.ItemsSource = null;
                    MailList.ItemsSource = temp;
                }
            }
            finally
            {
                MailList.IsSelectionEnabled = false;
                ProgressIndicator.IsIndeterminate = false;
            }
        }