public void Build(IComputerBuilder builder) { builder.SetupProcessor(); builder.SetupMemory(); builder.SetupStorage(); builder.SetupStorage(); }
static void Main(string[] args) { Console.Title = "Builder Pattern: Computers"; Console.WindowHeight = (int)(Console.LargestWindowHeight * 0.75); Console.BufferHeight = 5000; // Create a Falcon Northwest Mach 5 Computer Console.WriteLine( "\n Create a Falcon Northwest Mach 5 Computer.\n"); ComputerManufacturer manufacturer = new ComputerManufacturer(); IComputerBuilder falconBuilder = null; falconBuilder = new FalconNorthwest_Mach5(); manufacturer.Construct(falconBuilder); Console.WriteLine("{0}", falconBuilder.Computer.ToString()); // *** Build your own custom-built computer. *** Console.WriteLine( "\n Create your own custom-built computer.\n"); // *** Add code here *** IComputerBuilder phoenixBuilder = new PhoenixDown_v3(); manufacturer.Construct(phoenixBuilder); Console.WriteLine("{0}", phoenixBuilder.Computer.ToString()); Console.ReadKey(); }
public void Construct(IComputerBuilder computerBuilder) { computerBuilder.BuildScreenSize(); computerBuilder.BuildScreenTouch(); computerBuilder.BuildOperatingSystem(); computerBuilder.BuildMemory(); }
static void BuildConsoleWriteLines(string computerType, IComputerBuilder builder) { ComputerDirector director = new ComputerDirector(builder); Computer computer = director.construct(); Console.WriteLine($"{computerType}: Os={builder.Os} Graphics Card={builder.GraphicsCard} Cpu={builder.Cpu} Ram={builder.Ram} Storage={builder.Storage}"); }
/// <summary> /// 指南(一定要按顺序组) /// </summary> /// <param name="computerBuilder"></param> public Computer Guide(IComputerBuilder computerBuilder) { ///这里指导 必须按这个顺序组装,且只能每个方法调用一次,防止外部随意调用 ///当然后来发展的建造者模式就没有这一步了 return(computerBuilder.UseCpu() .UseMemory() .UseGraphics().Build()); }
public void Construct(IComputerBuilder computerBuilder) { computerBuilder.BuildCase(); computerBuilder.BuildMotherboard(); computerBuilder.BuildVideoCard(); computerBuilder.BuildSoundCard(); computerBuilder.BuildPowerSupply(); computerBuilder.BuildCPU(); computerBuilder.BuildRAM(); computerBuilder.BuildHardDrive(); computerBuilder.BuildOpticalDrive(); computerBuilder.BuildCoolingDevice(); computerBuilder.BuildCables(); computerBuilder.BuildMonitor(); computerBuilder.BuildKeyboard(); computerBuilder.BuildMouse(); computerBuilder.BuildOS(); computerBuilder.BuildOffice(); }
public ActionResult Builder(string userType) { IComputerBuilder computerBuilder = null; switch (userType) { case "Home": computerBuilder = new HomeComputerBuilder(); break; case "Office": computerBuilder = new OfficeComputerBuilder(); break; } ComputerAssembler a = new ComputerAssembler(computerBuilder); Computer c = a.AssembleComputer(); return(View()); }
public IActionResult Build(string usagetype) { IComputerBuilder builder = null; switch (usagetype) { case "home": builder = new HomeComputerBuilder(); break; case "office": builder = new OfficeComputerBuilder(); break; case "development": builder = new DevelopmentComputerBuilder(); break; } ComputerAssembler assembler = new ComputerAssembler(builder); Computer computer = assembler.AssembleComputer(); return(View("Success", computer)); }
public Director(IComputerBuilder builder) { _builder = builder; }
public SuperComputerBuildDirector(IComputerBuilder builder) { _builder = builder; }
public ComputerAssembler(IComputerBuilder pComputerBuilder) { this.computerBuilder = pComputerBuilder; }
public Computer BuildComputer(IComputerBuilder b) { b.BuildComputer(); b.BuildOS(); return(b.GetProduct()); }
public LaptopBuildDirector(IComputerBuilder builder) { _builder = builder; }
public ComputerAssembler(IComputerBuilder computerBuilder) { _ComputerBuilder = computerBuilder; }
public ComputerDirector(IComputerBuilder builder) { this._builder = builder; }
/// <summary> /// 构造函数 依赖注入的方式。 /// 选择 特定的 ConcreteBuilder(具体建造者) /// </summary> /// <param name="icb"></param> public ComputerDiector(IComputerBuilder icb) { this.computerBuilder = icb; }
public Director(IComputerBuilder dell) { _dell = dell; }
public ComputerAssembler(IComputerBuilder builder) { this.builder = builder; }
/// <summary> /// Builds a computer based on a ComputerBuilder /// </summary> /// <param name="builder">The type of ComputerBuilder to build this computer off of</param> public static void Construct(IComputerBuilder builder) { builder.BuildMotherboard(); builder.BuildHardDrive(); builder.BuildCase(); }
/// <summary> /// Constructs a computer using a builder /// </summary> /// <param name="builder">The builder</param> /// <returns>The constructed computer</returns> public Computer Construct(IComputerBuilder builder) { return(builder.Build()); }
public ComputerCreator(IComputerBuilder builder) { objBuilder = builder; }
public SystemDirector(IComputerBuilder builder) { Builder = builder; }