//void PlaceList_ItemSelected(object sender, Xamarin.Forms.SelectedItemChangedEventArgs e) //{ // var item = (string)e.SelectedItem; // CategoryName.Text = item; // CategoryName.TextColor = Color.Black; // //throw new NotImplementedException(); //} //void Handle_ItemTapped(object sender, Xamarin.Forms.ItemTappedEventArgs e) //{ // var data = e.Item; // //throw new NotImplementedException(); //} async void PlaceType_ItemSelected(object sender, System.EventArgs e) { Label lblClicked = (Label)sender; CategoryName.Text = lblClicked.Text; CategoryName.TextColor = Color.Black; CetegoryPopup.IsVisible = !CetegoryPopup.IsVisible; BlurBG.IsVisible = !BlurBG.IsVisible; //var city = Address?.FirstOrDefault(). //CurrentCity.Text = $"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=" + location.Latitude + "," + location.Longitude + "&radius=150000&type=" + CategoryName.Text.ToLower(); var result = await NearByService.GetNearByPlacesAsync(location, CategoryName.Text); foreach (var item in result) { //FInd Distance Xamarin.Essentials.Location sourceCoordinates = location; Xamarin.Essentials.Location destinationCoordinates = new Xamarin.Essentials.Location(item.geometry.location.lat, item.geometry.location.lng); //new Location(destinationLocations.Latitude, destinationLocations.Longitude); double distance = Xamarin.Essentials.Location.CalculateDistance(sourceCoordinates, destinationCoordinates, DistanceUnits.Kilometers); item.distance = distance; } PlaceList.ItemsSource = result; }
public async void GetPLaceDetail(string place_id) { var result = await NearByService.GetPlacesDetailAsync(place_id); if (result != null) { imgSlider.ItemsSource = result.photos; } }