// Event handler which runs after the feed is fully downloaded. private void searchTask_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { if (e.Error != null) { Deployment.Current.Dispatcher.BeginInvoke(() => { // Showing the exact error message is useful for debugging. In a finalized application, // output a friendly and applicable string to the user instead. MessageBox.Show(e.Error.Message); }); } else { EyeemRootObject root = new EyeemRootObject(); MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(e.Result)); DataContractJsonSerializer ser = new DataContractJsonSerializer(root.GetType()); root = ser.ReadObject(ms) as EyeemRootObject; ms.Close(); if (root.albums.items.Capacity > 0) { this.StartImage.Source = new BitmapImage(new Uri(root.albums.items[0].photos.items[2].photoUrl)); //this.myCard.FImage.Source = this.StartImage.Source; this.myCard.FrontImage.Source = new BitmapImage(new Uri(root.albums.items[0].photos.items[2].photoUrl)); this.myCard.BackImage.Source = new BitmapImage(new Uri(root.albums.items[0].photos.items[1].photoUrl)); this.AlbumList.ItemsSource = root.albums.items; } else { MessageBox.Show("No Albums found"); } } }
void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { if (e.Error != null) { Deployment.Current.Dispatcher.BeginInvoke(() => { // Showing the exact error message is useful for debugging. In a finalized application, // output a friendly and applicable string to the user instead. MessageBox.Show(e.Error.Message); }); } else { EyeemRootObject root = new EyeemRootObject(); MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(e.Result)); DataContractJsonSerializer ser = new DataContractJsonSerializer(root.GetType()); root = ser.ReadObject(ms) as EyeemRootObject; ms.Close(); if (root.albums.items.Capacity > 0) { popularAlbum = root.albums.items[0]; var currentPage = RootFrame.Content as EyeemPanorama; currentPage.default_image_1.Source = new BitmapImage(new Uri(popularAlbum.photos.items[0].thumbUrl)); currentPage.default_image_2.Source = new BitmapImage(new Uri(popularAlbum.photos.items[1].thumbUrl)); currentPage.default_image_3.Source = new BitmapImage(new Uri(popularAlbum.photos.items[2].thumbUrl)); } } }
// Event handler which runs after the feed is fully downloaded. private void searchTask_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { if (e.Error != null) { Deployment.Current.Dispatcher.BeginInvoke(() => { // Showing the exact error message is useful for debugging. In a finalized application, // output a friendly and applicable string to the user instead. MessageBox.Show(e.Error.Message); }); } else { EyeemRootObject root = new EyeemRootObject(); MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(e.Result)); DataContractJsonSerializer ser = new DataContractJsonSerializer(root.GetType()); root = ser.ReadObject(ms) as EyeemRootObject; ms.Close(); if (root.albums.items.Capacity > 0) { this.foundAlbums = root.albums.items; this.Album_List.ItemsSource = this.foundAlbums; this.Album_List.SelectionChanged += new SelectionChangedEventHandler(Album_List_SelectionChanged); } else { MessageBox.Show("No Albums found"); } } }