/// <summary> /// Retourneert nieuwe component /// </summary> /// <param name="device">Het soort component</param> /// <param name="type">Type van component</param> /// <returns></returns> public static IComponent CreateComponent(string device, string type) { IComponent c = null; switch (device) { case "cpu": c = new CPU(type); break; case "gpu": c = new GPU(type); break; case "ssd": c = new SSD(type); break; } return c; }
/// <summary> /// nieuwe order creeëren /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void bt_orderPlaatsen_Click(object sender, EventArgs e) { try { cpu = new CPU(cb_cpu.SelectedItem.ToString()); gpu = new GPU(cb_gpu.SelectedItem.ToString()); ssd = new SSD(cb_ssd.SelectedItem.ToString()); string soort = cb_soort.SelectedItem.ToString(); if (DialogResult.OK == MessageBox.Show("Order wordt geplaatst", "Order plaatsen", MessageBoxButtons.OKCancel)) { AbstractOrder order = orderFac.CreateOrder(soort); order.AddComponent(cpu); order.AddComponent(gpu); order.AddComponent(ssd); filter.Push(order); } } catch (NullReferenceException) { MessageBox.Show("Niet alles ingevoerd", "Error"); } }