public async Task GetPosition() { Geolocator geolocator = new Geolocator() { DesiredAccuracyInMeters = 5 }; Geoposition pos = await geolocator.GetGeopositionAsync(); await TheMap.TrySetViewAsync(pos.Coordinate.Point, 15.0); }
private async void Button_Click(object sender, RoutedEventArgs e) { var geolocator = new Windows.Devices.Geolocation.Geolocator() { DesiredAccuracyInMeters = 5 }; var pos = await geolocator.GetGeopositionAsync(); LongBlock.Text = $"{pos.Coordinate.Point.Position.Longitude:#.00}"; LatBlock.Text = $"{pos.Coordinate.Point.Position.Latitude:#.00}"; await TheMap.TrySetViewAsync(pos.Coordinate.Point, 15.0); }
private async void Button_Click(object sender, System.Windows.RoutedEventArgs e) { Geolocator geolocator = new Geolocator() { DesiredAccuracyInMeters = 5 }; Geoposition pos = await geolocator.GetGeopositionAsync(); string longitude = pos.Coordinate.Point.Position.Longitude.ToString(); string latitude = pos.Coordinate.Point.Position.Latitude.ToString(); LongBlock.Text = longitude; LatBlock.Text = latitude; await TheMap.TrySetViewAsync(pos.Coordinate.Point, 15.0); }