static void Main(string[] args) { //Separate the construction of a complex object from its representation //so that the same construction process can create different representations. VehicleBuilder builder; // Create shop with vehicle builders Shop shop = new Shop(); // Construct and display vehicles builder = new ScooterBuilder(); shop.Construct(builder); builder.Vehicle.Show(); builder = new CarBuilder(); shop.Construct(builder); builder.Vehicle.Show(); builder = new MotorCycleBuilder(); shop.Construct(builder); builder.Vehicle.Show(); // Wait for user Console.ReadKey(); }
static void Main(string[] args) { VehicleBuilder builder; // Create shop with vehicle builders Shop shop = new Shop(); // Construct and display vehicles builder = new ScooterBuilder(); shop.Construct(builder); builder.Vehicle.Show(); builder = new CarBuilder(); shop.Construct(builder); builder.Vehicle.Show(); builder = new MotorCycleBuilder(); shop.Construct(builder); builder.Vehicle.Show(); // Wait for user Console.ReadKey(); }
public static void Run() { //make determination of which type of builder and director to instantiate var builder = new CarBuilder(); var director = new CarDirector(builder); var vehicle = director.Build(); Console.WriteLine(vehicle); }
static void Main(string[] args) { CarBuilder builder = new CarBuilder(); Director director = new Director(builder); director.BuildLowCostCar(); Car newCar = builder.GetCar(); Console.WriteLine(newCar.GetCarConfiguration()); }
static void Main(string[] args) { CarBuilder builder = new CarBuilder(); Car car1 = builder.Brand("Opel").Model("Astra").Km(1500).Gear(true).build(); Car car2 = builder.Brand("Toyota").Model("Sante").Km(1700).build(); Car car3 = builder.Brand("BMW").Model("X5").build(); Console.WriteLine(car1); Console.WriteLine(car2); Console.WriteLine(car3); Console.ReadKey(); }
static void Main(string[] args) { VehicleBuilder vehicleBuilder; var manufacturer = new VehicleManufacturer(); vehicleBuilder = new CarBuilder(); manufacturer.Construct(vehicleBuilder); vehicleBuilder.Vehicle.Show(); vehicleBuilder = new MotorCycleBuilder(); manufacturer.Construct(vehicleBuilder); vehicleBuilder.Vehicle.Show(); vehicleBuilder = new BusBuilder(); manufacturer.Construct(vehicleBuilder); vehicleBuilder.Vehicle.Show(); }
static void Main(string[] args) { //razdelqme na chasti syzdavaneto na edin obekt Console.WriteLine("Hello World!"); Car car = new Car(); CarBuilder builder = new CarBuilder(); //buildPattern builder.BuildEngine(car); builder.BuildKutiq(car); builder.BuildTyres(car); //fluent interface builder.BuildTyres(car) .BuildTyres(car) .BuildKutiq(car); }
static void Main(string[] args) { var car = new Car(4, new SeatBelt("OngDev"), "red", new Windscreen("OngDev"), new Engine("Foot")); var carByBuilder = new CarBuilder() .AddWheels(4) .AddSeatBelts(new SeatBelt("Ong Dev Seat Belt")) .AddWindscreen(new Windscreen("Ong Dev wind screen")) .AddEngine(new Engine("Ong Dev Foot")) .Paint("red") .Build(); Console.WriteLine(car.ToString()); Console.WriteLine("------------------------------------"); Console.WriteLine(carByBuilder.ToString()); }
static void Main(string[] args) { VehicalBuilder builder; ShopVehicle shopVehicle = new ShopVehicle(); builder = new MotorCycleBuilder(); shopVehicle.ConstructParts(builder); builder.productVehicle.ShowDetails(); builder = new CarBuilder(); shopVehicle.ConstructParts(builder); builder.productVehicle.ShowDetails(); builder = new TruckBuilder(); shopVehicle.ConstructParts(builder); builder.productVehicle.ShowDetails(); Console.ReadLine(); }
static void Main(string[] args) { VehicleBuilder builder; Shop shop = new Shop(); builder = new ScooterBuilder(); shop.Build(builder); builder.Vehicle.Show(); builder = new CarBuilder(); shop.Build(builder); builder.Vehicle.Show(); builder = new MotorCycleBuilder(); shop.Build(builder); builder.Vehicle.Show(); Console.ReadKey(); }
static void Main(string[] args) { var shopDirectory = new ShopDirector(); var carBuilder = new CarBuilder(); shopDirectory.CreateVehicle(carBuilder); var car = carBuilder.Vehicle; car.Print(); var scooterBuilder = new ScooterBuilder(); shopDirectory.CreateVehicle(scooterBuilder); var scooter = scooterBuilder.Vehicle; scooter.Print(); Console.ReadLine(); }
static void Main(string[] args) { // for complex objects where we need only parts of the object, not the whole Car car = new Car(); CarBuilder builder = new CarBuilder(); //builder.BuildEngine(car); //builder.BuildTyres(car); //builder.BuildDoors(car); -> BuilderPattern builder .BuildDoors(car) .BuildEngine(car) .BuildEngine(car) .BuildTyres(car) .BuildDoors(car); // Fluent API || method chainnig Console.WriteLine($"Engine is - {car.Engine}, " + $"Tyres are - {car.Tyres}, " + $"Doors can - {car.Doors}"); }
static void Main(string[] args) { // Create director and builders Director director = new Director(); Builder b1 = new ConcreteBuilder1(); Builder b2 = new ConcreteBuilder2(); // Construct two products director.Construct(b1); Product p1 = b1.GetResult(); p1.Show(); director.Construct(b2); Product p2 = b2.GetResult(); p2.Show(); //1.练习 VehicleBuilder builder; // Create shop with vehicle builders Shop shop = new Shop(); // Construct and display vehicles builder = new ScooterBuilder(); shop.Construct(builder); builder.Vehicle.Show(); builder = new CarBuilder(); shop.Construct(builder); builder.Vehicle.Show(); builder = new MotorCycleBuilder(); shop.Construct(builder); builder.Vehicle.Show(); Console.ReadKey(); }
private void Button_Click(object sender, RoutedEventArgs e) { List <string> list = new List <string>(); VehicleBuilder builder; WorkShop _WorkShop = new WorkShop(); builder = new ScooterBuilder(); _WorkShop.Construct(builder); list = new List <string>(); list = builder.Vehicle.Show(); ucVehicelShow _ucVehicelShow = new ucVehicelShow(list); stkMain.Children.Add(_ucVehicelShow); builder = new MotorCycleBuilder(); _WorkShop.Construct(builder); list = new List <string>(); list = builder.Vehicle.Show(); ucVehicelShow _ucVehicelShow1 = new ucVehicelShow(list); stkMain.Children.Add(_ucVehicelShow1); builder = new CarBuilder(); _WorkShop.Construct(builder); list = new List <string>(); list = builder.Vehicle.Show(); ucVehicelShow _ucVehicelShow2 = new ucVehicelShow(list); stkMain.Children.Add(_ucVehicelShow2); }
public void BuildCar(CarBuilder builder) { builder.BuildChassis(); builder.BuildDrivetrain(); builder.BuildBody(); builder.BuildElectrical(); builder.BuildInterior(); }
public Car CreateCar(CarBuilder carBuilder) { carBuilder.BuildCar(); return(carBuilder.GetCar()); }
public void Construct(CarBuilder builder) { builder.BuildBody(); builder.BuildEngine(); builder.BuildWheels(); }