コード例 #1
0
        /// <summary>
        /// Gets the platform GPS.
        /// </summary>
        /// <param name="stopAssociations">The stop associations.</param>
        /// <param name="stopClosure">The stop closure.</param>
        /// <param name="stopModel">The stop model.</param>
        /// <param name="routeAssociation">The route association.</param>
        private static void GetPlatformGps(List <BusRouteStop> stopAssociations, Platform stopClosure, BusStop stopModel, BusRouteStop routeAssociation)
        {
            // get the platform gps position
            var platformDetails = TransitClient.GetPlatform(stopClosure.PlatformTag);

            if (platformDetails.Position != null)
            {
                stopModel.Latitude  = platformDetails.Position.Lat;
                stopModel.Longitude = platformDetails.Position.Long;
            }
            lock (locker)
            {
                stopAssociations.Add(routeAssociation);
            }
        }
コード例 #2
0
        /// <summary>
        /// Updates the stop eta.
        /// </summary>
        /// <param name="stopClosure">The stop closure.</param>
        private static void UpdateStopEta(BusRouteStop stopClosure)
        {
            var stopEtaDetails = TransitClient.GetPlatformEta(stopClosure.StopModel.StopTag);
            var platform       = stopEtaDetails.GetPlatform(stopClosure);

            // if we don't have the platform, set Eta to 0, same if we don't have the detail
            if (platform != null)
            {
                var detail = platform.Route.FirstOrDefault(rt => rt.RouteNo == stopClosure.RouteModel.RouteNo);
                if (detail != null)
                {
                    stopClosure.Eta = detail.Destination.Trip.ETA;
                }
                else
                {
                    stopClosure.Eta = 0;
                }
            }
            else
            {
                stopClosure.Eta = 0;
            }
        }