Beispiel #1
0
        private void LoadNews()
        {
            List <NewsEntry> news = new List <NewsEntry>();

            foreach (NewsSource source in PayrollStatic.Settings.NewsSources)
            {
                NewsEntry.LoadURI(news, source.SourceAddress);
            }
            news.Sort(delegate(NewsEntry e1, NewsEntry e2)
            {
                return(e2.Updated.CompareTo(e1.Updated));
            });
            StringBuilder html = new StringBuilder();

            html.AppendLine("<html>");
            html.AppendLine("<head>");
            BuildNewsStyles(html);
            html.AppendLine("</head>");
            html.AppendLine("<body>");
            foreach (NewsEntry entry in news)
            {
                BuildNewsEntry(html, entry);
            }
            html.AppendLine("</body>");
            html.AppendLine("</html>");

            webBrowser.Navigate("about:blank");
            webBrowser.Document.OpenNew(false);
            webBrowser.Document.Write(html.ToString());
            webBrowser.Refresh();
        }
Beispiel #2
0
 private static void BuildNewsEntry(StringBuilder html, NewsEntry entry)
 {
     html.AppendLine("<div>");
     html.AppendLine("<h1 class='TITLE'>" + entry.Title.Data + "</h1>");
     html.AppendLine("<p class='CONTENT'>" + entry.Content.Data + "</p>");
     html.AppendLine("<p class='POSTEDBY'>Posted " + entry.Updated.ToShortDateString() + " " + entry.Updated.ToShortTimeString() + "</p>");
     html.AppendLine("</div>");
 }