async private void button_Click(object sender, RoutedEventArgs e) { LocationProvider providerLocation = new LocationProvider(); var accessStatus = await Geolocator.RequestAccessAsync(); switch (accessStatus) { case GeolocationAccessStatus.Allowed: // If DesiredAccuracy or DesiredAccuracyInMeters are not set (or value is 0), DesiredAccuracy.Default is used. Geolocator geolocator = new Geolocator { DesiredAccuracyInMeters = 2000 }; // Carry out the operation. Geoposition pos = await geolocator.GetGeopositionAsync(); Geopoint geo = new Geopoint(new BasicGeoposition { Latitude = pos.Coordinate.Point.Position.Latitude, Longitude = pos.Coordinate.Point.Position.Longitude }); providerLocation.AddLocation(geo, 1); this.Frame.Navigate(typeof(Friends), pos); break; case GeolocationAccessStatus.Denied: break; case GeolocationAccessStatus.Unspecified: break; } }
public Destinies() { this.InitializeComponent(); LocationProvider providerLocation = new LocationProvider(); locations = providerLocation.MyLocations(1); this.listView.ItemsSource = locations; mapPoits(myMap, locations); }