예제 #1
0
 public void GetHeadlines()
 {
     FeedDataAccess da = new FeedDataAccess();
     da.GetFeed("http://feeds.bbci.co.uk/news/rss.xml");
 }
        void wc_HeadlinesDownloadCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            FeedDataAccess da = new FeedDataAccess();

            foreach (var headline in da.GetFeed(e.Result))
            {
                HeadlineItems.Add(headline);
            }
        }
        private void wc_MostReadDownloadCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            //var media = XNamespace.Get("http://search.yahoo.com/mrss/");
            //var result = e.Result;

            //XElement items = XElement.Parse(result);
            //var mostRead = items.Descendants("item")
            //       .Select(item => new FeedItem
            //       {
            //           Title = item.Element("title").Value,
            //           Description = item.Element("description").Value,
            //           ImageUri = item.Element(media + "thumbnail") != null ? item.Element(media + "thumbnail").Attribute("url").Value : null,//Where(i => i.Attribute("width").Value == "144" && i.Attribute("height").Value == "81").Select(i => i.Attribute("url").Value).SingleOrDefault())
            //           ItemLink = item.Element("link").Value != null ? item.Element("link").Value : null
            //       }).Take(5);

            //foreach (var item in mostRead)
            //{
            //    MostReadItems.Add(item);
            //}

            FeedDataAccess da = new FeedDataAccess();

            foreach (var headline in da.GetFeed(e.Result))
            {
                MostReadItems.Add(headline);
            }
        }
 private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
 {
     FeedDataAccess fda = new FeedDataAccess();
     //fda.CreateDefaultHeadlineFeeds();
     lpHomeNewsFeed.ItemsSource = fda.GetDefaultHeadlineFeeds();
 }