public async Task UpdateMapAsync(LatLng userLocation) { if (userLocation != null) { await Task.Run(async() => { // work out if map should be moved or only the markers if (_oldUserLocation == null) { _oldUserLocation = userLocation; } var moveMap = MappingUtilities.ShouldMoveMap1(userLocation, _oldUserLocation, _eventLocation); if (moveMap) { // update the old user location _oldUserLocation = _currentUserLocation; } // Update the current user location _currentUserLocation = userLocation; // draw the map await DrawMapAsync(moveMap); }); } }
public async void OnLocationChanged(object s, LocationChangedEventArgs e) { if (MappingUtilities.RemoveLocationJitter(e.CurrentLocation, e.LastLocation)) { var userLocation = new LatLng(e.CurrentLocation.Latitude, e.CurrentLocation.Longitude); await UpdateMapAsync(userLocation); } }