예제 #1
0
        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();
        }
예제 #2
0
        private async void GeocodeOnClick(object sender, RoutedEventArgs e)
        {
            RemovePins();
            var addresses = await GeocoderViewModel.Geocode();

            if (addresses == null)
            {
                ShowErrorDialog();
                return;
            }
            AddPins(addresses);
        }
예제 #3
0
        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);
        }