/// <summary> /// 解析采集端口信息 /// </summary> /// <param name="value"></param> public void AnalyzePortInfo(string value) { App.Current.Dispatcher.Invoke(new Action(() => { PortInfos portInfos = XmlUnityConvert.XmlDeserialize <PortInfos>(value); AppConfigInfos.PortDeviceList.PortevList.Clear(); AppConfigInfos.PortDeviceList.PortevList.Add(new PortIsDevice() { PortName = "-----", IsDeviceInfo = false }); // 添加一个空白 if (portInfos != null && portInfos.PortList != null) { foreach (var item in portInfos.PortList) { AppConfigInfos.PortDeviceList.PortevList.Add(new PortIsDevice() { PortName = item, IsDeviceInfo = false }); } AppConfigInfos.PortDeviceList.IsChanged = !AppConfigInfos.PortDeviceList.IsChanged; } })); }
/// <summary> /// 警员信息内容解析 /// </summary> /// <param name="value"></param> private void AnalyzePoliceInfos(string value, MsgType msgType) { App.Current.Dispatcher.Invoke(new Action(() => { FingerInfos policeInfos = XmlUnityConvert.XmlDeserialize <FingerInfos>(value); policeInfos = FilterFingerInfoByUserType(policeInfos); ResultWindow resultWindow = CheckResultMsg(msgType); if (resultWindow == null) { return; } if (policeInfos.ResultCode == 0) { resultWindow.SuccessCloseWindow(); FingerViewModel.PageIndex = policeInfos.PageIndex; FingerViewModel.IsMoreData = policeInfos.UserInfoList.Count == AppConfigInfos.AppStateInfos.SearchPageCount; if (policeInfos.PageIndex == 1) { FingerViewModel.SearchPoliceInfos(policeInfos.UserInfoList); } else { FingerViewModel.AddPoliceInfos(policeInfos.UserInfoList); } } else { resultWindow.FailedCloseWindow(policeInfos); } })); }
/// <summary> /// 配对信息返回结果 /// </summary> /// <param name="msgType"></param> /// <param name="value"></param> private void AnalyzeDevicePairResult(MsgType msgType, string value) { App.Current.Dispatcher.Invoke(new Action(() => { DevicePairInfo devicePairInfo = XmlUnityConvert.XmlDeserialize <DevicePairInfo>(value); ResultWindow resultWindow = CheckResultMsg(msgType); if (resultWindow == null) { return; } if (devicePairInfo.ResultCode == 0) { resultWindow.SuccessCloseWindow(); if (msgType == MsgType.DevicePairResult) { DeviceInfoHelper.DevicePairInfo(devicePairInfo); } else { // 取消配对 DeviceInfoHelper.DeviceCancelPair(devicePairInfo.DeviceCode ?? string.Empty); } } else { resultWindow.FailedCloseWindow(devicePairInfo); } })); }
/// <summary> /// 解析license信息 /// </summary> /// <param name="value"></param> public void AnalyzeLicenseInfo(string value) { App.Current.Dispatcher.Invoke(new Action(() => { LicenseInfo licenseInfo = XmlUnityConvert.XmlDeserialize <LicenseInfo>(value); AppConfigInfos.LicenseInfo = licenseInfo; })); }
/// <summary> /// 解析采集站日志总数 /// </summary> /// <param name="value"></param> private void AnalyzeCollectLogsCount(string value) { CollectLogsCount collectLogsCount = XmlUnityConvert.XmlDeserialize <CollectLogsCount>(value); if (collectLogsCount != null) { UpdateCount(QueryType.CollectOperateLog, FileType.All, collectLogsCount.DataCount); } }
/// <summary> /// 解析告警总数 /// </summary> /// <param name="value"></param> private void AnalyzeAlarmLogsCount(string value) { AlarmLogsCount alarmLogsCount = XmlUnityConvert.XmlDeserialize <AlarmLogsCount>(value); if (alarmLogsCount != null) { UpdateCount(QueryType.HisAlarm, FileType.All, alarmLogsCount.DataCount); } }
/// <summary> /// 执法记录仪设备更新 /// </summary> public void AnalyzeDeviceUpdateState(string value) { App.Current.Dispatcher.Invoke(new Action(() => { UpdateDeviceInfos deviceInfos = XmlUnityConvert.XmlDeserialize <UpdateDeviceInfos>(value); if (deviceInfos != null && deviceInfos.DeviveInfoList != null) { DeviceInfoHelper.DeviceInfoUpdate(deviceInfos); } })); }
/// <summary> /// 解析执法记录仪类型 /// </summary> /// <param name="value"></param> public void AnalyzeDeviceTypes(string value) { App.Current.Dispatcher.Invoke(new Action(() => { DeviceTypes deviceTypes = XmlUnityConvert.XmlDeserialize <DeviceTypes>(value); if (deviceTypes != null && deviceTypes.DeviceTypeList != null) { AppConfigInfos.DeviceTypeList = deviceTypes.DeviceTypeList; } })); }
/// <summary> /// 解析执法记录总数 /// </summary> /// <param name="value"></param> private void AnalyzeAllMediaListCount(string value) { MediaLogsCount mediaLogsCount = XmlUnityConvert.XmlDeserialize <MediaLogsCount>(value); if (mediaLogsCount != null) { UpdateCount(QueryType.MediaLog, FileType.All, mediaLogsCount.AllCount); UpdateCount(QueryType.MediaLog, FileType.Picture, mediaLogsCount.PicCount); UpdateCount(QueryType.MediaLog, FileType.Video, mediaLogsCount.VideoCount); UpdateCount(QueryType.MediaLog, FileType.Voice, mediaLogsCount.VoiceCount); } }
/// <summary> /// 解析数据刷新进程 /// </summary> /// <param name="msgType"></param> /// <param name="value"></param> public void AnalyzeDataProgress(MsgType msgType, string value) { App.Current.Dispatcher.Invoke(new Action(() => { DataRefreshResult dataRefreshResult = XmlUnityConvert.XmlDeserialize <DataRefreshResult>(value); RefershWindow refershWindow = WindowsHelper.GetWindow <RefershWindow>(); if (refershWindow != null) { refershWindow.UpdateProgress(dataRefreshResult); } })); }
/// <summary> /// 状态 /// </summary> /// <param name="value"></param> public void AnalyzePcState(string value) { App.Current.Dispatcher.Invoke(new Action(() => { PcState serveState = XmlUnityConvert.XmlDeserialize <PcState>(value); AppConfigInfos.AppStateInfos.DataBaseState = serveState.DataBaseState; AppConfigInfos.AppStateInfos.ServerState = serveState.ServerState; AppConfigInfos.AppStateInfos.ServerIp = serveState.ServerIp; AppConfigInfos.AppStateInfos.MemoryPath = serveState.MemoryPath; AppConfigInfos.AppStateInfos.StationID = serveState.StationID; AppConfigInfos.AppStateInfos.StationCode = serveState.StationCode; AppConfigInfos.AppStateInfos.ServerMsgCode = serveState.ServerMsg; AppConfigInfos.AppStateInfos.DataBaseMsgCode = serveState.DataBaseMsg; })); }
/// <summary> /// 指纹采集结果 /// </summary> /// <param name="value"></param> private void AnalyzeCollectFingerPrint(string value) { App.Current.Dispatcher.Invoke(new Action(() => { FingerResult fingerResult = XmlUnityConvert.XmlDeserialize <FingerResult>(value); CollectFingerWindow collectFingerWindow = WindowsHelper.GetWindow <CollectFingerWindow>(); if (collectFingerWindow == null || !(collectFingerWindow.CurrentUser.UserID.Equals(fingerResult.UserID))) { return; } collectFingerWindow.FingerImage = fingerResult.FingerImage; collectFingerWindow.FingerStatus = fingerResult.ResultCode == 0 ? FingerStatus.RecordSuccess : FingerStatus.RecordFail; })); }
private void AnalyzeMediaLogUpload(string value) { MediaList mediaList = XmlUnityConvert.XmlDeserialize <MediaList>(value); if (mediaList != null && mediaList.MediaInfoList != null) { foreach (var item in mediaList.MediaInfoList) { MediaInfo mediaInfo = ManageViewModel.MediaList.Find(p => p.RecordID.Equals(item.RecordID)); if (mediaInfo != null) { mediaInfo.UpLoadState = item.UpLoadState; } } } }
private void AnalyzeCollectLogUpload(string value) { CollectLogs collectLogs = XmlUnityConvert.XmlDeserialize <CollectLogs>(value); if (collectLogs != null && collectLogs.CollectLogList != null) { foreach (var item in collectLogs.CollectLogList) { CollectLogInfo collectInfo = ManageViewModel.CollectLogs.Find(p => p.LogID.Equals(item.LogID)); if (collectInfo != null) { collectInfo.UpLoadState = item.UpLoadState; } } } }
private void AnalyzeMediaLogEditor(string value) { MediaLogEditorResult mer = XmlUnityConvert.XmlDeserialize <MediaLogEditorResult>(value); if (mer != null && mer.ResultCode == "0") { MediaInfo mediaInfo = ManageViewModel.MediaList.Find(p => p.RecordID.Equals(mer.MediaLogID)); if (mediaInfo != null) { mediaInfo.UserImp = mediaInfo.UpdateUserImp; mediaInfo.UserTag = mediaInfo.UpdateMark; } MediaInfo mediaVoiceInfo = ManageViewModel.VoicePlayMediaList.Find(p => p.RecordID.Equals(mer.MediaLogID)); if (mediaVoiceInfo != null) { mediaVoiceInfo.UserImp = mediaVoiceInfo.UpdateUserImp; mediaVoiceInfo.UserTag = mediaVoiceInfo.UpdateMark; } MediaInfo mediaPicInfo = ManageViewModel.PicturePlayMediaList.Find(p => p.RecordID.Equals(mer.MediaLogID)); if (mediaPicInfo != null) { mediaPicInfo.UserImp = mediaPicInfo.UpdateUserImp; mediaPicInfo.UserTag = mediaPicInfo.UpdateMark; } MediaInfo mediaVideoInfo = ManageViewModel.VideoPlayMediaList.Find(p => p.RecordID.Equals(mer.MediaLogID)); if (mediaVideoInfo != null) { mediaVideoInfo.UserImp = mediaVideoInfo.UpdateUserImp; mediaVideoInfo.UserTag = mediaVideoInfo.UpdateMark; } ResultWindow resultWindow = CheckResultMsg(MsgType.MediaLogEditorRespond); if (resultWindow != null) { resultWindow.SuccessCloseWindow(); } } else { NewMessageBox.Show(Application.Current.FindResource("SearchManagerSaveTimeOut").ToString()); } }
/// <summary> /// 采集指纹保存 /// </summary> /// <param name="value"></param> /// <param name="msgType"></param> private void AnalyzeSaveFingerPrint(string value, MsgType msgType) { App.Current.Dispatcher.Invoke(new Action(() => { FingerResult fingerResult = XmlUnityConvert.XmlDeserialize <FingerResult>(value); ResultWindow resultWindow = CheckResultMsg(msgType); if (resultWindow == null) { return; } if (fingerResult.ResultCode == 0) { resultWindow.SuccessCloseWindow(); FingerViewModel.AddFingerPrintByUser(fingerResult); } else { resultWindow.FailedCloseWindow(fingerResult); } })); }
/// <summary> /// 解析设置优先端口 /// </summary> /// <param name="msgType"></param> /// <param name="value"></param> public void AnalyzeSetFirstPort(MsgType msgType, string value) { App.Current.Dispatcher.Invoke(new Action(() => { FirstPortResult firstPortResult = XmlUnityConvert.XmlDeserialize <FirstPortResult>(value); ResultWindow resultWindow = CheckResultMsg(msgType); if (resultWindow == null) { return; } if (firstPortResult.ResultCode == ResultCode.Success) { resultWindow.SuccessCloseWindow(); } else { resultWindow.FailedCloseWindow(firstPortResult); } })); }
/// <summary> /// 解析数据刷新 /// </summary> /// <param name="msgType"></param> /// <param name="value"></param> public void AnalyzeDataReferesh(MsgType msgType, string value) { App.Current.Dispatcher.Invoke(new Action(() => { DataRefreshResult dataRefreshResult = XmlUnityConvert.XmlDeserialize <DataRefreshResult>(value); ResultWindow resultWindow = CheckResultMsg(msgType); if (resultWindow == null) { return; } if (dataRefreshResult.DataCode == ResultCode.Success) { resultWindow.SuccessCloseWindow(); } else { resultWindow.FailedCloseWindow(dataRefreshResult); } })); }
/// <summary> /// 点击开始、停止采集操作结果 /// </summary> /// <param name="msgType">消息类型</param> /// <param name="value">信息内容</param> /// <param name="deviceState">更新执法记录仪采集状态</param> private void AnalyzeDeviceCollectResult(MsgType msgType, string value, DeviceState deviceState) { App.Current.Dispatcher.Invoke(new Action(() => { DeviceCollectInfo deviceCollectInfo = XmlUnityConvert.XmlDeserialize <DeviceCollectInfo>(value); ResultWindow resultWindow = CheckResultMsg(msgType); if (resultWindow == null) { return; } if (deviceCollectInfo.ResultCode == 0) { resultWindow.SuccessCloseWindow(); DeviceInfoHelper.DeviceCollectInfo(deviceCollectInfo.DeviceID, deviceState); } else { resultWindow.FailedCloseWindow(deviceCollectInfo); } })); }
/// <summary> /// 解析账号验证信息,分为输入账号验证或者指纹直接验证 /// </summary> public void AnalyzeAccountValidate(MsgType msgType, string value) { App.Current.Dispatcher.Invoke(new Action(() => { UserResult userResult = XmlUnityConvert.XmlDeserialize <UserResult>(value); if (userResult.UserInfoFrom == UserInfoFrom.Login) { ResultWindow resultWindow = CheckResultMsg(msgType); if (resultWindow == null) { return; } resultWindow.ResultValue = userResult; if (userResult.UserResultCode.Equals("0")) { resultWindow.SuccessCloseWindow(); } else { resultWindow.FailedCloseWindow(userResult); } } else { LoginWindow loginWindow = WindowsHelper.GetWindow <LoginWindow>(); if (userResult == null || loginWindow == null || loginWindow.PermissionID != userResult.PermissionID) { // 过滤 return; } loginWindow.ReciveMsg(userResult); } })); }
/// <summary> /// 解析告警 /// </summary> /// <param name="value"></param> private void AnalyzeAlarmLogsDetail(string value) { AlarmLogs collectLogs = XmlUnityConvert.XmlDeserialize <AlarmLogs>(value); if (collectLogs != null && collectLogs.AlarmInfoList != null) { foreach (var item in collectLogs.AlarmInfoList) { AlarmInfo alarmInfo = ManageViewModel.AlarmLogs.Find(p => p.AlarmID.Equals(item.AlarmID)); if (alarmInfo == null) { // 添加 ManageViewModel.AlarmLogs.AddItem(item); item.SequenceNum = ManageViewModel.AlarmLogs.Count; UpdateDetailCount(QueryType.HisAlarm); } else { // 更新 item.ValueCloneToObject(alarmInfo); } } } }
/// <summary> /// 解析执法记录信息列表 /// </summary> /// <param name="value"></param> private void AnalyzeMediaListDetail(string value) { MediaList mediaList = XmlUnityConvert.XmlDeserialize <MediaList>(value); if (mediaList != null && mediaList.MediaInfoList != null) { foreach (var item in mediaList.MediaInfoList) { MediaInfo mediaInfo = ManageViewModel.MediaList.Find(p => p.RecordID.Equals(item.RecordID)); if (mediaInfo == null) { // 添加 ManageViewModel.MediaList.AddItem(item); item.SequenceNum = ManageViewModel.MediaList.Count; UpdateDetailCount(QueryType.MediaLog); } else { // 更新 item.ValueCloneToObject(mediaInfo); } } } }
/// <summary> /// 解析执法仪操作日志 /// </summary> /// <param name="value"></param> private void AnalyzeCameraLogsDetail(string value) { CameraLogs cameraLogs = XmlUnityConvert.XmlDeserialize <CameraLogs>(value); if (cameraLogs != null && cameraLogs.CameraLogInfoList != null) { foreach (var item in cameraLogs.CameraLogInfoList) { CameraLogInfo mediaInfo = ManageViewModel.CameraLogs.Find(p => p.LogID.Equals(item.LogID)); if (mediaInfo == null) { // 添加 ManageViewModel.CameraLogs.AddItem(item); item.SequenceNum = ManageViewModel.CameraLogs.Count; UpdateDetailCount(QueryType.CameraOperateLog); } else { // 更新 item.ValueCloneToObject(mediaInfo); } } } }
/// <summary> /// 组装数据包 /// </summary> /// <param name="MsgType"></param> /// <param name="data"></param> /// <returns></returns> private string GetMsgPackage(MessagePackage package) { string value = @"<hytera> <product_name>{0}</product_name> <version>{1}</version> <objectid>{2}</objectid> <objecttype>{3}</objecttype> <cmd_guid>{4}</cmd_guid> <cmd_name>{5}</cmd_name> <cmd_time>{6}</cmd_time> <cmd_content>{7}</cmd_content> </hytera> "; value = string.Format( value, "EEMS", "1.0", string.Empty, string.Empty, string.Empty, package.MsgType, DateTime.Now.ToString("yyyyMMdd HHmmss"), package.Data == null || package.Data.ToString() == "" ? string.Empty : XmlUnityConvert.XmlSerialize(package.Data) ); LogHelper.Instance.WirteLog("SendMessage:" + value, LogLevel.LogDebug); return(value); }