void album_grp_response(IDictionary<String, object> res) { object response; // getting all photos if (res.TryGetValue("data", out response)) { foreach (JsonObject _post in (JsonArray)response) { model = new FacebookItemViewModel(_post); if (model.source_url != null) { AlbumImage image = new AlbumImage(); image.source_url = model.source_url; App.albumImages.Add(image); } } } }
// called when the data is ready form facebook void photo_response(IDictionary<String, object> res) { object response; // getting all photos if (res!= null && res.TryGetValue("data", out response)) { foreach (JsonObject _post in (JsonArray)response) { model = new FacebookItemViewModel(_post); if (model.source_url != null) { // add album image source to allImages collection AlbumImage image = new AlbumImage(); image.source_url = model.source_url; hubTileUrl = model.source_url; App.allImages.Add(image); } } this.AllImagesListBox.ItemsSource = App.allImages; } else { MessageBoxResult m = MessageBox.Show("Facebook null response", "Response", MessageBoxButton.OK); } }
// called when albums are responded. void albums_response(IDictionary<String, object> res) { object response; albumIdList = new List<string>(); // getting all photos if (res != null && res.TryGetValue("data", out response)) { foreach (JsonObject _post in (JsonArray)response) { model = new FacebookItemViewModel(_post); if (model.id != null) { photoManager.getPhotos(model.id, photo_response); // add hubtile to panorama view when there is an album in facebook album = new HubTile(); album.Title = model.name; album.Margin = new Thickness(2, 2, 2, 2); album.GroupTag = model.id; album.Background = new SolidColorBrush(Colors.Green); albumIdList.Add(model.id); // add albums to album specific collection this.AlbumsList.Items.Add(album); // tapping support album.Tap += new EventHandler<System.Windows.Input.GestureEventArgs>(album_Tap); } } } else { MessageBoxResult m = MessageBox.Show("Facebook null album response", "Response", MessageBoxButton.OK); } }