/// <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 OutlookViewModel).SelectedMails; if (collection != null) { foreach (SortedMailCollectionModel sorted in collection) { SortedMailCollectionModel sortedCollection = new SortedMailCollectionModel(); 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; }
/// <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 OutlookViewModel).SelectedMails; if (collection != null) { foreach (var collection1 in unReadCollection) { foreach (var collection2 in unReadCollection) { if (collection1.Header == collection2.Header) { if (collection1.Subject == collection2.Subject) { collection1.IsUnRead = collection2.IsUnRead; } } } } } } if (mailView.unReadMail != null && mailView.unReadMail.IsChecked.Value) { mailView.unReadMail.IsChecked = false; } if (mailView.unReadTreeView != null && mailView.showAllTreeView != null) { mailView.unReadTreeView.Visibility = System.Windows.Visibility.Collapsed; mailView.showAllTreeView.Visibility = System.Windows.Visibility.Visible; } }
/// <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 OutlookViewModel).SelectedMails; if (collection != null) { foreach (MailModel sorted in collection) { if (sorted.IsUnRead) { UnReadCollection.Add(sorted); } } } mailView.allMail.IsChecked = false; mailView.unReadTreeView.Visibility = System.Windows.Visibility.Visible; mailView.showAllTreeView.Visibility = System.Windows.Visibility.Collapsed; }