int AlarmShowTimes = 0;//预警信息显示次数 /// <summary> /// 获取自动弹出窗体 /// </summary> public override void GetMessageTable() { if (MessageTable == null) { MessageTable = new DataTable(); } SysAlarmCommon.GetMessageTable(MessageTable, AlarmShowTimes); }
/// <summary> /// 预警信息初始化 /// </summary> void AlarmMsgIni() { SysAlarmCommon.AlarmMsgIni(timer1); if (timer1.Enabled) { timer1_Tick(null, null);//如果可用,立即执行一下,这样参数设置检验可以时间长点,避免频繁检索数据库带来效率的底下 } }
private void timer1_Tick(object sender, EventArgs e) { try { GetMessageTable(); bool showFlag = SysAlarmCommon.AlarmWinAct(MessageTable, AlarmShowMessageForm, this);//执行预警显示 if (showFlag) { AlarmShowTimes++;//预警显示次数累加 } } catch (Exception E) { timer1.Enabled = false; this.ShowMessage(E.Message); } }