2015-12-15 75 views
0

我想從這個http://bangla.bdnews24.com/?widgetName=rssfeed&widgetId=1151&getXmlFeed=true的網址,讓圖像位於內 cropimage標籤添加圖像如何提取圖像。我目前提取標題和摘要使用的代碼下面幾行:從RSS訂閱通用的Windows應用程序動態磁貼

private static async Task<SyndicationFeed> GetMSDNBlogFeed() 
    { 
     SyndicationFeed feed = null; 

     try 
     { 
      // Create a syndication client that downloads the feed. 
      SyndicationClient client = new SyndicationClient(); 
      client.BypassCacheOnRetrieve = true; 
      client.SetRequestHeader(customHeaderName, customHeaderValue); 

      // Download the feed. 
      feed = await client.RetrieveFeedAsync(new Uri(feedUrl)); 
     } 
     catch (Exception ex) 
     { 
      Debug.WriteLine(ex.ToString()); 
     } 

     return feed; 
    } 

    private static void UpdateTile(SyndicationFeed feed) 
    { 
     // Create a tile update manager for the specified syndication feed. 
     var updater = TileUpdateManager.CreateTileUpdaterForApplication(); 
     updater.EnableNotificationQueue(true); 
     updater.Clear(); 

     // Keep track of the number feed items that get tile notifications. 
     int itemCount = 0; 

     // Create a tile notification for each feed item. 
     foreach (var item in feed.Items) 
     { 
      XmlDocument tileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWide310x150Text09); 

      var title = item.Title; 
      var summary = item.Summary; 

      if (itemCount!=0) 
      { 
       string titleText = title.Text == null ? String.Empty : title.Text; 
       string summaryText = summary.Text == null ? String.Empty : summary.Text; 


       tileXml.GetElementsByTagName(textElementName)[0].InnerText = titleText; 
       tileXml.GetElementsByTagName(textElementName)[1].InnerText = summaryText; 

       // Create a new tile notification. 
       updater.Update(new TileNotification(tileXml)); 

      } 

      // Don't create more than 5 notifications. 
      if (itemCount++ > 7) break; 
     } 
    } 

    // Although most HTTP servers do not require User-Agent header, others will reject the request or return 
    // a different response if this header is missing. Use SetRequestHeader() to add custom headers. 
    static string customHeaderName = "User-Agent"; 
    static string customHeaderValue = "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)"; 

    static string textElementName = "text"; 
    static string feedUrl = @"http://bangla.bdnews24.com/?widgetName=rssfeed&widgetId=1151&getXmlFeed=true"; 

我怎樣才能提取圖像?在此先感謝

回答