Beispiel #1
0
        private void AddAlarm_Click(object sender, EventArgs e)
        {
            FrmAddAlarm tgFrm = new FrmAddAlarm();

            tgFrm.eventAlarmChanged += (Ar, isNew) =>
            {
                objAlarmManager.AddAlarm(Ar);

                string[] row = { Ar.Name, string.Format("{0}", Ar.AlarmText), string.Format("{0}", Ar.AlarmCalss), Ar.Value, Ar.TriggerTeg, Ar.DataBlock, Ar.Device, Ar.Channel };

                DGAlarmAnalog.Rows.Add(row);
                IsDataChanged = true;
            };
            tgFrm.StartPosition = FormStartPosition.CenterScreen;
            tgFrm.ShowDialog();
        }
Beispiel #2
0
        private void EditorAlarm_Click(object sender, EventArgs e)
        {
            if (DGAlarmAnalog.SelectedRows.Count == 1)
            {
                string     tgName    = (string)DGAlarmAnalog.SelectedRows[0].Cells[0].Value;
                ClassAlarm tgCurrent = objAlarmManager.GetByAlarmName(tgName);

                FrmAddAlarm tgFrm = new FrmAddAlarm(tgCurrent);
                tgFrm.eventAlarmChanged += (Ar, isNew) =>
                {
                    objAlarmManager.UpdateAlarm(Ar);
                    DGAlarmAnalog.Rows.Clear();
                    foreach (ClassAlarm tg in objAlarmManager.Alarms)
                    {
                        string[] row = { tg.Name, string.Format("{0}", tg.AlarmText), string.Format("{0}", tg.AlarmCalss), tg.Value, tg.TriggerTeg, tg.DataBlock, tg.Device, tg.Channel };

                        DGAlarmAnalog.Rows.Add(row);
                    }
                    IsDataChanged = true;
                };
                tgFrm.StartPosition = FormStartPosition.CenterScreen;
                tgFrm.ShowDialog();
            }
        }