Esempio n. 1
0
        private void CreateParkingSlots( )
        {
            parkingslot = new Parkslot[parkingSize];

            for (int i = 0; i < parkingSize; i++)
            {
                parkingslot[i] = new Parkslot();
            }
        }
Esempio n. 2
0
        private void UnParkACar(object obj)
        {
            int index = 0;

            for (int i = 0; i < maxIterations; i++)
            {
                lock (lockObj) {
                    index = GetCarToDepart();
                    if (index >= 0)
                    {
                        Car car = parkingslot[index].ParkedCar;

                        Console.WriteLine(String.Format("The car with reg. nr left the parking house!", car.Regnr));
                        parkingslot[index] = new Parkslot();
                    }
                }
                Thread.Sleep(random.Next(100, 500));
            }
            Console.WriteLine("Finished unparking!");
        }