Esempio n. 1
0
        private void GetUnread()
        {
            unreadCollection.Clear();
            var collection = (this.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);
                    }
                }
            }
            UnreadTreeview.ItemsSource = unreadCollection;
        }
Esempio n. 2
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;
            SortedMailCollection emptyCollection = null;
            bool isdeleted = false;

            foreach (var sortedcoll in this.SelectedMailCollection)
            {
                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.SelectedMailCollection.Remove(emptyCollection);
                    }
                    break;
                }
            }
        }
Esempio n. 3
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;
        }
Esempio n. 4
0
        /// <summary>
        /// Method which is used to get the junk mail items.
        /// </summary>
        /// <returns>Returns </returns>
        private ObservableCollection <SortedMailCollection> GetJunkMails()
        {
            ObservableCollection <SortedMailCollection> junkEMails = new ObservableCollection <SortedMailCollection>();

            SortedMailCollection sorted3 = new SortedMailCollection();

            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);
        }
 public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
 {
     if (parameter != null && parameter.ToString() == "header")
     {
         if ((bool)values[0])
         {
             return(Visibility.Visible);
         }
         else
         {
             var coll = values[1] as ObservableCollection <MailModel>;
             if (coll != null)
             {
                 if (coll.Any(p => p.IsUnRead))
                 {
                     return(Visibility.Visible);
                 }
             }
             SortedMailCollection soretedmails = values[1] as SortedMailCollection;
             if (soretedmails != null)
             {
                 if (soretedmails.MailCollection.Any(p => p.IsUnRead))
                 {
                     return(Visibility.Visible);
                 }
             }
         }
     }
     else
     {
         if (values[0].ToString() != "{DependencyProperty.UnsetValue}" && values[1].ToString() != "{DependencyProperty.UnsetValue}")
         {
             if ((bool)values[0])
             {
                 return(Visibility.Visible);
             }
             else
             {
                 if ((bool)values[1])
                 {
                     return(Visibility.Visible);
                 }
             }
         }
     }
     return(Visibility.Collapsed);
 }
Esempio n. 6
0
        /// <summary>
        /// Method which is used to get the inbox mail items.
        /// </summary>
        /// <returns>Returns </returns>
        private ObservableCollection <SortedMailCollection> GetInboxMails()
        {
            ObservableCollection <SortedMailCollection> inboxMails = new ObservableCollection <SortedMailCollection>();
            SortedMailCollection sorted1 = new SortedMailCollection();

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

            mail1.Sender   = "Maria Anders";
            mail1.To       = "Jane Jonk";
            mail1.Subject  = "Regarding Meeting";
            mail1.IsUnRead = true;
            mail1.Message  = @" Hi Jane Jonk,

                               Can we schedule Meeting Appointment for today?.
  
                               Thanks,
                               Maria Anders.";
            sorted1.MailCollection.Add(mail1);
            MailModel mail2 = new MailModel();

            mail2.Sender   = "Thomas Hardy";
            mail2.To       = "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?.
  
                            Thanks,
                            Thomas Hardy.";
            sorted1.MailCollection.Add(mail2);
            MailModel mail3 = new MailModel();

            mail3.Sender   = "Christina Berglund";
            mail3.To       = "Dev Khar";
            mail3.Subject  = "Greeting";
            mail3.IsUnRead = false;
            mail3.Message  = @" Hi Dev Khar,

                                Merry Christmas.
  
                                Thanks,
                                Christina Berglund.";
            sorted1.MailCollection.Add(mail3);
            inboxMails.Add(sorted1);

            SortedMailCollection sorted2 = new SortedMailCollection();

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

            mail4.Sender   = "Martín Sommer";
            mail4.To       = "Anil Pahr";
            mail4.Subject  = "Please come and collect ";
            mail4.IsUnRead = false;
            mail4.Message  = @"  Hi Anil Pahr,

                                Please come and collect the rent receipt.
  
                                Thanks,
                                Martín Sommer.";
            sorted2.MailCollection.Add(mail4);

            MailModel mail5 = new MailModel();

            mail5.Sender   = "Victoria Ashworth";
            mail5.To       = "Shanakar";
            mail5.Subject  = "Regarding meeting";
            mail5.IsUnRead = false;
            mail5.Message  = @"  Hi Shanakar,

    Yes we are available for meeting tomorrow.
  
    Thanks,
    Victoria Ashworth.";
            sorted2.MailCollection.Add(mail5);
            MailModel mail6 = new MailModel();

            mail6.Sender   = "Yang Wang.";
            mail6.To       = "Krish Kael";
            mail6.Subject  = "Schedule meeting";
            mail6.IsUnRead = false;
            mail6.Message  = @"  Hi Krish Kael,

    Please schedule the meeting on tomorrow.
  
    Thanks,
    Yang Wang.";
            sorted2.MailCollection.Add(mail6);
            SortedMailCollection sorted3 = new SortedMailCollection();

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

            mail7.Sender   = "Sven Ottlieb";
            mail7.To       = "Marie Krilsh";
            mail7.Subject  = "Greeting";
            mail7.IsUnRead = false;
            mail7.Message  = @"  
    Hi Marie Krilsh,

    Merry Christmas.
  
    Thanks,
    Sven Ottlieb.";
            sorted3.MailCollection.Add(mail7);
            MailModel mail8 = new MailModel();

            mail8.Sender   = "Aria Cruz";
            mail8.To       = "Maria Krilsh";
            mail8.Subject  = "New year Greeting";
            mail8.IsUnRead = false;
            mail8.Message  = @" Hi Maria Krilsh,

    I wish you Happy new year..
  
    Thanks,
    Aria Cruz.";
            sorted3.MailCollection.Add(mail8);
            MailModel mail9 = new MailModel();

            mail9.Sender   = "Diego Roel";
            mail9.To       = "Michael";
            mail9.Subject  = "Weekend Greeting";
            mail9.IsUnRead = false;
            mail9.Message  = @" Hi Michael,

    Have a Great Weekend.
  
    Thanks,
    Diego Roel.";
            sorted3.MailCollection.Add(mail9);

            SortedMailCollection sorted4 = new SortedMailCollection();

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

            mail10.Sender   = "Paolo Accorti.";
            mail10.To       = "John Michael";
            mail10.Subject  = "Greeting";
            mail10.IsUnRead = false;
            mail10.Message  = @"   Hi John Michael,
    Have a Great Day.
 
    Thanks,
    Paolo Accorti.";
            sorted4.MailCollection.Add(mail10);
            inboxMails.Add(sorted2);
            inboxMails.Add(sorted3);
            inboxMails.Add(sorted4);
            return(inboxMails);
        }