private void StartReceiveAlarm() { RealAlarm ra = new RealAlarm(); ra.MessageHandler.DevAlarmReceived += Mh_DevAlarmReceived; if (alarmReceiveThread == null) { alarmReceiveThread = new Thread(ra.ReceiveRealAlarmInfo); alarmReceiveThread.Start(); } }
private void BtnStartReceive_Click(object sender, RoutedEventArgs e) { RealAlarm ra = new RealAlarm(Mh_DevAlarmReceived); if (alarmReceiveThread == null) { alarmReceiveThread = new Thread(ra.ReceiveRealAlarmInfo); alarmReceiveThread.IsBackground = true; alarmReceiveThread.Start(); } }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); Bll bll = new Bll(); RealAlarm ra = new RealAlarm(); Thread th = new Thread(ra.ReceiveRealAlarmInfo); th.Start(); }
/// <summary> /// 设备告警对接服务 基于NSQ消息队列获取第三方告警信息 项目:WebNSQLib /// </summary> private void StartReceiveAlarm() { bool enableAlarmRecieve = ConfigurationHelper.GetBoolValue("EnableAlarmRecieve"); if (enableAlarmRecieve) { RealAlarm ra = new RealAlarm(Mh_DevAlarmReceived); if (alarmReceiveThread == null) { alarmReceiveThread = new Thread(ra.ReceiveRealAlarmInfo); alarmReceiveThread.IsBackground = true; alarmReceiveThread.Start(); } } //RecvBaseCommunication Rbc = new RecvBaseCommunication(); //Rbc.RvoPa.DevAlarmReceived += Mh_DevAlarmReceived; //Rbc.Raca.DevAlarmReceived += Mh_DevAlarmReceived; //Rbc.Rfa.DevAlarmReceived += Mh_DevAlarmReceived; //if (alarmReceiveThread == null) //{ // alarmReceiveThread = new Thread(Rbc.StartConnectTopic); // alarmReceiveThread.IsBackground = true; // alarmReceiveThread.Start(); //} DevAlarmKeepDays = ConfigurationHelper.GetIntValue("DevAlarmKeepDays"); if (DevAlarmKeepDays == 0) { //MessageBox.Show("默认不清除!"); Log.Info(LogTags.Server, "不清除历史设备告警"); } else { Log.Info(LogTags.Server, "历史设备告警保留时间:" + DevAlarmKeepDays + "天"); if (alarmRemoveThread == null) { alarmRemoveThread = new AlarmRemoveThread(DevAlarmKeepDays); alarmRemoveThread.Start(); } } }