void GeoLocation_PositionChanged(object sender, PositionEventArgs e) { Device.BeginInvokeOnMainThread ( () => { _currentLocation.Latitude = e.Position.Latitude; _currentLocation.Longitude = e.Position.Longitude; OnPositionUpdated(); }); }
/// <summary> /// Handles the <see cref="E:ListenerPositionChanged" /> event. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="PositionEventArgs" /> instance containing the event data.</param> private void OnListenerPositionChanged(object sender, PositionEventArgs e) { if (!IsListening) // ignore anything that might come in afterwards { return; } lock (_positionSync) { _lastPosition = e.Position; var changed = PositionChanged; if (changed != null) { changed(this, e); } } }
/// <summary> /// Handles the <see cref="E:PositionChanged" /> event. /// </summary> /// <param name="e">The <see cref="PositionEventArgs"/> instance containing the event data.</param> private void OnPositionChanged(PositionEventArgs e) { var changed = PositionChanged; if (changed != null) { changed(this, e); } }