public ExtendedVehicle(dynamic returnedVehicle, VehiclesProvider vehiclesProvider, int index)
            {
                lastUpdatingMomentOnThisBase = DateTime.Now;
                OptimalRoute.GeoCoords coords = new OptimalRoute.GeoCoords(Math.Round((double)returnedVehicle.lat / 1000000, 4), Math.Round((double)returnedVehicle.lon / 1000000, 4));
                DateTime lastTimeMoment       = DateTime.Parse((string)returnedVehicle.lasttime);
                double   speed   = (double)returnedVehicle.speed;
                int      routeId = (int)returnedVehicle.rid;

                //Route route = null;
                foreach (ExtendedRoute r in extendedRoutes[index])
                {
                    if (r.idForvard == routeId || r.idReverse == routeId)
                    {
                        id = (string)returnedVehicle.id;//!!!!!!!!!!!! было int
                        bool ok = true;
                        foreach (ExtendedVehicle v in extendedVehicles[index])
                        {
                            if (v.id == id)
                            {
                                ok = false;
                                break;
                            }
                        }
                        if (ok)
                        {
                            Vehicle addingVehicle = new Vehicle(r.route, vehiclesProvider);
                            vehicle = addingVehicle;

                            vehicles.TryAdd(id, addingVehicle);
                        }
                        break;
                    }
                }
            }
 public static void Load(VehiclesProvider provider)
 {
     if (provider == null)
     {
         throw new ArgumentNullException();
     }
     foreach (ExtendedVehiclesProvider p in vehiclesProviders)
     {
         if (p.Equals(provider))
         {
             throw new ArgumentException();
         }
     }
     vehiclesProviders.Add(new ExtendedVehiclesProvider(provider));
 }
        public Vehicle(Route route, VehiclesProvider vehiclesProvider)
        {
            lastUpdatingMomentOnThisBase = DateTime.Now;
            this.route            = route;
            this.vehiclesProvider = vehiclesProvider;

            if (route != null && !route.vehicles.Contains(this))
            {
                //bool ok = true;
                //foreach (Vehicle v in route.vehicles)
                //{
                //    //if(v.id)
                //}

                route.vehicles.Add(this);
            }
            hashcode = GlobalVehiclesProvider.NextHashcode;
        }
 public ExtendedVehiclesProvider(VehiclesProvider provider)
 {
     this.provider = provider;
     Enable();
 }
 public bool Equals(VehiclesProvider provider)
 {
     return(provider.GetType() == this.GetType());
 }