void HandleLocationManagerUpdatedLocation(object sender, CLLocationUpdatedEventArgs e) { // Ignore updates where nothing we care about changed if (e.OldLocation != null && e.NewLocation.Coordinate.Longitude == e.OldLocation.Coordinate.Longitude && e.NewLocation.Coordinate.Latitude == e.OldLocation.Coordinate.Latitude && e.NewLocation.HorizontalAccuracy == e.OldLocation.HorizontalAccuracy) { return; } // Load the HTML for displaying the Google map from a file and replace the // format placeholders with our location data string path = NSBundle.MainBundle.PathForResource("HTMLFormatString", "html"); var formatString = File.OpenText(path).ReadToEnd(); var htmlString = String.Format( formatString, e.NewLocation.Coordinate.Latitude, e.NewLocation.Coordinate.Longitude, latitudeRangeForLocation(e.NewLocation), longitudeRangeForLocation(e.NewLocation)); webView.MainFrame.LoadHtmlString(htmlString, null); locationLabel.StringValue = string.Format("{0}, {1}", e.NewLocation.Coordinate.Latitude, e.NewLocation.Coordinate.Longitude); accuracyLabel.StringValue = e.NewLocation.HorizontalAccuracy.ToString(); }
private void LocationManagerOnUpdatedLocation( object sender, CLLocationUpdatedEventArgs clLocationUpdatedEventArgs) { OnLocationChanged( clLocationUpdatedEventArgs.NewLocation); }
private void locationUpdated(object sender, CLLocationUpdatedEventArgs e) { Map.CenterCoordinate = e.NewLocation.Coordinate; Map.Region = MKCoordinateRegion.FromDistance (e.NewLocation.Coordinate, 5000, 5000); var annotation = new MapAnnotation("Current Location", e.NewLocation.Coordinate); Map.AddAnnotation(annotation); }
private void locationUpdated(object sender, CLLocationUpdatedEventArgs e) { Map.CenterCoordinate = e.NewLocation.Coordinate; Map.Region = MKCoordinateRegion.FromDistance(e.NewLocation.Coordinate, 5000, 5000); var annotation = new MapAnnotation("Current Location", e.NewLocation.Coordinate); Map.AddAnnotation(annotation); }
static void HandleCoreLocationManagerUpdatedLocation(object sender, CLLocationUpdatedEventArgs e) { OldLocation = e.OldLocation; NewLocation = e.NewLocation; if (LocationUpdated != null) { LocationUpdated(e); } }
private void LocationManager_OnUpdatedLocation(object sender, CLLocationUpdatedEventArgs args) { var loc = args.NewLocation; var geoposition = loc.ToLocalGeoposition(); this.LastKnownPosition = geoposition; this.PositionChanged?.Invoke(this, new PositionChangedEventArgs(geoposition)); loc?.Dispose(); }
private void LocationManager_UpdatedLocation(object sender, CLLocationUpdatedEventArgs e) { var l = e.NewLocation; RaiseLocationUpdated(l.Coordinate.Latitude, l.Coordinate.Latitude, l.VerticalAccuracy < 0 ? null : (double?)l.Altitude, l.Speed < 0 ? null : (double?)l.Speed, l.Course < 0 ? null : (double?)l.Course, l.HorizontalAccuracy < 0 ? null : (double?)l.HorizontalAccuracy, l.VerticalAccuracy < 0 ? null : (double?)l.VerticalAccuracy); }
void _Manager_UpdatedLocation(object sender, CLLocationUpdatedEventArgs e) { if (_LocationChanged == null) { return; } System.Diagnostics.Debug.WriteLine("Location updated."); CurrentLocation = new GeoLocation { Latitude = e.NewLocation.Coordinate.Latitude, Longitude = e.NewLocation.Coordinate.Longitude }; _LocationChanged(CurrentLocation); }
private void OnUpdatedLocation(object sender, CLLocationUpdatedEventArgs e) { UpdatePosition(e.NewLocation); }
void UpdatedLocation(object sender, CLLocationUpdatedEventArgs e) { UpdateLocation (e.NewLocation); }
private void UpdatedLocation(object sender, CLLocationUpdatedEventArgs args) { const double LatitudeDelta = 0.002; const double LongtitudeDelta = LatitudeDelta; var PosAccuracy = args.NewLocation.HorizontalAccuracy; if (PosAccuracy >= 0) { var Coord = args.NewLocation.Coordinate; latitudeLabel.Text = string.Format ("{0:F6}° ± {1} m", Coord.Latitude, PosAccuracy); longtitudeLabel.Text = string.Format ("{0:F6}° ± {1} m", Coord.Longitude, PosAccuracy); if (Coord.IsValid ()) { var region = new MKCoordinateRegion (Coord, new MKCoordinateSpan (LatitudeDelta, LongtitudeDelta)); mapView.SetRegion (region, false); mapView.SetCenterCoordinate (Coord, false); //mapView.SelectedAnnotations (mapView.UserLocation, false); } } else { latitudeLabel.Text = "N/A"; longtitudeLabel.Text = "N/A"; } if (args.NewLocation.VerticalAccuracy >= 0) altitudeLabel.Text = string.Format ("{0:F6} m ± {1:F6} m", args.NewLocation.Altitude, args.NewLocation.VerticalAccuracy); else altitudeLabel.Text = "N/A"; if (args.NewLocation.Course >= 0) courseLabel.Text = string.Format ("{0}°", args.NewLocation.Course); else courseLabel.Text = "N/A"; speedLabel.Text = string.Format ("{0} m/s", args.NewLocation.Speed); }
private void UpdatedLocation(object sender, CLLocationUpdatedEventArgs args) { //var PosAccuracy = args.NewLocation.HorizontalAccuracy; //if (PosAccuracy >= 0) { locationManager.StopUpdatingLocation(); HandleLocManagerDelOnUpdatedLocation(args.NewLocation); } }
void _LocationManagerOnUpdatedLocation(object sender, CLLocationUpdatedEventArgs e) { _requestLocationTaskCompletionSource.SetResult(e.NewLocation); }
void UpdatedLocation(object sender, CLLocationUpdatedEventArgs e) { UpdateLocation(e.NewLocation); }
void LocationManager_UpdatedLocation(object sender, CLLocationUpdatedEventArgs e) { Console.WriteLine("Location (Floor {0}): {1}", e.NewLocation.Floor, e.NewLocation); }
static void HandleCoreLocationManagerUpdatedLocation (object sender, CLLocationUpdatedEventArgs e) { OldLocation = e.OldLocation; NewLocation = e.NewLocation; if(LocationUpdated != null) LocationUpdated(e); }
private void UpdatedLocation(object sender, CLLocationUpdatedEventArgs args) { const double LatitudeDelta = 0.002; //no. of degrees to show in the map const double LongitudeDelta = LatitudeDelta; var PosAccuracy = args.NewLocation.HorizontalAccuracy; if (PosAccuracy >= 0) { var coord = args.NewLocation.Coordinate; HandleUpdatedLocation(args.NewLocation); } }
/// <summary> /// Converts the <see cref="CLLocationsUpdatedEventArgs"/> to <see cref="LocationsUpdatedEvent"/>. /// </summary> /// <param name="args">The arguments.</param> /// <returns>The notification.</returns> public static LocationUpdatedEvent ToNotification(CLLocationUpdatedEventArgs args) => new LocationUpdatedEvent( args.OldLocation.Coordinate.ToLocation(), args.NewLocation.Coordinate.ToLocation());