using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace HueLights { class LightHandler { static void Main(string[] args) { new LightHandler(); } private List lights; public LightHandler() { lights = new List(); Populate(); RunTest(); } private void RunTest() { Random r = new Random(); TurnOn(lights[r.Next(0, lights.Count)].getID()); Update(); Console.ReadLine(); } private void Populate() { lights.Add(new LightHue(1, 100)); lights.Add(new LightHue(2, 200)); lights.Add(new LigthLux(3, 300)); } public void TurnOn(int id) { lights.ForEach(a => { if (a.getID() == id) { a.setState(true); } }); } public void Update() { lights.ForEach(a => a.Update() ); } } }