protected async void SearchResults_Loaded(object sender, RoutedEventArgs e) { Overlay.Visibility = Visibility.Visible; OverlayProgressBar.IsIndeterminate = true; var images = await FlickrImage.GetFlickrImages( FlickrApiKey, _topic, _latitude, _longitude, _radius ); DataContext = images; if (images.Count == 0) { NoPhotosFound.Visibility = Visibility.Visible; } else { NoPhotosFound.Visibility = Visibility.Collapsed; } Overlay.Visibility = Visibility.Collapsed; OverlayProgressBar.IsIndeterminate = false; }
public async Task <ActionResult> Index(string keyword, int z = 2) { var allPhotos = from a in db.Photos select a; var abc = allPhotos.Any(x => x.keyword == keyword); if (abc) { var selectedPhotos = from x in allPhotos where x.keyword == keyword select x; //<a href= @(string.Format( // "http://farm{0}.staticflickr.com/{1}/{2}_{3}.jpg", item.farm,item.server, item.id, item.secret).ToString()) > <img src= @(string.Format( // "http://farm{0}.staticflickr.com/{1}/{2}_{3}_n.jpg", item.farm,item.server, item.id, item.secret).ToString()) /> </a>@* List <FlickrImage> images = new List <FlickrImage>(); foreach (var p in selectedPhotos) { FlickrImage obj = new FlickrImage(); obj.Image1024 = (new Uri(string.Format( "http://farm{0}.staticflickr.com/{1}/{2}_{3}.jpg", p.farm, p.server, p.id, p.secret))); obj.Image320 = new Uri(string.Format( "http://farm{0}.staticflickr.com/{1}/{2}_{3}_n.jpg", p.farm, p.server, p.id, p.secret)); obj.ImagePage = new Uri(string.Format("http://www.flickr.com/photos/{0}/{1}", p.owner, p.id)); images.Add(obj); } return(View(images)); } List <Photo> photos = new List <Photo>(); List <FlickrImage> imgs = await FlickrImage.GetFlickrImages(keyword); foreach (var p in imgs) { photos.Add(p.photo); } Create(photos); return(View(imgs)); }