コード例 #1
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;
            }
        }