protected void ClockEvent(Object source, ElapsedEventArgs e) { //Finished cycle if (secondsPassed >= (sl.redLightDuration + sl.yellowLightDuration + sl.greenLightDuration)) { secondsPassed = 0; } //Begin cycle if (secondsPassed == 0) { sl.turnOn("red"); } if (secondsPassed == sl.redLightDuration) { sl.turnOn("yellow"); } if (secondsPassed == (sl.redLightDuration + sl.yellowLightDuration)) { sl.turnOn("green"); } secondsPassed++; Refresh(); }