public void Notify(GmailMail item)
 {
     lock (QItems)
     {
         QItems.Enqueue(item);
         if (QItems.Count > 0 && !_timer.Enabled)
             _timer.Start();
     }
 }
 public NotificationUCVM(GmailMail item, Color fgColor, Color bgColor, int pos, int tot)
 {
     Item = item;
     FGColor = new SolidColorBrush(fgColor);
     BGColor = new SolidColorBrush(bgColor);
     NbItem = pos;
     ItemTot = tot;
     ActionLink = new DelegateCommand(CanExecuteActionLink, ExecuteActionLink);
 }
Exemple #3
0
        public override bool Equals(object obj)
        {
            GmailMail other = obj as GmailMail;

            if (other != null)
            {
                return(String.Equals(this.ID, other.ID));
            }
            return(false);
        }
        private void FormatDataFromXml(XmlDocument xml)
        {
            var feed = xml.DocumentElement;
            Datas.Title = feed["title"].InnerText.Trim();
            Datas.TagLine = feed["tagline"].InnerText.Trim();
            Datas.FullCount = Int32.Parse(feed["fullcount"].InnerText.Trim());
            Datas.Link = feed["link"].Attributes["href"].InnerText.Trim();

            XmlNodeList entries = feed.GetElementsByTagName("entry");

            lock (Datas)
            {
                List<GmailMail> gmails = new List<GmailMail>();
                List<GmailMail> mailsToNotify = new List<GmailMail>();
                int currentPos = 0;
                foreach (XmlNode entry in entries)
                {
                    //Increment for all mail in the list
                    currentPos++;
                    //Create a new instance of a mail
                    var mail = new GmailMail();
                    //Get the ID
                    mail.ID = entry["id"].InnerText.Trim();
                    //check if the mail is already known
                    int pos = Datas.Mails.IndexOf(mail);
                    //If no, create a new, else, take old data
                    if (pos == -1)
                    {
                        mail.Title = entry["title"].InnerText.Trim();
                        DateTime date;
                        if (DateTime.TryParse(entry["issued"].InnerText.Trim(), out date))
                            mail.Date = date;
                        else
                            mail.Date = DateTime.Now;
                        mail.Summary = entry["summary"].InnerText.Trim();
                        mail.Link = entry["link"].Attributes["href"].InnerText.Trim();
                        mail.Author = entry["author"]["email"].InnerText.Trim();
                        mailsToNotify.Add(mail);
                    }
                    else
                    {
                        mail = Datas.Mails[pos];
                    }
                    //Set the current pos for this mail
                    mail.Pos = currentPos;
                    gmails.Add(mail);
                }
                Datas.Mails.Clear();
                foreach (GmailMail mail in gmails)
                    Datas.Mails.Add(mail);
                foreach(GmailMail mail in mailsToNotify)
                    NotifyMail(mail);
            }
        }
 public void NotifyMail(GmailMail mail)
 {
     _notif.Notify(mail);
 }
Exemple #6
0
        private void FormatDataFromXml(XmlDocument xml)
        {
            var feed = xml.DocumentElement;

            Datas.Title     = feed["title"].InnerText.Trim();
            Datas.TagLine   = feed["tagline"].InnerText.Trim();
            Datas.FullCount = Int32.Parse(feed["fullcount"].InnerText.Trim());
            Datas.Link      = feed["link"].Attributes["href"].InnerText.Trim();

            XmlNodeList entries = feed.GetElementsByTagName("entry");

            lock (Datas)
            {
                List <GmailMail> gmails        = new List <GmailMail>();
                List <GmailMail> mailsToNotify = new List <GmailMail>();
                int currentPos = 0;
                foreach (XmlNode entry in entries)
                {
                    //Increment for all mail in the list
                    currentPos++;
                    //Create a new instance of a mail
                    var mail = new GmailMail();
                    //Get the ID
                    mail.ID = entry["id"].InnerText.Trim();
                    //check if the mail is already known
                    int pos = Datas.Mails.IndexOf(mail);
                    //If no, create a new, else, take old data
                    if (pos == -1)
                    {
                        mail.Title = entry["title"].InnerText.Trim();
                        DateTime date;
                        if (DateTime.TryParse(entry["issued"].InnerText.Trim(), out date))
                        {
                            mail.Date = date;
                        }
                        else
                        {
                            mail.Date = DateTime.Now;
                        }
                        mail.Summary = entry["summary"].InnerText.Trim();
                        mail.Link    = entry["link"].Attributes["href"].InnerText.Trim();
                        mail.Author  = entry["author"]["email"].InnerText.Trim();
                        mailsToNotify.Add(mail);
                    }
                    else
                    {
                        mail = Datas.Mails[pos];
                    }
                    //Set the current pos for this mail
                    mail.Pos = currentPos;
                    gmails.Add(mail);
                }
                Datas.Mails.Clear();
                foreach (GmailMail mail in gmails)
                {
                    Datas.Mails.Add(mail);
                }
                foreach (GmailMail mail in mailsToNotify)
                {
                    NotifyMail(mail);
                }
            }
        }
Exemple #7
0
 public void NotifyMail(GmailMail mail)
 {
     _notif.Notify(mail);
 }