private void Submit_Clicked(object sender, EventArgs e) { // Submit Comment and stars // Get Rating // Get Any comments submit.IsEnabled = false; double rated = rating.Value; //string comment = body.Text; int trips = 0; if (Trip.Driver.Trips != null) { trips = int.Parse(Trip.Driver.Trips) + 1; } else { trips = 1; } _firebaseDatabase.UpdateDriverTrips(Trip.Driver.Key, trips.ToString()); _firebaseDatabase.SubmitTripRating(Trip.Key, rated, ""); _firebaseDatabase.GetOnline(Trip.Driver.Key); App.Current.MainPage = new MainPage(); }
private async void GetOnline_Clicked(object sender, EventArgs e) { // SHow Loader loader.IsVisible = true; getOnline.IsEnabled = false; var uid = await _firebaseAuth.GetCurrentUser(); if (uid != null) { _firebaseDatabase.GetOnline(uid); } }
private void SetProfile(UserModel User) { MessagingCenter.Send <object, object>(this, "profile", User); sUser = User; username.Text = User.Name; IsGestureEnabled = true; userimage.Source = ImageSource.FromUri(new Uri(User.Image)); //userrating.Text = GetRating(User.Trips,User.Stars); //usertrips.Text = User.Trips; if (User.Status == "Online") { if (User.Trip != "00") { App.Current.MainPage = new NavigationPage(new TripPage(User.Trip)); } if (!isreq) { isreq = true; GetRequest(User.Key); } CrossLocalNotifications.Current.Show("Nasiye", "You're online now, waiting for requests"); } if (User.Status == "Busy") { if (User.Trip != "00") { App.Current.MainPage = new NavigationPage(new TripPage(User.Trip)); } else { _firebaseDatabase.GetOnline(User.Key); } } else { if (User.Trip != "00") { App.Current.MainPage = new NavigationPage(new TripPage(User.Trip)); } isreq = false; } loader.IsVisible = false; profilecon.IsVisible = true; }
private async void ShowTripProgress(TripModel tripModel) { Trip = tripModel; ShowMap(tripModel.User, tripModel.Driver); status.Text = tripModel.Status; if (tripModel.Status == "Accepted") { // SHow wait // SHow action buttons iconsbox.IsVisible = true; wcon.IsVisible = true; loader.IsVisible = false; status.Text = "Accepted"; ShowTripInfo(tripModel); } else if (tripModel.Status == "Wait") { // SHow arrived ontheway.IsVisible = false; arived.IsVisible = true; status.Text = "User waiting"; } else if (tripModel.Status == "Arrived") { arived.IsVisible = false; start.IsVisible = true; status.Text = "Waiting for User"; } else if (tripModel.Status == "Started") { status.Text = "Trip On Going"; if (stopwatch.IsRunning) { stopwatch.Restart(); } else { stopwatch.Start(); } // hide all wcon.IsVisible = false; // Show trip trpinfocon.IsVisible = true; // Show loading loader.IsVisible = false; // SHow trip info pstopwatch.Stop(); StartTripInfo(tripModel); if (!sisrunning) { sisrunning = true; DistanceUpdate(true); UpdateDuration(); } if (pisrunning) { pisrunning = false; UpdatePausedTime(false); } pausetrip.IsVisible = true; rstart.IsVisible = false; } else if (tripModel.Status == "Paused") { if (pstopwatch.IsRunning) { pstopwatch.Restart(); } else { pstopwatch.Start(); } status.Text = "Trip Paused"; if (sisrunning) { sisrunning = false; UpdateDuration(false); DistanceUpdate(); } if (!pisrunning) { pisrunning = true; UpdatePausedTime(); } rstart.IsVisible = true; pausetrip.IsVisible = false; stopwatch.Stop(); } else if (tripModel.Status == "End") { DeviceDisplay.KeepScreenOn = true; // Stop Trip Updates UpdateDuration(false); UpdatePausedTime(false); GetAmountUpdate(tripModel); await StartTrackingAsync(false); MessagingCenter.Unsubscribe <object, string>(this, "tripin"); _firebaseDatabase.RemoveGetTrips(Trip.Key); App.Current.MainPage = new NavigationPage(new RatingPage(tripModel)); } else if (tripModel.Status == "Canceled") { // Stop Trip Updates UpdateDuration(false); UpdatePausedTime(false); DistanceUpdate(); string uid = await _firebaseAuth.GetCurrentUser(); StartTrackingAsync(false); MessagingCenter.Unsubscribe <object, string>(this, "tripin"); await DisplayAlert("Trip", "Trip Canceled", "OK"); _firebaseDatabase.GetOnline(uid); _firebaseDatabase.RemoveGetTrips(Trip.Key); App.Current.MainPage = new MainPage(); } }