static void Main(string[] args) { Console.WriteLine("------------"); AppleBuilder computerBuilder = new AppleBuilder(); ComputerShop computerShop = new ComputerShop(); computerShop.ConstructComputer(computerBuilder); computerBuilder.Computer.DisplayConfiguration(); Console.WriteLine("------------"); LaptopBuilder laptopBuilder = new LaptopBuilder(); ComputerShop laptopShop = new ComputerShop(); laptopShop.ConstructComputer(laptopBuilder); laptopBuilder.Computer.DisplayConfiguration(); Console.WriteLine("------------"); DesktopBuilder desktopBuilder = new DesktopBuilder(); ComputerShop desktopShop = new ComputerShop(); desktopShop.ConstructComputer(desktopBuilder); desktopBuilder.Computer.DisplayConfiguration(); Console.ReadLine(); LaptopBuilder laptopBuilder = new LaptopBuilder(); ComputerShop laptopShop = new ComputerShop(); laptopShop.ConstructComputer(laptopBuilder); laptopBuilder.Computer.DisplayConfiguration(); }
public static IHostBuilder ConfigureDesktopDefaults(this IHostBuilder builder, Action <IDesktopBuilder>?configure = null, bool enableNaviagtion = true) { var wpfbuilder = new DesktopBuilder(builder); configure?.Invoke(wpfbuilder); wpfbuilder.Build(enableNaviagtion); return(builder); }
public static IHostBuilder ConfigureDesktopDefaults <TShellWindow>(this IHostBuilder builder, Action <IDesktopBuilder>?configure = null, bool enableNavigation = true) where TShellWindow : Window, IDesktopShell { var wpfbuilder = new DesktopBuilder <TShellWindow>(builder); configure?.Invoke(wpfbuilder); wpfbuilder.Build(enableNavigation); return(builder); }
public void BuildDesktop() { DesktopBuilder builder = new DesktopBuilder(); HardwareDirector director = new HardwareDirector(builder); director.Assemble(); Machine desk = builder.Build(); Assert.Equal(300, desk.Components.HD); Assert.Equal(16, desk.Components.RAM); }
public void WhenBuildingADesktop_AndRngChoosesTheCorrectBoard_AllPartsAreAssembledProperly() { ComputerBuilder technician = new DesktopBuilder(); _workshop.Assemble(technician); var contents = technician.Computer.LookInside(); Assert.True(contents["processor"] == "Pentium Uno"); Assert.True(contents["storage"] == "Samsung 2TB NVMe M.2 SSD"); Assert.True(contents["memory"] == "Corsair 4x8GB 3200MHz"); Assert.True(contents["cooling"] == "360mm Radiator"); }
public ActionResult BuildDesktop(FormCollection collection) { Employee employee = db.Employees.Find(Convert.ToInt32(collection["Id"])); ISystemBuilder systemBuilder = new DesktopBuilder(); Director.ConfigurationBuilder configurationBuilder = new Director.ConfigurationBuilder(); configurationBuilder.BuildSystem(systemBuilder, collection); ComputerSystem computerSystem = systemBuilder.GetSystem(); employee.SystemConfigurationDetails = string.Format("RAM: {0},HDDSize: {1},Keyboard: {2},Mouse: {3}", computerSystem.RAM, computerSystem.HDDSize, computerSystem.Keyboard, computerSystem.Mouse); db.Entry(employee).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult BuildDesktop(FormCollection formcollection) { //Step 1 Employee employee = db.Employees.Find(Convert.ToInt32(formcollection["employeeID"])); //Step 2 Concrete Build ISystemBuilder systemBuilder = new DesktopBuilder(); //Step 3: Director ConfigurationBuilder builder = new ConfigurationBuilder(); builder.BuildSystem(systemBuilder, formcollection); //Step 4: Reuturn System Built ComputerSystem system = systemBuilder.GetSystem(); employee.SystemConfiguration = string.Format("RAM : {0}, Keyboard: {1}, Mouse: {2}, Touchscreen: {3}, HDDDrive: {4}", system.RAM, system.KeyBoard, system.Mouse, system.TouchScreen, system.HDDSize); db.Entry(employee).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult BuildDesktop(FormCollection formCollection) { //step 1 Employee employee = db.Employees.Find(Convert.ToInt32(formCollection["employeeID"])); //step 2 concrete builder ISystemBuilder systemBuilder = new DesktopBuilder(); //step 3 Director ConfigurationBuilder builder = new ConfigurationBuilder(); builder.BuildSystem(systemBuilder, formCollection); //step 4 return the system ComputerSystem system = systemBuilder.GetSystem(); employee.SystemConfigurationDetails = string.Format("RAM:{0},HDDSize:{1},KeyBoard:{2},Mouse:{3}" , system.RAM, system.HDDSize, system.KeyBoard, system.Mouse); db.Entry(employee).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); }
public IActionResult BuildDesktop(IFormCollection collection) { if (collection["employeeId"].ToString() == "") { return(NotFound()); } if (ModelState.IsValid) { try { //Step 1 Employee employee = _context.Employee.Find(Convert.ToInt32(collection["employeeId"])); //step 2 concreate Builder IComputerSystemBuilder computerSystem = new DesktopBuilder(); //step 3 Director ComputerConfigarationBuilder builder = new ComputerConfigarationBuilder(); builder.BuildSystem(computerSystem, collection); ComputerSystem computer = computerSystem.GetSystem(); employee.ComputerSystemConfiguration = string.Format("RAM : {0},HardDrive : {1},GraphicsCard : {2},Mouse : {3},Keyborad : {4},Monitor : {5}", computer.RAM, computer.HardDrive, computer.GraphicsCard, computer.Mouse, computer.Keyborad, computer.Monitor); _context.Employee.Update(employee); _context.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!EmployeeExists(Convert.ToInt32(collection["employeeId"]))) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View()); }