public ComponentList() { Lamp L = new Lamp(); Lamp L2 = new Lamp(); L2.DeviceName = "Лампа"; Lamp L3 = new Lamp(); L3.DeviceName = "Лампа"; L.DeviceName = "Лампа"; Conditioner C = new Conditioner("Кондиционер", false, 40, 0, 0, EnumSeasons.summer); C.DeviceName = "Кондиционер"; HeatingBoiler H = new HeatingBoiler("Котел",false,100,0,0,EnumSeasons.summer); H.DeviceName = "Котел"; KitchenVentilation K = new KitchenVentilation(); K.DeviceName = "Кухонная вытяжка"; CookingSurfase CS = new CookingSurfase("Варочная поверхность", false,new Burner(), new Burner(), new Burner(), new Burner()); Oven O = new Oven(); O.DeviceName = "Духовка"; AllComponents = new Dictionary<int, Device>(); AllComponents.Add(1, L); AllComponents.Add(2, C); AllComponents.Add(3, H); AllComponents.Add(4, K); AllComponents.Add(5, CS); AllComponents.Add(6, O); AllComponents.Add(7, L2); AllComponents.Add(8, L3); }
public Device AddComponent(string typeDevice) { int temp = AllComponents.Keys.Max(); int key=++temp; Device d = null; switch(typeDevice) { case"Lamp": Lamp l = new Lamp(); l.DeviceName = "Лампа"; AllComponents.Add(key, l); d = l; break; case "Conditioner": Conditioner c = new Conditioner(); c.DeviceName = "Кондиционер"; AllComponents.Add(key,c); d = c; break; case"KitchenVentilation": KitchenVentilation k = new KitchenVentilation(); k.DeviceName = "Кухонная вытяжка"; AllComponents.Add(key, k); d= k; break; case "Oven": Oven o = new Oven(); o.DeviceName = "Духовка"; AllComponents.Add(key, o); d= o; break; case "CookingSurface": CookingSurfase cs = new CookingSurfase("Варочная поверхность", false, new Burner(), new Burner(), new Burner(), new Burner()); AllComponents.Add(key,cs ); d= cs; break; case "HeatingBoiler": HeatingBoiler h = new HeatingBoiler(); h.DeviceName = "Котел"; AllComponents.Add(key,h ); d= h; break; } return d; }