示例#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 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;
        }
示例#2
0
        /// <summary>
        /// Method which is used to get the junk mail items.
        /// </summary>
        /// <returns>Returns </returns>
        private ObservableCollection <SortedMailCollectionModel> GetJunkMails()
        {
            ObservableCollection <SortedMailCollectionModel> junkEMails = new ObservableCollection <SortedMailCollectionModel>();

            SortedMailCollectionModel sorted3 = new SortedMailCollectionModel();

            sorted3.Header = "LastWeek";
            MailModel mail7 = new MailModel();

            mail7.SenderDetails = "Sven Ottlieb";
            mail7.ToAddress     = "Marie Krilsh";
            mail7.Subject       = "Greeting";
            mail7.IsUnRead      = false;
            mail7.Message       = @" Hi Marie Krilsh, Merry Christmas.";
            sorted3.MailCollection.Add(mail7);
            MailModel mail8 = new MailModel();

            mail8.SenderDetails = "Aria Cruz";
            mail8.ToAddress     = "Maria Krilsh";
            mail8.Subject       = "New year Greeting";
            mail8.IsUnRead      = false;
            mail8.Message       = @" Hi Maria Krilsh, I wish you Happy new year.";
            sorted3.MailCollection.Add(mail8);
            MailModel mail9 = new MailModel();

            mail9.SenderDetails = "Diego Roel";
            mail9.ToAddress     = "Michael";
            mail9.Subject       = "Weekend Greeting";
            mail9.IsUnRead      = false;
            mail9.Message       = @" Hi Michael, Have a Great Weekend.";
            sorted3.MailCollection.Add(mail9);
            junkEMails.Add(sorted3);
            return(junkEMails);
        }
示例#3
0
        /// <summary>
        /// Method which is used to delete the mail.
        /// </summary>
        /// <param name="arg">Parameter used to delete the mail</param>
        private void DeleteMail(object arg)
        {
            MailModel temp = arg as MailModel;
            SortedMailCollectionModel emptyCollection = null;
            bool isdeleted = false;

            foreach (var sortedcoll in this.SelectedMails)
            {
                foreach (MailModel mail in sortedcoll.MailCollection)
                {
                    if (temp == mail)
                    {
                        sortedcoll.MailCollection.Remove(temp);
                        if (sortedcoll.MailCollection.Count == 0)
                        {
                            emptyCollection = sortedcoll;
                        }
                        isdeleted = true;
                        break;
                    }
                }
                if (isdeleted)
                {
                    if (emptyCollection != null)
                    {
                        this.SelectedMails.Remove(emptyCollection);
                    }
                    break;
                }
            }
        }
示例#4
0
        /// <summary>
        /// Method which is used to get the inbox mail items.
        /// </summary>
        /// <returns>Returns </returns>
        private ObservableCollection <SortedMailCollectionModel> GetDeletedMails()
        {
            ObservableCollection <SortedMailCollectionModel> deletedMails = new ObservableCollection <SortedMailCollectionModel>();

            SortedMailCollectionModel sorted1 = new SortedMailCollectionModel();

            sorted1.Header = "Today";
            MailModel mail1 = new MailModel();

            mail1.SenderDetails = "Maria Anders";
            mail1.ToAddress     = "Jane Jonk";
            mail1.Subject       = "Regarding Meeting";
            mail1.IsUnRead      = true;
            mail1.Message       = @" Hi Jane Jonk, Can we schedule Meeting Appointment for today?.";
            sorted1.MailCollection.Add(mail1);
            MailModel mail2 = new MailModel();

            mail2.SenderDetails = "Thomas Hardy";
            mail2.ToAddress     = "Chris Kol";
            mail2.Subject       = "Customer has accpeted...";
            mail2.IsUnRead      = true;
            mail2.Message       = @" Hi Chris Kol, Customer has accepted our proposal. Would it be possible for arrange meeting tomorrow?";
            sorted1.MailCollection.Add(mail2);
            MailModel mail3 = new MailModel();

            mail3.SenderDetails = "Christina Berglund";
            mail3.ToAddress     = "Dev Khar";
            mail3.Subject       = "Greeting";
            mail3.IsUnRead      = true;
            mail3.Message       = @" Hi Dev Khar, Merry Christmas.";
            sorted1.MailCollection.Add(mail3);
            deletedMails.Add(sorted1);

            SortedMailCollectionModel sorted2 = new SortedMailCollectionModel();

            sorted2.Header = "Yesterday";
            MailModel mail4 = new MailModel();

            mail4.SenderDetails = "Martín Sommer";
            mail4.ToAddress     = "Anil Pahr";
            mail4.Subject       = "Please come and collect ";
            mail4.IsUnRead      = true;
            mail4.Message       = @"  Hi Anil Pahr, Please come and collect the rent receipt.";
            sorted2.MailCollection.Add(mail4);
            MailModel mail5 = new MailModel();

            mail5.SenderDetails = "Victoria Ashworth";
            mail5.ToAddress     = "Shanakar";
            mail5.Subject       = "Regarding meeting";
            mail5.IsUnRead      = true;
            mail5.Message       = @"  Hi Shanakar, Yes we are available for meeting tomorrow.";
            sorted2.MailCollection.Add(mail5);
            MailModel mail6 = new MailModel();

            mail6.SenderDetails = "Yang Wang.";
            mail6.ToAddress     = "Krish Kael";
            mail6.Subject       = "Schedule meeting";
            mail6.IsUnRead      = true;
            mail6.Message       = @"  Hi Krish Kael, Please schedule the meeting on tomorrow.";
            sorted2.MailCollection.Add(mail6);

            SortedMailCollectionModel sorted3 = new SortedMailCollectionModel();

            sorted3.Header = "LastWeek";
            MailModel mail7 = new MailModel();

            mail7.SenderDetails = "Sven Ottlieb";
            mail7.ToAddress     = "Marie Krilsh";
            mail7.Subject       = "Greeting";
            mail7.IsUnRead      = true;
            mail7.Message       = @" Hi Marie Krilsh, Merry Christmas.";
            sorted3.MailCollection.Add(mail7);
            MailModel mail8 = new MailModel();

            mail8.SenderDetails = "Aria Cruz";
            mail8.ToAddress     = "Maria Krilsh";
            mail8.Subject       = "New year Greeting";
            mail8.IsUnRead      = true;
            mail8.Message       = @" Hi Maria Krilsh, I wish you Happy new year.";
            sorted3.MailCollection.Add(mail8);
            MailModel mail9 = new MailModel();

            mail9.SenderDetails = "Diego Roel";
            mail9.ToAddress     = "Michael";
            mail9.Subject       = "Weekend Greeting";
            mail9.IsUnRead      = true;
            mail9.Message       = @" Hi Michael, Have a Great Weekend.";
            sorted3.MailCollection.Add(mail9);

            SortedMailCollectionModel sorted4 = new SortedMailCollectionModel();

            sorted4.Header = "Last Month";
            MailModel mail10 = new MailModel();

            mail10.SenderDetails = "Paolo Accorti.";
            mail10.ToAddress     = "John Michael";
            mail10.Subject       = "Greeting";
            mail10.IsUnRead      = true;
            mail10.Message       = @" Hi John Michael, Have a Great Day.";
            sorted4.MailCollection.Add(mail10);
            deletedMails.Add(sorted2);
            deletedMails.Add(sorted3);
            deletedMails.Add(sorted4);
            return(deletedMails);
        }