Exemplo n.º 1
0
        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 void Post(LocationBindingModel bindingModel)
 {
     LocationProvider.AddLocation(RequestContext.Principal.Identity.Name, (bindingModel.lattitude, bindingModel.longtitude));
 }