public TimerComponent(IntervalRelayItem intervalRelayItem) { trPanel = new TimerRelayTile(intervalRelayItem.name); relayPort = intervalRelayItem.relayPin; this.triggerDelaySec = intervalRelayItem.timeOffSec; this.triggerOnTimeSec = intervalRelayItem.timeOnSec; this.triggerDelaySecSpan = new TimeSpan(0, 0, triggerDelaySec); this.triggerOnTimeSecSpan = new TimeSpan(0, 0, triggerOnTimeSec); //update the clock readout one a sec updateTimer = new Timer(); updateTimer.Interval = 1000; updateTimer.Tick += UpdateTimer_Tick; SetTime(); updateTimer.Start(); }
private void button8_Click(object sender, EventArgs e) { string name = textBox9.Text; string relayPinStr = textBox7.Text; Guid id = Guid.NewGuid(); string timeOffSecStr = textBox16.Text; string timeOnSecStr = textBox17.Text; int relayPin = 0; int timeOffSec = 0; int timeOnSec = 0; int.TryParse(relayPinStr, out relayPin); int.TryParse(timeOnSecStr, out timeOnSec); int.TryParse(timeOffSecStr, out timeOffSec); IntervalRelayItem item = new IntervalRelayItem(relayPin, name, timeOnSec, timeOffSec, id); settings.SaveComponent(item); LoadSettings(); }