在Windows Phone 8.0上,我曾经用Webclient和RSSclient写作,但现在情况发生了变化。我发现webclient已经改为httpclient但我找不到新的rssclient。任何人都可以帮我找到RSS阅读器的变化吗?
我必须更改此代码。
public MainPage()
{
InitializeComponent();
WebClient RSSClient = new WebClient();
RSSClient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(RssClient_Download);
RSSClient.DownloadStringAsync(new Uri("http://teknoseyir.com/feed"));
}
private void RssClient_Download(object sender, DownloadStringCompletedEventArgs e)
{
var RssData = from rss in XElement.Parse(e.Result).Descendants("item")
select new RSScontent
{
Title=rss.Element("title").Value,
pubDate= rss.Element("pubDate").Value,
Description=rss.Element("description").Value,
Link=rss.Element("link").Value,
image=rss.Element("image").Value
};
RssList.ItemsSource = RssData;
}
问题2: 我该如何编辑内容(描述)?我想清除html标签,如果可以,我想编辑
答案 0 :(得分:3)
您需要更改的是下载xml内容的方式
public async void GetRSS()
{
HttpClient httpClient = new HttpClient();
var rssContent = await httpClient.GetStringAsync("http://teknoseyir.com/feed");
var RssData = from rss in XElement.Parse(rssContent).Descendants("item")
.....
.....
RssList.ItemsSource = RssData;
}