public void CreateNewChanel(string url) { example = new RSSChannel(url); listBox1.Items.Clear(); int count = 0; foreach (RSSItem a in example.Items) { listBox1.Items.Insert(count, count + 1 + ". " + a.title + Environment.NewLine); count++; } generateHtml(example); }
private void button1_Click(object sender, EventArgs e) { example = new RSSChannel(textBox1.Text); listBox1.Items.Clear(); int count = 0; foreach (RSSItem a in example.Items) { listBox1.Items.Insert(count, count + 1 + ". " + a.title + Environment.NewLine); count++; } generateHtml(example); }
bool generateHtml(RSSChannel channel) { try { html = "<html>" + "<head>" + "<meta http-equiv='Content-Type' content='text/html;charset=UTF-8'>" + "<style type='text/css'>" + "A{color:#483D8B; text-decoration:none; font:Verdana;}" + "pre{font-family:courier;color:#000000;" + "background-color:#dfe2e5;padding-top:5pt;padding-left:5pt;" + "padding-bottom:5pt;border-top:1pt solid #87A5C3;" + "border-bottom:1pt solid #87A5C3;border-left:1pt solid #87A5C3;" + "border-right : 1pt solid #87A5C3; text-align : left;}"+ " img{width:150; height:100;}" + "</style>" + "</head>" + "<body>" + @"<font size=""2"" face=""Verdana"">" + "<a href=" + example.imageOfChannel.imgLink + ">" + "<img src=" + example.imageOfChannel.imgURL + " border=0></a> " + "<h3>" + example.title + "</h3></a>" + @"<table width=""80%"" align=""center"" border=1>"; foreach (RSSItem article in channel.Items) { html += "<tr>" + "<td>" + @"<br> <a href=" + article.link + "><b>" + article.title + "</b></a>" + "(" + article.pubDate + ")<br><br>" + @"<table width=""95 % "" align=""center"" border=0>" + "<tr><td>" + article.description + "</td></tr></table>" + "<br> <a href=" + article.link + ">" + @"<font size=""1"">читать дальше</font></a><br><br>" + "</td>" + "</tr>"; } html += "</table><br>" + @"<p align=""center"">" + "</font>" + "</body>" + "</html>"; webBrowser1.NavigateToString(html); return(true); } catch (Exception ex) { MessageBox.Show(ex.Message); return(false); } }