Beispiel #1
0
        /// <summary>
        /// Method used to execute unread mails.
        /// </summary>
        /// <param name="parameter">Specifies the object type parameter.</param>
        public void ExecuteUnreadMail(object parameter)
        {
            MailView mailView = parameter as MailView;

            unReadCollection.Clear();
            var collection = (mailView.DataContext as ViewModel).SelectedMailCollection;

            if (collection != null)
            {
                foreach (SortedMailCollection sorted in collection)
                {
                    SortedMailCollection sortedCollection = new SortedMailCollection();
                    sortedCollection.Header = sorted.Header;
                    foreach (MailModel mail in sorted.MailCollection)
                    {
                        if (mail.IsUnRead)
                        {
                            sortedCollection.MailCollection.Add(mail);
                        }
                    }
                    if (sortedCollection.MailCollection.Count > 0)
                    {
                        unReadCollection.Add(sortedCollection);
                    }
                }
            }
            mailView.unReadTreeView.ItemsSource = unReadCollection;
            mailView.allMail.IsChecked          = false;
            mailView.unReadTreeView.Visibility  = System.Windows.Visibility.Visible;
            mailView.showAllTreeView.Visibility = System.Windows.Visibility.Collapsed;
        }
Beispiel #2
0
        /// <summary>
        /// Method used to execute all mails.
        /// </summary>
        /// <param name="parameter">Specifies the object type parameter.</param>
        public void ExecuteAllMail(object parameter)
        {
            MailView mailView = parameter as MailView;

            if (mailView.DataContext != null)
            {
                var collection = (mailView.DataContext as ViewModel).SelectedMailCollection;
                if (collection != null)
                {
                    foreach (var collection1 in unReadCollection)
                    {
                        foreach (var collection2 in unReadCollection)
                        {
                            if (collection1.Header == collection2.Header)
                            {
                                foreach (MailModel mail2 in collection2.MailCollection)
                                {
                                    foreach (MailModel mail1 in collection1.MailCollection)
                                    {
                                        if (mail1.Subject == mail2.Subject)
                                        {
                                            mail1.IsUnRead = mail2.IsUnRead;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            if (mailView.unReadMail != null && mailView.unReadMail.IsChecked.Value)
            {
                mailView.unReadMail.IsChecked = false;
            }
            if (mailView.unReadTreeView != null && mailView.showAllTreeView != null)
            {
                mailView.unReadTreeView.ItemsSource = null;
                mailView.unReadTreeView.Visibility  = System.Windows.Visibility.Collapsed;
                mailView.showAllTreeView.Visibility = System.Windows.Visibility.Visible;
            }
        }