Last active
July 17, 2022 23:12
-
-
Save azhe403/dca6df4cd2234e521900ccc3bcfd246d to your computer and use it in GitHub Desktop.
Windows Get Location
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private async void Button_Click(object sender, RoutedEventArgs e) | |
{ | |
var locator = new Windows.Devices.Geolocation.Geolocator(); | |
var location = await locator.GetGeopositionAsync(); | |
var position = location.Coordinate.Point.Position; | |
var latlong = string.Format("lat:{0}, long:{1}", position.Latitude, position.Longitude); | |
var result = MessageBox.Show(latlong); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment