private async void SuggestionChosen(object selectedItem) { if (selectedItem == null) { return; } UserSelectedSuggestion = (ReadableLocationName)selectedItem; LocationQueryResults = await _reverseGeolocationServiceService .FindLocationAsync(UserSelectedSuggestion.FullLocationName) .ConfigureAwait(true); Messenger.Default.Send(LocationQueryResults.FirstOrDefault()); }
private async void TextChanged(bool isUserInputReason) { SuggestedLocations.Clear(); if (!isUserInputReason || string.IsNullOrEmpty(ProvidedLocationQuery)) { return; } var userInput = ProvidedLocationQuery; LocationQueryResults = await _reverseGeolocationServiceService .FindLocationAsync(userInput) .ConfigureAwait(true); LocationQueryResults? .Select(location => new ReadableLocationName(location)) .Where(locationName => !string.IsNullOrEmpty(locationName.MainLocationName)) .ForEach(locationName => SuggestedLocations.Add(locationName)); }