private void SearchButton_Click(object sender, RoutedEventArgs e) { string address = SearchTextBox.Text; if (string.IsNullOrEmpty(address)) { return; } GpsLocationRetrievalProgress.IsEnabled = true; GoogleMapsSimpleService googleMapsService = new GoogleMapsSimpleService(); googleMapsService.GetGeoLocationByAddress(address, OnGetGeoLocationByAddress); }
private void GeoMap_Tap(object sender, GestureEventArgs e) { var tapPosition = e.GetPosition((UIElement)e.OriginalSource); var geoCoordinate = GeoMap.ViewportPointToLocation(tapPosition); GoogleMapsSimpleService gmService = new GoogleMapsSimpleService(); var geoLocation = new GeoLocation(geoCoordinate.Latitude, geoCoordinate.Longitude); //set pushpin Pushpin pin = locationPushPin; pin.Location = geoCoordinate; pin.Content = Address; NavigateToMap(geoCoordinate); //set current latitude and longitude this.Latitude = geoCoordinate.Latitude; this.Longitude = geoCoordinate.Longitude; //find address gmService.GetAddressByGeoLocation(geoLocation, (address)=> { Dispatcher.BeginInvoke(()=> { string resultAddress = address.Substring(0,Math.Min(address.Length,254)); Address = resultAddress; locationPushPin.Content = resultAddress; }); }); }