private async Task <IEnumerable <PictureViewModel> > LoadMorePictures(string keywords, LocationRect searchBounds) { try { double?maxDistance = null; double?longitude = null; double?latitude = null; if (searchBounds != null) { maxDistance = LocationService.ComputeRadiusInKm(searchBounds); longitude = searchBounds.Center.Longitude; latitude = searchBounds.Center.Latitude; } var items = await ExecuteAsync(new SearchMediaInCategoryRequest { Keywords = keywords, MaxDistance = maxDistance, Latitude = latitude, Longitude = longitude, MaxAge = 1000 * Constants.MillisPerDay, PageNumber = 0, PageSize = Constants.ItemsPerPage, Category = Category.Id }); var basePictureUri = new Uri(ResourceDictionary["BaseThumbnailUrl"] as string, UriKind.Absolute); var result = new List <PictureViewModel>(items.Content.Count()); foreach (var item in items.Content) { result.Add(new PictureViewModel(basePictureUri, item)); } return(result); } catch (Exception) { return(Enumerable.Empty <PictureViewModel>()); } }
private async void TriggerNewSearch() { var radius = LocationService.ComputeRadiusInKm(searchBounds); var longitude = searchBounds.Center.Longitude; var latitude = searchBounds.Center.Latitude; var result = await ExecuteAsync(new MapMediaMatchCountRequest { Keywords = Keywords, MaxAge = Constants.MillisPerDay * 1000, Radius = radius, Latitude = latitude, Longitude = longitude }); Items.Clear(); foreach (var item in result) { Items.Add(new GeoStatisticViewModel(item)); } }