Skip to content

Instantly share code, notes, and snippets.

@anuith
Created June 24, 2012 20:07
Show Gist options
  • Save anuith/2984709 to your computer and use it in GitHub Desktop.
Save anuith/2984709 to your computer and use it in GitHub Desktop.
Windows Phone Hackathon : Facebook & Instagram Sample - Instagram Code - Get Feed (continued from https://gist.github.com/2984706 )
private void DisplayFeed(JToken data)
{
List<InstagramItem> items = new List<InstagramItem>();
foreach (JToken token in data)
{
InstagramItem item = new InstagramItem();
item.id = token["id"].Value<string>();
item.commentsCount = token["comments"]["count"].Value<int>();
item.likesCount = token["likes"]["count"].Value<int>();
item.image =
token["images"]["standard_resolution"]["url"].Value<string>();
item.thumbnail = token["images"]["thumbnail"]["url"].Value<string>();
if (token["caption"] != null && token["caption"].ToString() != "") {
item.caption = token["caption"]["text"].Value<string>();
}
item.link = token["link"].Value<string>();
item.user = token["user"].ToObject<InstagramItem.InstagramUser>();
if (token["location"] != null && token["location"].ToString() != "") {
item.location =
token["location"].ToObject<InstagramItem.InstagramLocationData>();
}
items.Add(item);
}
ListBox_Feed.ItemsSource = items;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment