示例#1
0
 bool dnldAndParse_New(Feed feed)
 {
     using (var reader = new MyXmlReader(feed.Url))//			var x = XmlReader.Create(feed.Url);
     {
         return(p_New(feed, reader));
     }
 }
示例#2
0
 public void ParseRssToGetAllCasts(Feed feed)
 {
     if (string.IsNullOrEmpty(feed.LatestRssText))
     {
         return;
     }
     try
     {
         using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(feed?.LatestRssText)))
         {
             using (var reader = new MyXmlReader(stream))
             {
                 if (!p_New(feed, reader))
                 {
                     p_Old(feed, XDocument.Load(reader));
                 }
             }
         }
     }
     catch (Exception ex) { ex.Log(); throw; }
 }
示例#3
0
        bool p_New(Feed feed, MyXmlReader reader)
        {
            RssDnldInfos.Clear();

            try
            {
                var synFeed = SyndicationFeed.Load(reader); //msdn sample leftover: var rssFormatter = synFeed.GetRss20Formatter();			var rssWriter = new XmlTextWriter("rss.xml", Encoding.UTF8);			rssWriter.Formatting = Formatting.Indented;			rssFormatter.WriteTo(rssWriter);			rssWriter.Close();

                //Application.Current.Dispatcher.BeginInvoke(new Action(() => { feedListBox.ItemsSource = synFeed.Items; loadFeedButton.Content = "Refresh Feed"; })); // In Windows Phone OS 7.1, WebClient events are raised on the same type of thread they were called upon. For example, if WebClient was run on a background thread, the event would be raised on the background thread.  While WebClient can raise an event on the UI thread if called from the UI thread, a best practice is to always use the Dispatcher to update the UI. This keeps the UI thread free from heavy processing. //Deployment.Current.Dispatcher.BeginInvoke(() =>

                //Debug.WriteLine(string.Format("\n\nfeed:>> [{0}] \t {1} \t Total {2} items", feed.Name, feed.Url, synFeed.Items.Count()));
                foreach (var si in synFeed.Items)
                {
                    doSyndItem(feed, si);
                }
                return(true);
            }
            catch (Exception ex) { ex.Log($"\n\nfeed>> Name:[{feed.Name}] \t Url:[{feed.Url}] \t "); }

            return(false);
        }