/// <summary> /// Search nearby POIs based on selected category /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void SearchByCategory_Click(object sender, RoutedEventArgs e) { NearbyLocations.Clear(); PinnedLocationListView.UpdateLayout(); var selected = (MenuFlyoutItem)sender; var selectedlocation = selected.DataContext as LocationData; var searchCategory = selected.Text; var language = (LanguageComboBox.SelectedItem as ComboBoxItem).Tag.ToString(); var results = await LocationHelper.SearchPOIsByCategory(searchCategory, selectedlocation.Position, language, selectedlocation.CountryCode); foreach (var result in results) { LocationData location = new LocationData() { Position = new BasicGeoposition() { Latitude = result.position.lat, Longitude = result.position.lon, Altitude = 50 } }; location.Name = LocationHelper.ConstructStringFromAddress(result.address, "name", null); location.Address = LocationHelper.ConstructStringFromAddress(result.address, "address", null); location.FormattedAddress = LocationHelper.ConstructStringFromAddress(result.address, "full", null); if (String.IsNullOrWhiteSpace(location.Name)) { location.Name = result.position.lat.ToString("0.000000, ") + result.position.lon.ToString("0.000000"); } if (result.poi != null) { location.Name = result.poi.name; } NearbyLocations.Add(location); } }
/// <summary> /// Adds the specified location to the Locations list and shows the editor flyout. /// </summary> public void EditNewLocation(LocationData location) { Locations.Add(location); PinnedLocationListView.UpdateLayout(); //EditLocation(location); }