public CVisionMonitorAlarm(IVisionMonitor monitor, string data) : base(monitor, data) { mDoRecordStateChanged = DoRecordStateChanged; VisionMonitor.OnRecordProgress += new RECORD_PROGRESS(DoRecordProgress); }
public bool Playback() { if (mBackPlayVS != null && mBackPlayVS.IsOpen) { mBackPlayVS.SystemContext.VideoSourceManager.Close(mBackPlayVS.Name); } else if (mCurIndex >= 0 && mCurIndex < Count) { IVisionMonitorAlarm visionAlarm = Goto(mCurIndex) as IVisionMonitorAlarm; if (visionAlarm != null) { IVisionMonitor monitor = visionAlarm.Monitor as IVisionMonitor; if (monitor != null) { IVisionMonitorConfig config = monitor.Config as IVisionMonitorConfig; if (config != null) { IVideoSourceConfig vsConfig = monitor.SystemContext.VideoSourceConfigManager.GetConfig(config.VisionParamConfig.VSName); if (vsConfig != null) { if (!vsConfig.IsRecord) { IVideoSourceType vsType = vsConfig.SystemContext.VideoSourceTypeManager.GetConfig(vsConfig.Type); if (vsType != null) { string backPlayType = vsType.BackPlayType; if (backPlayType.Equals("")) { backPlayType = vsConfig.Type; } if (!backPlayType.Equals("")) { CVideoSourceConfig newVSConfig = vsConfig.Clone() as CVideoSourceConfig; if (newVSConfig != null) { newVSConfig.Name = vsConfig.Name + "_BackPlay_" + newVSConfig.Handle; newVSConfig.Type = backPlayType; newVSConfig.StartTime = visionAlarm.AlarmTime.AddSeconds(-10); newVSConfig.StopTime = visionAlarm.AlarmTime; if (!backPlayType.Equals("FileVideoSource")) { newVSConfig.FileName = ""; } newVSConfig.IsRecord = false; newVSConfig.IsCycle = false; newVSConfig.Enabled = true; if (mBackPlayVS != null) { mBackPlayVS.SystemContext.VideoSourceManager.Close(mBackPlayVS.Name); mBackPlayVS = null; } mBackPlayVS = vsType.SystemContext.VideoSourceManager.Open(newVSConfig, HWnd); if (mBackPlayVS != null) { mBackPlayVS.OnPlayStatusChanged += new PLAYSTATUS_CHANGED(DoPlayStausChanged); if (!mBackPlayVS.Play()) { MessageBox.Show("回放失败,可能是回放录像还未生成,请稍后再试!", "回放错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } else { MessageBox.Show("打开录像失败,可能是回放录像还未生成,请稍后再试!", "回放错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } } return(true); } } } } if (!visionAlarm.IsRecord && !visionAlarm.IsPlay) { return(visionAlarm.PlayAlarmRecord(HWnd)); } } } return(false); }