private async void ReverseGeocodeOnDoubleClick(object sender, MouseButtonEventArgs e) { e.Handled = true; RemovePins(); if (GeocoderViewModel.AddressToPos) { GeocoderViewModel.AddressToPos = false; GeocodingMode.InverseContent(); } var mousePosition = e.GetPosition(this); var pinLocation = DisplayedMap.ViewportPointToLocation(mousePosition); var newPin = new Pushpin { Location = pinLocation }; _pins.Add(newPin); DisplayedMap.Children.Add(newPin); GeocoderViewModel.Location = $"{pinLocation.Latitude} {pinLocation.Longitude}"; await GeocoderViewModel.Geocode(); }
private async void GeocodeOnClick(object sender, RoutedEventArgs e) { RemovePins(); var addresses = await GeocoderViewModel.Geocode(); if (addresses == null) { ShowErrorDialog(); return; } AddPins(addresses); }
private async void GeocodeOnEnterKeyDown(object sender, KeyEventArgs e) { if (e.Key != Key.Enter || !GeocoderViewModel.CanGeocode) { return; } RemovePins(); var addresses = await GeocoderViewModel.Geocode(); if (addresses == null) { ShowErrorDialog(); return; } AddPins(addresses); }