public void GetDownloadInfoCommandProcess() { try { uint downLoadHandle = Convert.ToUInt32(downloadAndCaptureUserControls.DownLoadHandle.Text.ToString()); downloadAndCaptureUserControls.eSDKCodeTextBlock.Text = @"int resultCode = OcxHelper.OCX.IVS_OCX_GetDownloadInfo(downLoadHandle);"; bool fristExe = true; DispatcherTimer timer = new DispatcherTimer(); //初始化定时器 timer.Interval = TimeSpan.FromSeconds(1); timer.IsEnabled = true; timer.Tick += new EventHandler((sender, args) => { string responseMsg = OcxHelper.OCX.IVS_OCX_GetDownloadInfo(downLoadHandle); var ocxResult = XmlHelper.ProcessOcxResponseMsg(responseMsg); if (ocxResult.ResultCode != "0") { timer.IsEnabled = false; timer.Stop(); } else if (fristExe == true) { OcxHelper.MainWin.OperationInfo.Content = StringHelper.FindLanguageResource("GetDownloadInfo") + StringHelper.FindLanguageResource("Success"); } if (ocxResult.ResultCode == "0") { var tempNode = XmlHelper.DeserializeToList <RecordDownloadInfoEntity>(ocxResult.BodyXmlNode); downloadAndCaptureUserControls.RecordList.ItemsSource = tempNode; if (tempNode[0].Progress == 100) { timer.IsEnabled = false; timer.Stop(); } fristExe = false; } }); downloadAndCaptureUserControls.eSDKCodeTextBlock.Text = @"OcxHelper.OCX.IVS_OCX_GetDownloadInfo(downLoadHandle);"; } catch (Exception ex) { LogService.Error(ex.ToString()); OcxHelper.MainWin.OperationInfo.Content = ex.ToString(); return; } }
private void QueryPresetProcess() { try { VideoEntity camera = liveVideoPtzUserControls.CameraList.SelectedItem as VideoEntity; var resultValue = OcxHelper.OCX.IVS_OCX_GetPTZPresetList(camera.CameraCode); liveVideoPtzUserControls.eSDKCodeTextBlock.Text = @"int resultCode = OcxHelper.IVS_OCX_GetPTZPresetList(CameraCode);"; OcxResult result = XmlHelper.ProcessOcxResponseMsg(resultValue); if (result.ResultCode != "0") { throw new Exception(result.ResultCode); } var returnCameraCode = result.BodyXmlNode.SelectSingleNode("CameraCode").InnerText; List <PTZPresetEntity> preSetLocationEntityList = XmlHelper.DeserializeToList <PTZPresetEntity>(result.BodyXmlNode.SelectSingleNode("PresetPTZList")); foreach (PTZPresetEntity Preset in preSetLocationEntityList) { Preset.CameraCode = camera.CameraCode; } liveVideoPtzUserControls.PresetList.ItemsSource = preSetLocationEntityList; if (result.ResultCode != "0") { OcxHelper.MainWin.OperationInfo.Content = StringHelper.FindLanguageResource(result.ResultCode); } else { OcxHelper.MainWin.OperationInfo.Content = StringHelper.FindLanguageResource("QueryPreset") + StringHelper.FindLanguageResource("Success"); } } catch (Exception ex) { LogService.Error(ex.ToString()); OcxHelper.MainWin.OperationInfo.Content = ex.ToString(); return; } }
private void QueryProcess() { try { var result = new RecordQueryResultEntity(); PageInfo pageInfo = new PageInfo(); pageInfo.FromIndex = 1; pageInfo.PageSize = 200; pageInfo.ToIndex = 200; pageInfo.QueryCondition = new QueryCondition(); QueryField startTime = new QueryField();//开始时间 startTime.Field = "FromTime"; startTime.QueryType = QueryType.Exact; DateTime realFromTime = DateTime.ParseExact(replayUserControls.StartTime.Text.ToString(), "yyyyMMddHHmmss", Thread.CurrentThread.CurrentCulture); startTime.Value = DateTimeExtensions.ToDstUtcTime(realFromTime, true).ToString("yyyyMMddHHmmss"); pageInfo.QueryCondition.QueryFieldList.Add(startTime); QueryField endTime = new QueryField();//结束时间 endTime.Field = "ToTime"; endTime.QueryType = QueryType.Exact; DateTime realEndTime = DateTime.ParseExact(replayUserControls.EndTime.Text.ToString(), "yyyyMMddHHmmss", Thread.CurrentThread.CurrentCulture); endTime.Value = DateTimeExtensions.ToDstUtcTime(realEndTime, false).ToString("yyyyMMddHHmmss"); pageInfo.QueryCondition.QueryFieldList.Add(endTime); QueryField cameraCode = new QueryField();//摄像机编号 cameraCode.Field = "CameraCode"; cameraCode.QueryType = QueryType.Exact; cameraCode.Value = replayUserControls.CameraCode.Text.ToString(); pageInfo.QueryCondition.QueryFieldList.Add(cameraCode); QueryField recordMethod = new QueryField();//录像方式 recordMethod.Field = "RecordMethod"; recordMethod.QueryType = QueryType.Exact; recordMethod.Value = replayUserControls.RecordType.SelectedIndex.ToString(); pageInfo.QueryCondition.QueryFieldList.Add(recordMethod); QueryField recordType = new QueryField();//录像类型 recordType.Field = "RecordType"; recordType.QueryType = QueryType.Exact; recordType.Value = "111"; pageInfo.QueryCondition.QueryFieldList.Add(recordType); QueryField queryType = new QueryField();//查询方式 queryType.Field = "QueryType"; queryType.QueryType = QueryType.Exact; queryType.Value = "0"; pageInfo.QueryCondition.QueryFieldList.Add(queryType); QueryField alarmTypeList = new QueryField();//告警类型列表 alarmTypeList.Field = "AlarmTypeList"; alarmTypeList.QueryType = QueryType.Exact; alarmTypeList.Value = "ALARM_TYPE_DI,ALARM_NO_SIGNAL,ALARM_SHIELD,ALARM_TYPE_MOVE_DECTION,ALARM_VIDEO_G,ALARM_REVERSE_DETECTION,ALARM_INTRUSION,ALARM_TRIP_LINE,ALARM_OBJECT_ABANDONED,ALARM_OBJECT_REMOVAL,ALARM_PRESENCE,ALARM_PATH,ALARM_DIRECTION_MOVE,ALARM_SPEED,ALARM_SPEED_MONITOR,ALARM_OBJECT_WANDER,ALARM_DENSITY_MONITOR,ALARM_FACE_RECOGNITION_WARNING,ALARM_FACE_RECOGNITION,ALARM_FACE_CAPTURE,ALARM_MAU_VQD_BRIGHTNESS,ALARM_MAU_VQD_DARKNESS,ALARM_MAU_VQD_BLUR,ALARM_MAU_VQD_SNOWNOISE,ALARM_MAU_VQD_COLORCAST,ALARM_MAU_VQD_STRIPENOISE,ALARM_MAU_VQD_FRAMEFROZEN,ALARM_MAU_VQD_SHAKE,ALARM_MAU_VQD_CAMERACOVERD,ALARM_MAU_VIDEO_LOST,EXSYS_ALARM_EMERGENCY_ON,EXSYS_ALARM_FIRE_ALERT_ON,EXSYS_ALARM_ROBBERY_ON,EXSYS_ALARM_STEAL_ON,EXSYS_ALARM_ALERT_ON,EXSYS_ALARM_MONITOR_ON,EXSYS_ALARM_FAILURE_ON,EXSYS_ALARM_DEFENCE_ON,EXSYS_ALARM_REMOTE_CONTROL_ON,EXSYS_ALARM_ENTER_EXIT_ON,EXSYS_ALARM_STATUS_ON,EXSYS_ALARM_SHUTDOWN_ON,EXSYS_ALARM_BYPASS_ON,EXSYS_ALARM_TEST_ON,EXSYS_ALARM_USER_OPERATION_ON,EXSYS_ALARM_ERROR_ON,SCADA_ALARM"; pageInfo.QueryCondition.QueryFieldList.Add(alarmTypeList); QueryField operatorID = new QueryField();//执行查询操作的用户ID operatorID.Field = "OperatorID"; operatorID.QueryType = QueryType.Exact; operatorID.Value = LoginInfo.CurrentLoginInfo.UserId; pageInfo.QueryCondition.QueryFieldList.Add(operatorID); QueryField operatorDomain = new QueryField();// operatorDomain.Field = "OperatorDomain"; operatorDomain.QueryType = QueryType.Exact; operatorDomain.Value = LoginInfo.CurrentLoginInfo.OperatorDomain; pageInfo.QueryCondition.QueryFieldList.Add(operatorDomain); var requestXml = XmlHelper.SerializeToXml(pageInfo); requestXml = XmlHelper.GetContentXml(requestXml); var responseMsg = OcxHelper.OCX.IVS_OCX_QueryRecordList(requestXml); var ocxResult = XmlHelper.ProcessOcxResponseMsg(responseMsg); if (ocxResult.ResultCode != "0") { OcxHelper.MainWin.OperationInfo.Content = StringHelper.FindLanguageResource(ocxResult.ResultCode.ToString()); } else { OcxHelper.MainWin.OperationInfo.Content = StringHelper.FindLanguageResource("Query") + StringHelper.FindLanguageResource("Success"); } var node = ocxResult.BodyXmlNode.SelectSingleNode("PageInfo"); if (node != null) { var tempNode = XmlHelper.DeserializeToEntity <PageInfo>(node); result.PageInfo = tempNode; } node = ocxResult.BodyXmlNode.SelectSingleNode("RecordDataList"); if (node != null) { var tempNode = XmlHelper.DeserializeToList <RecordDataInfoEntity>(node); foreach (RecordDataInfoEntity info in tempNode) { info.CameraCode = replayUserControls.CameraCode.Text.ToString(); info.LocalStartTime = DateTime.ParseExact(info.StartTime, "yyyyMMddHHmmss", Thread.CurrentThread.CurrentCulture).ToLocalTime().ToString(); info.LocalEndTime = DateTime.ParseExact(info.EndTime, "yyyyMMddHHmmss", Thread.CurrentThread.CurrentCulture).ToLocalTime().ToString(); } replayUserControls.RecordList.ItemsSource = tempNode; } else { replayUserControls.RecordList.ItemsSource = null; } replayUserControls.eSDKCodeTextBlock.Text = @"var responseMsg = OcxHelper.OCX.IVS_OCX_QueryRecordList(requestXml);"; } catch (Exception ex) { LogService.Error("Server Record Search Error Code:" + ex.ToString()); } }