/// <summary> /// 报警器结束 /// </summary> /// <param name="info"></param> private static void AlarmEnd(AlarmMessageToClient info, int BoxTab) { //关闭报警录像,存储报警录像信息 AlarmRec.StopRec(info.alarmmessage.DeviceID); //清理记录的报警器ID Form1.ClearAlarmInfo(BoxTab); }
//存储接收到的所有报警器信息 //public static List<PresetDataManage> AletorInfo=new List<PresetDataManage>(); public static void Alarm(object obj) { //接收从服务器业务协同端口发送过来的报警信息 //1、判断报警类型 AlarmMessageToClient info = (AlarmMessageToClient)obj; //1.1写报警日志,显示报警信息 try { WriteTxt(info.alarmmessage); } catch { Console.WriteLine("报警日志写入失败!"); } //1.3显示报警视频 int BoxTab = -1; for (int i = 0; i < Form1.BoxCount; i++) { if (Form1.AlarmDeviceID[i] == info.alarmmessage.AlarmDeviceID) { BoxTab = i; break; } } //1.3.1临时报警 if (info.alarmmessage.AlarmType == 0) { switch (info.alarmmessage.AlarmStage) { //报警触发 case 1: RealPlay.RealPlayVideo.OpenAlarm(info.alarmmessage.DeviceID, info.alarmmessage.AlarmDeviceID); break; //报警结束 case 4: //取消声光报警 Form1.videoboxs[BoxTab].player.Stop(); Form1.videoboxs[BoxTab].EndAlarm(); Form1.flash_tag.Remove(BoxTab); Form1.panels[BoxTab].BackColor = System.Drawing.Color.Transparent; AlarmRec.StopRec(info.alarmmessage.DeviceID); //关闭报警录像,存储报警录像信息 break; } } else if (info.alarmmessage.AlarmType == 1)//1.3.2报警器报警 { switch (info.alarmmessage.AlarmStage) { case 1: AlarmTrigger(info); break; case 2: AlarmDispose(info, BoxTab); break; case 3: AlarmUnDispose(info, BoxTab); break; case 4: AlarmEnd(info, BoxTab); break; } } }