private void RequestDriverFragment_CancelRequest(object sender, EventArgs e)
 {
     //User cancels request before driver accepts it
     if (requestDriverFragment != null && requestListener != null)
     {
         requestListener.CancelRequest();
         requestListener = null;
         requestDriverFragment.Dismiss();
         requestDriverFragment = null;
     }
 }
        async void RequestDriver()
        {
            try
            {
                if (!IsConnected)
                {
                    await ConnectAsync();
                }

                if (tripDetails == null || (tripDetails != null && tripDetails.Action != "E"))
                {
                    tripDetails = new Rides();
                    RidesLocationInfo locationInfo = new RidesLocationInfo();
                    RidesInfo         ridesInfo    = new RidesInfo();
                    #region location Information
                    locationInfo.PickupDestinationName = destinationAddress;
                    locationInfo.PickupLocationName    = pickupAddress;
                    locationInfo.DestinationLatitude   = Convert.ToDecimal(destinationLatLng.Latitude);
                    locationInfo.DestinationLongitude  = Convert.ToDecimal(destinationLatLng.Longitude);
                    locationInfo.TotalDistance         = Convert.ToDecimal(mapHelper.distance);
                    locationInfo.PickupLatitude        = Convert.ToDecimal(pickupLocationLatlng.Latitude);
                    locationInfo.PickupLongitude       = Convert.ToDecimal(pickupLocationLatlng.Longitude);
                    #endregion
                    #region Rides Information
                    ridesInfo.EstimatedArrivalTime = Convert.ToDecimal(mapHelper.duration);
                    ridesInfo.TotalCost            = Convert.ToDecimal(mapHelper.EstimateFares(selectedVehicleType));
                    ridesInfo.RideBookingTime      = DateTime.Now;
                    #endregion
                    #region tripInformation
                    tripDetails.CustomerId             = new AppData().GetCurrentUser.CustomerId;
                    tripDetails.VehicleTypeId          = selectedVehicleType.TypeId;
                    tripDetails.RideTypeId             = 1;
                    tripDetails.RidesInfo              = ridesInfo;
                    tripDetails.RidesInfo.LocationInfo = locationInfo;
                    #endregion
                }
                requestListener = new CreateRequestEventListener(tripDetails, hubConnection);
                requestListener.NoDriverAcceptedRequest += RequestListener_NoDriverAcceptedRequest;
                requestListener.DriverAccepted          += RequestListener_DriverAccepted;
                requestListener.TripUpdates             += RequestListener_TripUpdates;
                requestListener.SendNotification        += RequestListener_SendNotification;

                ResponseData response = await requestListener.CreateRequest();

                if (response.IsSuccess == false)
                {
                    requestListener.CancelRequest();
                    requestListener = null;
                    requestDriverFragment.Dismiss();
                    requestDriverFragment = null;
                    Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);
                    alert.SetTitle("Message");
                    alert.SetMessage("Request not Completed. " + response.Message);
                    alert.Show();
                }
                else
                {
                    tripDetails        = FetchInformation(response);
                    findDriverListener = new FindDriverListener(tripDetails, hubConnection);
                    findDriverListener.DriversFound   += FindDriverListener_DriversFound;
                    findDriverListener.DriverNotFound += FindDriverListener_DriverNotFound;
                    requestDriverFragment              = new RequestDriver(Convert.ToDouble(tripDetails.RidesInfo.TotalCost), selectedVehicleType.Image);
                    requestDriverFragment.Cancelable   = false;
                    var trans = SupportFragmentManager.BeginTransaction();
                    requestDriverFragment.Show(trans, "Request");
                    requestDriverFragment.CancelRequest += RequestDriverFragment_CancelRequest;
                    // reqView = requestDriverFragment.View;
                    findDriverListener.Create(activeDrivers);
                }
            }
            catch (Exception ex)
            {
                ExceptionDialogue("Error", "Error in connection please try again");
            }
        }