简体   繁体   中英

How can I write RSS reader for windows phone 8.1?

At windows phone 8.0 i used to writing with Webclient and RSSclient but now something has changed. I found webclient has changed to httpclient but i couldn't find new rssclient . Can anyone help me to find changes for RSS reader ?

I have to changes this codes.

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; 

    }

Question 2 : How can i edit content(description) ? I want to clear html tags and if i can , i want to edit 在此处输入图片说明

All you need to change is how you download the xml content

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;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM