Example #1
0
        private void FrmMain_Load(object sender, EventArgs e)
        {
            LoadXmlFile(ConfigPath);
            lblVersion.Text = "当前版本:V" + ConfigurationManager.AppSettings["Version"].ToString();
            IsRun           = true;

            System.Windows.Forms.Timer timer1 = new System.Windows.Forms.Timer();
            timer1.Interval         = 500;
            timer1.Tick            += Timer1_Tick;
            timer1.Enabled          = true;
            HeartBeattimer.Interval = 5000;
            HeartBeattimer.Tick    += HeartBeattimer_Tick;
            HeartBeattimer.Enabled  = true;



            if (!CommonMethods.IsServer)
            {
                btnMeasureShow.Enabled = false;
                btnMeasureShow.Visible = false;
                lblCommstate.Visible   = false;
            }
            else
            {
                InitialAndConnect();
                btnDgvShow_Click(null, null);
            }

            InsertDataTimeSet(Convert.ToInt32(new IniConfigHelper().ReadIniData("参数", "Interval", "", CommonMethods.FilePath)));
            InsertDataTime.Tick   += Mytime_Tick;
            plcConData.IsConncet   = false;
            InsertDataTime.Enabled = true;

            //提示是否连接数据库状态
            LabConnect.Visible = false;
            //初始化报警变量集合
            InitialAlarmVar();


            if (objFrmAlarm == null)
            {
                objFrmAlarm = new FrmAlarm();

                //第四步:绑定委托
                myAddLog = objFrmAlarm.AddLog;

                objFrmAlarm.Show();
                objFrmAlarm.Visible = false;
            }


            //开启线程,进行报警的检测
            Task AlarmCheck = Task.Run(() =>
            {
                UpdateAlarmStatus();
            });
        }
Example #2
0
        private void BtnAlarm_Click(object sender, EventArgs e)
        {
            if (objFrmAlarm == null)
            {
                objFrmAlarm = new FrmAlarm();

                //第四步:绑定委托
                myAddLog = objFrmAlarm.AddLog;
            }
            else
            {
                objFrmAlarm.InitialDGV(Convert.ToInt32(new IniConfigHelper().ReadIniData("历史报警显示条数", "Count", "", CommonMethods.FilePath)));
                objFrmAlarm.BringToFront();
            }
            objFrmAlarm.Show();
        }