예제 #1
0
        private async Task SetSelectedCarType(LyftRideTypeEnum type)
        {
            LyftPremierBackground = new SolidColorBrush(Colors.White);
            LyftPlusBackground    = new SolidColorBrush(Colors.White);
            LyftLineBackground    = new SolidColorBrush(Colors.White);
            LyftBackground        = new SolidColorBrush(Colors.White);

            switch (type)
            {
            case LyftRideTypeEnum.Unknown:
                break;

            case LyftRideTypeEnum.Lyft:
                LyftBackground = new SolidColorBrush(Colors.WhiteSmoke);
                break;

            case LyftRideTypeEnum.Plus:
                LyftPlusBackground = new SolidColorBrush(Colors.WhiteSmoke);
                break;

            case LyftRideTypeEnum.Line:
                LyftLineBackground = new SolidColorBrush(Colors.WhiteSmoke);
                break;

            case LyftRideTypeEnum.Premier:
                LyftPremierBackground = new SolidColorBrush(Colors.WhiteSmoke);
                break;

            default:
                break;
            }

            await UpdateRideTypesAvailable();
        }
예제 #2
0
        private void SetLyftRideAsUnavilable(LyftRideTypeEnum rideType)
        {
            switch (rideType)
            {
            case LyftRideTypeEnum.Unknown:
                break;

            case LyftRideTypeEnum.Lyft:
                LyftBackground    = new SolidColorBrush(Colors.LightPink);
                MinuteCounterLyft = "n/a";
                break;

            case LyftRideTypeEnum.Plus:
                LyftPlusBackground = new SolidColorBrush(Colors.LightPink);
                MinuteCounterPlus  = "n/a";
                break;

            case LyftRideTypeEnum.Line:
                LyftLineBackground = new SolidColorBrush(Colors.LightPink);
                MinuteCounterLine  = "n/a";
                break;

            case LyftRideTypeEnum.Premier:
                LyftPremierBackground = new SolidColorBrush(Colors.LightPink);
                MinuteCounterPremier  = "n/a";
                break;

            default:
                break;
            }
        }
예제 #3
0
        public static LyftModalDialogViewModel EmptyInstanceByType(LyftRideTypeEnum type, RideTypes rides = null)
        {
            switch (type)
            {
            case LyftRideTypeEnum.Lyft:
                var rideLyft = rides.Rides.Where(x => x.Ride_Type == LyftRideTypeEnum.Lyft).SingleOrDefault();
                return(LyftInstance(rideLyft));

            case LyftRideTypeEnum.Plus:
                var ridePlus = rides.Rides.Where(x => x.Ride_Type == LyftRideTypeEnum.Plus).SingleOrDefault();
                return(PlusInstance(ridePlus));

            case LyftRideTypeEnum.Unknown:
            case LyftRideTypeEnum.Line:
            case LyftRideTypeEnum.Premier:
            default:
                return(DefaultInstance());
            }
        }
예제 #4
0
        private string LyftTypeEnumToString(LyftRideTypeEnum lyftRide)
        {
            switch (lyftRide)
            {
            case LyftRideTypeEnum.Lyft:
                return("lyft");

            case LyftRideTypeEnum.Plus:
                return("lyft_plus");

            case LyftRideTypeEnum.Line:
                return("lyft_line");

            case LyftRideTypeEnum.Premier:
                return("lyft_premier");

            case LyftRideTypeEnum.Unknown:
            default:
                return(string.Empty);
            }
        }
예제 #5
0
        public async Task <Ride> StartRide(double start_lat, double start_lng, double end_lat, double end_lng, LyftRideTypeEnum ride_type, string prime_time_token = null)
        {
            using (var client = await HttpClientHelper.GetUserHttpClient())
            {
                var type = LyftTypeEnumToString(ride_type);

                var scopeJson = $"{{\"ride_type\": \"{type}\", \"origin\": {{ \"lat\" : {start_lat}, \"lng\" : {start_lng} }}, "
                                + $"\"destination\": {{ \"lat\" : {end_lat}, \"lng\" : {end_lng} }} }}";
                var content = new StringContent(scopeJson, Encoding.UTF8, "application/json");

                var response = await client.PostAsync(ORDER_RIDE_URI, content);

                var responseText = await response.Content.ReadAsStringAsync();

                var ride = JsonConvert.DeserializeObject <Ride>(responseText);


                Debug.WriteLine($"ride id: {ride.RideId}");


                return(ride);
            }
        }