void HomeFragment_CurrentLocation(object sender, Helpers.LocationCallbackHelper.OnLocationCaptionEventArgs e) { _mLastLocation = e.Location; _mLastLatLng = new LatLng(_mLastLocation.Latitude, _mLastLocation.Longitude); _availablityListener?.UpdateLocation(_mLastLocation); if (_availablityStatus && _availablityListener == null) { TakeDriverOnline(); } if (_status == "ACCEPTED") { LatLng pickupLatLng = new LatLng(_newRideDetails.PickupLat, _newRideDetails.PickupLng); _mapHelper.UpdateMovement(_mLastLatLng, pickupLatLng, "Rider"); _newTripEventListener.UpdateLocation(_mLastLocation); } else if (_status == "ARRIVED") { _newTripEventListener.UpdateLocation(_mLastLocation); } else if (_status == "ONTRIP") { LatLng destinationLatLng = new LatLng(_newRideDetails.DestinationLat, _newRideDetails.DestinationLng); _mapHelper.UpdateMovement(_mLastLatLng, destinationLatLng, "Destination"); _newTripEventListener.UpdateLocation(_mLastLocation); } }
// Driver's current location private void HomeFragment_CurrentLocation(object sender, HomeFragment.OnLocationCapturedEventArgs e) { mLastLocation = e.Location; mLastLatLng = new LatLng(mLastLocation.Latitude, mLastLocation.Longitude); // check if driver is online to update his/her location if (availabilityListener != null) { availabilityListener.UpdateLocation(mLastLocation); } if (availabilityStatus && availabilityListener == null) { TakeDriverOnline(); } // picking patient if (status == "ACCEPTED") { // update and animate driver movement to location LatLng pickupLatLng = new LatLng(newRideDetails.PickupLat, newRideDetails.PickupLng); mapHelper.UpdateMovement(mLastLatLng, pickupLatLng, "Rider"); // Update location in rideRequest table so that rider can receive updates newTripEventListener.UpdateLocation(mLastLocation); } else if (status == "ARRIVED") { newTripEventListener.UpdateLocation(mLastLocation); } else if (status == "ONTRIP") { // Update and animate driver movement to destination LatLng destinationLatLng = new LatLng(newRideDetails.DestinationLat, newRideDetails.DestinationLng); mapHelper.UpdateMovement(mLastLatLng, destinationLatLng, "Destination"); // Update Location in ride request Table, so that rider receives updates newTripEventListener.UpdateLocation(mLastLocation); } }