55 lines
1.1 KiB
C#
55 lines
1.1 KiB
C#
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<Light> lights;
|
|
|
|
public LightHandler()
|
|
{
|
|
lights = new List<Light>();
|
|
|
|
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() );
|
|
}
|
|
}
|
|
}
|