Esempio n. 1
0
 public Car BuildCar()
 {
     carBuilder.BuildBody();
     carBuilder.BuildEngine();
     carBuilder.BuildWheel();
     return(carBuilder.GetCar());
 }
        public void BuildCar()
        {
            Console.WriteLine("We have new order, time to build new car! Let's move!");
            Console.ReadKey();
            List <Task> taskList = new List <Task>();

            taskList.Add(Task.Factory.StartNew(() => _carBuilder.BuildBody()));
            taskList.Add(Task.Factory.StartNew(() => _carBuilder.BuildEngine()));
            taskList.Add(Task.Factory.StartNew(() => _carBuilder.BuildSuspension()));

            Console.WriteLine("How long do i have to wait on one car?!");
            Task.WaitAll(taskList.ToArray());
            Console.WriteLine("Finally, your car is ready sir");
        }
Esempio n. 3
0
 public void MakeCar()
 {
     CarBuilder.BuildBody();
     CarBuilder.BuildTransmission();
     CarBuilder.BuildEngine();
 }
Esempio n. 4
0
 public void BuildCar(ICarBuilder carBuilder)
 {
     carBuilder.BuildBody();
     carBuilder.BuildEngine();
     carBuilder.BuildSeats();
 }