private void ArrivedState(RideDetails details) { StatusText = "YOUR DRIVER IS HERE"; RideState = LyftRideState.Arrived; if (details.Location != null) { var pickupLocation = new Geopoint(new BasicGeoposition() { Latitude = details.Origin.Latitude, Longitude = details.Origin.Longitude - 0.0002, }); var driverLocation = new Geopoint(new BasicGeoposition() { Latitude = details.Location.Lat, Longitude = details.Location.Lng }); UpdateMap(pickupLocation, driverLocation); } if (details.Destination != null && details.Destination.EtaSeconds != null) { _ETAcount = (int)details.Destination.EtaSeconds / 60; } }
private void Pickedup(RideDetails details) { RideState = LyftRideState.PickedUp; if (details.Location != null) { var destinationLocation = new Geopoint(new BasicGeoposition() { Latitude = details.Destination.Latitude, Longitude = details.Destination.Longitude, }); var driverLocation = new Geopoint(new BasicGeoposition() { Latitude = details.Location.Lat, Longitude = details.Location.Lng }); UpdateMap(driverLocation, destinationLocation); } if (details.Destination != null && details.Destination.EtaSeconds != null) { _ETAcount = (int)details.Destination.EtaSeconds / 60; StatusText = $"YOU'LL ARRIVE IN {_ETAcount} MIN"; } else { StatusText = "NO VALID ETA AT THIS TIME"; } }
private void DroppedOff(RideDetails details) { RideState = LyftRideState.DroppedOff; RideDetailsTimer.Stop(); var parameter = new PaymentPageNavigationModel() { RideId = details.RideId, DriverName = details.Driver.FirstName, LineItems = details.LineItems, ProfileImageSrc = details.Driver.ImageUrl }; _settings.ActiveRideId = string.Empty; NavigationService.Navigate(typeof(Views.PaymentPage), parameter); }
public RidePageViewModel() { _lyftRidesApi = new LyftRidesApi(); PickupPoint = new Geopoint(new BasicGeoposition() { Latitude = 32.7555, Longitude = -97.3308 }); LocationPoint = new Geopoint(new BasicGeoposition() { Latitude = 32.7555, Longitude = -97.3308 }); DestinationPoint = new Geopoint(new BasicGeoposition() { Latitude = 32.7555, Longitude = -97.3308 }); CenterPoint = new Geopoint(new BasicGeoposition() { Latitude = 32.7555, Longitude = -97.3308 }); CarModel = "Car model"; LicensePlate = "XXXXXXX"; DriverName = "Driver name"; DriverRating = "Rating"; StatusText = "CONTACTING NEARBY DRIVERS"; ShowProfilePic = Visibility.Collapsed; RideState = LyftRideState.Pending; _driverPhoneNumber = ""; _ETAcount = 0; ShowCarDetails = false; Spinner = true; Driver = new ObservableCollection <MapLyftIcon>(); _settings = SettingsService.Instance; ProfileImageSrc = new Uri("ms-appx://29Lifts/Assets/image.jpg"); ProfileImageUserSrc = _settings.ProfileImageSrc; RideDetailsTimer = new DispatcherTimer(); RideDetailsTimer.Interval = TimeSpan.FromMilliseconds(10000.0); RideDetailsTimer.Tick += RideDetailsTimerUpdate; RideDetailsTimer.Start(); }
private void RideAccepted(RideDetails details) { if (details.Origin != null && details.Origin.EtaSeconds != null) { StatusText = $"YOUR DRIVER WILL ARRIVE IN {(details.Origin.EtaSeconds + 30) / 60} MIN"; } else { StatusText = "YOUR RIDE HAS BEEN ACCEPTED"; } if (details.Location != null) { var pickupLocation = new Geopoint(new BasicGeoposition() { Latitude = details.Origin.Latitude, Longitude = details.Origin.Longitude, }); var driverLocation = new Geopoint(new BasicGeoposition() { Latitude = details.Location.Lat, Longitude = details.Location.Lng }); UpdateMap(pickupLocation, driverLocation); } if (RideState != LyftRideState.Accepted) { RideState = LyftRideState.Accepted; ShowCarDetails = true; Spinner = false; // driver related stuff if (details.Driver != null) { if (!string.IsNullOrEmpty(details.Driver.FirstName)) { DriverName = details.Driver.FirstName; } if (!string.IsNullOrEmpty(details.Driver.Rating)) { DriverRating = $"{details.Driver.Rating}"; } else { DriverRating = "No rating"; } if (!string.IsNullOrEmpty(details.Driver.ImageUrl)) { ProfileImageSrc = new Uri(details.Driver.ImageUrl); ShowProfilePic = Visibility.Visible; } if (!string.IsNullOrEmpty(details.Driver.PhoneNumber)) { _driverPhoneNumber = details.Driver.PhoneNumber; } } if (details.Vehicle != null) { var modelSet = false; if (!string.IsNullOrEmpty(details.Vehicle.Model)) { CarModel = details.Vehicle.Model; modelSet = true; } if (!modelSet && !string.IsNullOrEmpty(details.Vehicle.Make)) { CarModel = details.Vehicle.Make; } if (!string.IsNullOrEmpty(details.Vehicle.LicensePlate)) { LicensePlate = details.Vehicle.LicensePlate; } if (!string.IsNullOrEmpty(details.Vehicle.ImageUrl)) { CarImageSrc = new BitmapImage(new Uri(details.Vehicle.ImageUrl)); } } } }