public void UpdateTravelTime(string origin, string dest)
        {
            TravelTimeData data = TravelTimeService.FetchTravelTime(origin, dest);

            if (null == data)
            {
                return;
            }
            viewModel.Distance = data.TravelDistance;
            viewModel.Time     = data.TravelTime;
        }
Пример #2
0
        public static TravelTimeData FetchTravelTime(string origin, string destination)
        {
            TravelTimeJSON data = GetTravelTimeData(origin, destination);

            if (null == data)
            {
                return(null);
            }
            TravelTimeData travelTime = new TravelTimeData(DateTime.Now)
            {
                TravelDistance = data.rows[0].elements[0].distance.text,
                TravelTime     = data.rows[0].elements[0].duration.text
            };

            return(travelTime);
        }