Esempio n. 1
0
        private async void TripButton_TouchUpInside(object sender, EventArgs e)
        {
            if (status == "ACCEPTED")
            {
                tripButton.BackgroundColor = UIColor.FromRGB(37, 178, 79);
                tripButton.SetTitle("START TRIP", UIControlState.Normal);

                status = "ARRIVED";
                newtripListener.UpdateStatus("arrived");


                ShowProgressBar("Plotting route...");
                var pickupLatLng      = new CLLocationCoordinate2D(newRideDetails.PickupLat, newRideDetails.PickLng);
                var destinationLatLng = new CLLocationCoordinate2D(newRideDetails.DestinationLat, newRideDetails.DestinationLng);

                //Fetch direction data from pickup to destination
                string directionJson = await mapHelper.GetDirectionJsonAsync(pickupLatLng, destinationLatLng);

                HideProgressBar();

                // Clear Map
                googleMap.Clear();
                mapHelper.DrawTripToDestination(directionJson);
            }
            else if (status == "ARRIVED")
            {
                var alert = UIAlertController.Create("START TRIP", "You are about to start this trip", UIAlertControllerStyle.Alert);
                alert.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, null));
                alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, (obj) =>
                {
                    status = "ONTRIP";
                    newtripListener.UpdateStatus("ontrip");

                    tripButton.BackgroundColor = UIColor.FromRGB(196, 45, 45);
                    tripButton.SetTitle("DROP OFF RIDER", UIControlState.Normal);

                    durationCounter = new Stopwatch();
                    durationCounter.Start();
                }));

                PresentViewController(alert, true, null);
            }
            else if (status == "ONTRIP")
            {
                var           alert             = UIAlertController.Create("END TRIP", "Drop-off Passender", UIAlertControllerStyle.Alert);
                UIAlertAction alertActionCancel = UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, null);

                alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, (obj) =>
                {
                    status = "ENDED";
                    tripButton.SetTitle("TRIP ENDED", UIControlState.Normal);
                    TripEnd();
                }));
                alert.AddAction(alertActionCancel);
                PresentViewController(alert, true, null);
            }
        }
Esempio n. 2
0
        public void HomeFragment_TripActionStartTrip(object sender, EventArgs e)
        {
            var startTripAlert = new SweetAlertDialog(this, SweetAlertDialog.WarningType);

            startTripAlert.SetTitleText("Start Trip");
            startTripAlert.SetContentText("Sure to start trip?");
            startTripAlert.SetCancelText("No");
            startTripAlert.SetConfirmText("Yes");
            startTripAlert.SetConfirmClickListener(new SweetConfirmClick(s =>
            {
                statusEnum = RideStatusEnum.Ontrip;
                newTripEventListener.UpdateStatus(statusEnum);
                s.Dismiss();
            }));
            startTripAlert.Show();
        }
Esempio n. 3
0
        void HomeFragment_TripActionStartTrip(object sender, EventArgs e)
        {
            Android.Support.V7.App.AlertDialog.Builder startTripAlert = new Android.Support.V7.App.AlertDialog.Builder(this);
            startTripAlert.SetTitle("START TRIP");
            startTripAlert.SetMessage("Are you sure");
            startTripAlert.SetPositiveButton("Continue", (senderAlert, args) =>
            {
                _status = "ONTRIP";
                _newTripEventListener.UpdateStatus("ontrip");
            });

            startTripAlert.SetNegativeButton("Cancel", (senderAlert, args) =>
            {
                startTripAlert.Dispose();
            });

            startTripAlert.Show();
        }