ArdaZeytin
ArdaZeytin

Reputation: 1324

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 enter image description here

Upvotes: 0

Views: 1789

Answers (1)

L.B
L.B

Reputation: 116178

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

Upvotes: 3

Related Questions