public List <FeedMs> GetFeedList(int width, Shared.GetFont titleFont, Shared.GetFont dateFont, Shared.GetFont bodyFont) { TextBlob textBlob = new TextBlob(bodyFont, "label", width); //parse JSON string into List of Dictionaries. List <FeedMs> allFeeds = new List <FeedMs>(); try { #if NETFX_CORE // For some reason the WinRT Json Serializer doesn't want to // deserialize our objects so we'll just have to do it manually. //var items = Deserialize<List<Dictionary<string, string>>>(rawGetData); List <Dictionary <string, string> > items = HackDeserialize(rawGetData); #else var js = new System.Web.Script.Serialization.JavaScriptSerializer(); var items = js.Deserialize <List <Dictionary <string, string> > >(rawGetData); #endif //build news feed. foreach (var item in items) { FeedMs feedItem = new FeedMs(new Vector2(24, 0), textBlob, titleFont, dateFont, bodyFont); feedItem.Title = item["Title"]; feedItem.Body = item["Text"]; feedItem.DateString = item["Date"]; feedItem.CreateHyperlink(HyperlinkType.URL, Strings.Localize("mainMenu.readMoreHere"), item["URL"]); allFeeds.Add(feedItem); } } catch { } return(allFeeds); }
private void ProcessKey(ref FeedMs newsItem, string data, FeedSection key) { switch (key) { case FeedSection.keyTitle: newsItem.Title = data; ; break; case FeedSection.keyText: newsItem.Body = data; break; case FeedSection.keyDate: newsItem.DateString = data; break; case FeedSection.keyTwitter:; break; case FeedSection.keyLink: newsItem.CreateHyperlink(HyperlinkType.URL, "\nRead more Here!", data); break; } }