Example #1
0
        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);
            }
        }
Example #2
0
        private void HomeFragment_CurrentLocation(object sender, LocationCallbackHelper.OnLocationCaptionEventArgs e)
        {
            mLastLocation = e.Location;
            mLastLatLng   = new LatLng(mLastLocation.Latitude, mLastLocation.Longitude);

            if (availablityListener != null)
            {
                availablityListener.UpdateLocation(mLastLocation);
            }

            if (availablityStatus && availablityListener == null)
            {
                TakeDriverOnline();
            }

            switch (statusEnum)
            {
            case RideStatusEnum.Accepted:
            {
                //Update and Animate driver movement to pick up location
                LatLng pickupLatLng = new LatLng(newRideDetails.PickupLat, newRideDetails.PickupLng);
                mapHelper.UpdateMovement(mLastLatLng, pickupLatLng, ToPositionOf.Rider);

                //Updates Location in rideRequest Table, so that Rider can receive Updates
                newTripEventListener.UpdateLocation(mLastLocation);
                break;
            }

            case RideStatusEnum.Arrived:
                newTripEventListener.UpdateLocation(mLastLocation);
                break;

            case RideStatusEnum.Ontrip:
            {
                //Update and animate driver movement to Destination
                LatLng destinationLatLng = new LatLng(newRideDetails.DestinationLat, newRideDetails.DestinationLng);
                mapHelper.UpdateMovement(mLastLatLng, destinationLatLng, ToPositionOf.Destination);

                //Update Location on firebase
                newTripEventListener.UpdateLocation(mLastLocation);
                break;
            }

            case RideStatusEnum.Cancelled:
                break;

            case RideStatusEnum.Normal:
                break;

            case RideStatusEnum.Ended:
                break;
            }
        }
        void HomeFragment_CurrentLocation(object sender, Helpers.LocationCallbackHelper.OnLocationCaptionEventArgs e)
        {
            mLastLocation = e.Location;
            mLastLatLng   = new LatLng(mLastLocation.Latitude, mLastLocation.Longitude);

            if (availablityListener != null)
            {
                availablityListener.UpdateLocation(mLastLocation);
            }

            if (availablityStatus && availablityListener == null)
            {
                TakeDriverOnline();
            }

            if (status == "ACCEPTED")
            {
                //Update and Animate driver movement to pick up lOcation
                LatLng pickupLatLng = new LatLng(newRideDetails.PickupLat, newRideDetails.PickupLng);
                mapHelper.UpdateMovement(mLastLatLng, pickupLatLng, "Rider");

                //Updates 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 on firebase
                newTripEventListener.UpdateLocation(mLastLocation);
            }
        }