private async Task HandlePlacePredictionTap(AutoCompletePrediction prediction) { if (FromAutoCompletePredictions != null) { IsFromVisible = false; _selectedFromPlace = prediction; FromAutoCompletePredictions = null; FromText = prediction.Description; var place = await Places.GetPlace(prediction.Place_ID, App.GooglePlacesApi); NewRide.FromLong = place.Longitude; NewRide.FromLat = place.Latitude; NewRide.FromCity = place.Name; } else { IsToVisible = false; _selectedToPlace = prediction; ToAutoCompletePredictions = null; ToText = prediction.Description; var place = await Places.GetPlace(prediction.Place_ID, App.GooglePlacesApi); NewRide.ToLong = place.Longitude; NewRide.ToLat = place.Latitude; NewRide.ToCity = place.Name; } }
private async void OnLocationSelected(object sender, ItemTappedEventArgs e) { string selectedLoc = ((ListView)sender).SelectedItem.ToString(); entrySearch.Text = selectedLoc; AutoCompletePrediction p = selectedPrediction.Where(x => x.Description == selectedLoc).FirstOrDefault(); selectedPlace = await Places.GetPlace(p.Place_ID, Constants.googlePlaceApiKey); listView.IsVisible = false; listView.SelectedItem = null; flag = false; }