private void InvokeCoordsChanged(CoordsChangeData coordsChangeData) { if (CoordsChanged is not null) { CoordsChanged.Invoke(coordsChangeData); } }
public async Task <Position> GetCurrentLocation() { location = new LocationService(); location.PositionChanged += (s, e) => { CoordsChanged?.Invoke(s, e); }; var position = await location.GetCurrentPosition(); return(position); }
// Instance method to get the current GPS location Coordinates from device public async Task <Position> GetCurrentLocation() { // Initialise our location service variable that points to our LocationService class location = new LocationService(); location.LocationChanged += (sender, e) => { // Raise our PositionChanged EventHandler, using the Coordinates CoordsChanged.Invoke(sender, e); }; // Get the current device GPS location coordinates var position = await location.GetCurrentPosition(); return(position); }