public void ShowPic() { if (CheckNetwork() == true) { MessageBox.Show("A network connection can not be established.\r\nPlease press refresh or check your network settings."); return; } else { picList.ItemsSource = ""; try { //to use Flickr go to Project-> Manage NuGet Packages-> Search "Flickr" -> install for windows phone 7 Flickr flickr = new Flickr("9a03824af501c318fec232146c6b1d05", "cd5cbd132cfbc60c"); // Authorise by api key and secret PhotoSearchOptions options = new PhotoSearchOptions(); options.Tags = App.selectedCountryDetails.CountryCapital.ToString(); //give a key word to search flickr.PhotosSearchAsync(options, (pictures) => { picList.Dispatcher.BeginInvoke(new Action(delegate() { picList.ItemsSource = pictures.Result; //binding source to listbox })); }); } catch (Exception e) { MessageBox.Show("An error occured. Please exit app and try again.\r\nError Details: " + e.Message.ToString()); } } }
async void MainPage_Loaded(object sender, RoutedEventArgs e) { var f = new Flickr("3a68f22971d8d66b521b362c312c175c"); var photos = await f.PhotosSearchAsync(new PhotoSearchOptions { Tags = "colorful", PerPage = 500, SortOrder = PhotoSearchSortOrder.InterestingnessDescending }); PictureGrid.ItemsSource = photos; }
private void GetPhotos() { Flickr flickr = new Flickr("52ae3340d1fbdf56643f44b4f84652fa", "baab02b6bab4f4e7"); PhotoSearchOptions options = new PhotoSearchOptions(); options.PerPage = 10; options.Text = ItemViewModel.Festival.NameNoSpaces()+" chicago"; options.Extras |= PhotoSearchExtras.DateTaken; flickr.PhotosSearchAsync(options, AssignResult); }