private void button1_Click(object sender, EventArgs e) { Account account = new Account("*****@*****.**", String.Empty) { Unread = 2000 }; account.Emails.Add(new Email() { Title = "Test Email", When = "3/24/2011 10:27 AM", Url = "http://google.com", Message = "This is a test email.", From = "*****@*****.**" }); account.Emails.Add(new Email() { Title = "SECOND EMAIL", When = "3/14/2011 11:27 AM", Url = "http://msn.com", Message = "This is a test 22222.", From = "*****@*****.**" }); ToastManager.Pop(account); }
private void _WebClient_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e) { if (e.Error == null) { ConnectionStatus = NotifierStatus.OK; String xml = System.Text.Encoding.UTF8.GetString(e.Result).Replace("<feed version=\"0.3\" xmlns=\"http://purl.org/atom/ns#\">", "<feed>"); XmlDocument document = new XmlDocument(); try { document.LoadXml(xml); XmlNode node = document.SelectSingleNode("/feed/fullcount"); _previousUnread = Unread; Unread = Convert.ToInt32(node.InnerText); //XmlMail = document.SelectNodes("/feed/entry"); Account.Emails.Clear(); foreach (XmlNode mailNode in document.SelectNodes("/feed/entry")) { Account.Emails.Add(Email.FromNode(mailNode, Account)); } // at a point, i thought that the oldest should be shown first. not sure why. //Account.Emails.Sort(); _mailIndex = 0; } catch (System.Xml.XmlException) { } catch (Exception) { } // fixed issue #6. google will occasionally send back invalid xml. } else { WebException error = (WebException)e.Error; if (error.Status == WebExceptionStatus.ProtocolError) { ConnectionStatus = NotifierStatus.AuthenticationFailed; } else { ConnectionStatus = NotifierStatus.Offline; } } UpdateMailPreview(); if (CheckMailFinished != null) { CheckMailFinished(this, EventArgs.Empty); } if (Unread > _previousUnread && _config.ShowToast && Account.Emails.Count > 0) { ToastManager.Pop(Account); } }