private AlarmControl AddAlarm(int slave, byte alertCode) { AlarmControl alarm = new AlarmControl(slave, alertCode); alarms.Add(alarm); this.Controls.Add(alarm); return alarm; }
private void RemoveAlarm() { AlarmControl alarm = alarms[alarms.Count - 1]; this.Controls.Remove(alarm); alarms.RemoveAt(alarms.Count - 1); alarm.Dispose(); }
private AlarmControl AddAlarm(int slave, byte alertCode) { AlarmControl alarm = new AlarmControl(slave, alertCode); alarms.Add(alarm); this.Controls.Add(alarm); return(alarm); }
private void tmrRemoteCtrl_Tick(object sender, EventArgs e) { if (this.alarms.Count > 0) { AlarmControl alarm = this.alarms[ctrlIndex % this.alarms.Count]; ctrlIndex++; foreach (var mt in Program.MeterManager.CTMeters.Values) { runningNum = ++runningNum % ushort.MaxValue; mt.SetCommand(runningNum, alarm.Slave, 1, (int)alarm.AlertCode); } } }
private void btnAdd_Click(object sender, EventArgs e) { AlarmControl alarm = AddAlarm(alarmIndex++ + initSlave, 0); alarm.Location = new Point(30, 40 + 29 * alarmIndex); }