Beispiel #1
0
        static void Main(string[] args)
        {
            ComputerShop computerShop = new ComputerShop();
            var          mylappy      = new LaptopBuilder();

            computerShop.ConstructComputer(mylappy);
            mylappy.Computer.DisplayConfiguration();

            var macBook = new AppleBuilder();

            computerShop.ConstructComputer(macBook);
            macBook.Computer.DisplayConfiguration();

            ReadKey();
        }
Beispiel #2
0
        public static string GetSystemConfigurationObject(Dictionary <string, string> collection)
        {
            //Step:1 Concrete Builder building it for Laptop. Similary we can build it for DesktopBuilder.
            ISystemBuilder systemBuilder = new LaptopBuilder(); //DesktopBuilder

            //step:2 Director
            ConfigurationBuilder builder = new ConfigurationBuilder();

            builder.BuildSystem(systemBuilder, collection);

            //Step:3 Return the system
            ComputerSystemProduct product = systemBuilder.GetSystem();

            //Step:4 Get Final Product info.
            string SystemConfigDetails = product.GetFinalProduct(product);

            return(SystemConfigDetails);
        }
        private static void Builder()
        {
            ComputerShop    computerShop = new ComputerShop();
            ComputerBuilder computerBuilder;

            computerBuilder = new LaptopBuilder();
            computerShop.ConstructComputer(computerBuilder);
            computerBuilder.Computer.DisplayConfiguration();

            computerBuilder = new DesktopBuilder();
            computerShop.ConstructComputer(computerBuilder);
            computerBuilder.Computer.DisplayConfiguration();

            computerBuilder = new AppleBuilder();
            computerShop.ConstructComputer(computerBuilder);
            computerBuilder.Computer.DisplayConfiguration();
            Console.ReadKey();
        }
Beispiel #4
0
        private static void Builder()
        {
            ComputerShop computerShop = new ComputerShop();
            ComputerBuilder computerBuilder;

            computerBuilder = new LaptopBuilder();
            computerShop.ConstructComputer(computerBuilder);
            computerBuilder.Computer.DisplayConfiguration();

            computerBuilder = new DesktopBuilder();
            computerShop.ConstructComputer(computerBuilder);
            computerBuilder.Computer.DisplayConfiguration();

            computerBuilder = new AppleBuilder();
            computerShop.ConstructComputer(computerBuilder);
            computerBuilder.Computer.DisplayConfiguration();
            Console.ReadKey();
        }