/// <summary> /// 发送语音提示 /// </summary> /// <param name="obj">选择的语音提示对象</param> private void SendVoiceRemind(object obj) { VoiceRemindHelper.SendVoiceInfoToMeasure(obj, CurClientModel.ClientId); #region 写日志 LogModel log = new LogModel() { CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Direction = LogConstParam.Directions_Out, FunctionName = "坐席_视频监控窗体_发送语音提示", Level = LogConstParam.LogLevel_Info, Msg = "发送语音提示命令【" + SeatSendCmdEnum.cmd2client + "】给任务服务器", Origin = "汽车衡_" + LoginUser.Role.Name, Data = new { clientid = CurClientModel.ClientId, cmd = ParamCmd.Voice_Prompt, msg = obj }, IsDataValid = LogConstParam.DataValid_Ok, ParamList = new List <DataParam>() { new DataParam() { ParamName = "cmd", ParamValue = SeatSendCmdEnum.cmd2client } }, OperateUserName = LoginUser.Name }; Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log)); #endregion }
/// <summary> /// 打开语音通话 /// </summary> private void OpenVoiceTalk() { IsVoiceOpend = !IsVoiceOpend; if (IsVoiceOpend) { audioController.Start(); VoiceRemindHelper.SendVoiceTalkStartToMeasure(CurClientModel.ClientId); #region 写日志 LogModel log = new LogModel() { CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Direction = LogConstParam.Directions_Out, FunctionName = "坐席_视频监控窗体_打开语音通话", Level = LogConstParam.LogLevel_Info, Msg = "发送【打开语音对讲】命令【" + SeatSendCmdEnum.cmd2client + "】给任务服务器", Origin = "汽车衡_" + LoginUser.Role.Name, Data = new { clientid = CurClientModel.ClientId, cmd = ParamCmd.Voice_Prompt, msg = "语音对讲开始" }, IsDataValid = LogConstParam.DataValid_Ok, ParamList = new List <DataParam>() { new DataParam() { ParamName = "cmd", ParamValue = SeatSendCmdEnum.cmd2client } }, OperateUserName = LoginUser.Name }; Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log)); #endregion } else { audioController.Stop(); VoiceRemindHelper.SendVoiceTalkEndToMeasure(CurClientModel.ClientId); #region 写日志 LogModel log = new LogModel() { CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Direction = LogConstParam.Directions_Out, FunctionName = "坐席_视频监控窗体_打开语音通话", Level = LogConstParam.LogLevel_Info, Msg = "发送【关闭语音对讲】命令【" + SeatSendCmdEnum.cmd2client + "】给任务服务器", Origin = "汽车衡_" + LoginUser.Role.Name, Data = new { clientid = CurClientModel.ClientId, cmd = ParamCmd.Voice_Prompt, msg = "语音对讲结束" }, IsDataValid = LogConstParam.DataValid_Ok, ParamList = new List <DataParam>() { new DataParam() { ParamName = "cmd", ParamValue = SeatSendCmdEnum.cmd2client } }, OperateUserName = LoginUser.Name }; Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log)); #endregion } }
public void init() { #region 语音对讲初始化 IsVoiceOpend = false; string basePath = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "CarMeasureClient"); configPath = System.IO.Path.Combine(basePath, CurClientModel.ClientId + ".xml"); audioController = new AudioController(configPath); audioController.OnShowErrMsg += audioController_OnShowErrMsg; audioController.Open(); #endregion #region 语音提示初始化 string basePath1 = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "ClientConfig"); var configPath1 = System.IO.Path.Combine(basePath1, "SystemConfig.xml"); VoiceCollections = VoiceRemindHelper.ReadVoiceConfig(string.Empty, configPath1, out this.measureConfig); #endregion }
private void btnClose_Click(object sender, RoutedEventArgs e) { try { VideoMonitorViewModel vm = (VideoMonitorViewModel)this.DataContext; #region 关闭语音对讲 if (vm.audioController != null) { vm.audioController.Stop(); vm.audioController.Close(); } VoiceRemindHelper.SendVoiceTalkEndToMeasure(vm.CurClientModel.ClientId); #region 写日志 LogModel log = new LogModel() { CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Direction = LogConstParam.Directions_Out, FunctionName = "视频监控窗体_窗体关闭事件", Level = LogConstParam.LogLevel_Info, Msg = "关闭【语音对讲】,同时通知任务服务器", Origin = LoginUser.Role.Name, Data = new { clientid = vm.CurClientModel.ClientId, cmd = ParamCmd.Voice_Prompt, msg = "语音对讲结束" }, IsDataValid = LogConstParam.DataValid_Ok, ParamList = new List <DataParam>() { new DataParam() { ParamName = "cmd", ParamValue = SeatSendCmdEnum.cmd2client } }, OperateUserName = LoginUser.Name }; Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log)); #endregion #endregion #region 关闭视频 if (_curVideoController != null) { _curVideoController.Stop(); _curVideoController.Close(); #region 写日志 LogModel log1 = new LogModel() { CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Direction = LogConstParam.Directions_Out, FunctionName = "视频监控窗体_窗体关闭事件", Level = LogConstParam.LogLevel_Info, Msg = "关闭视频成功", Origin = LoginUser.Role.Name, OperateUserName = LoginUser.Name }; Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log1)); #endregion } _curVideoController = null; #endregion #region 关闭视频回放 if (_curVideoPlayBackController != null) { _curVideoPlayBackController.PlayStop(); #region 写日志 LogModel log2 = new LogModel() { CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Direction = LogConstParam.Directions_Out, FunctionName = "视频监控窗体_窗体关闭事件", Level = LogConstParam.LogLevel_Info, Msg = "关闭历史回放视频成功", Origin = LoginUser.Role.Name, OperateUserName = LoginUser.Name }; Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log2)); #endregion } _curVideoPlayBackController = null; #endregion #region 释放视频监控资源 try { #region 内存日志 long memorySize = GetMemoryAmount(); LogModel log3 = new LogModel() { CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), FunctionName = "视频监控_释放WindowsFormsHost前", Msg = "释放WindowsFormsHost前,当前线程使用内存大小:" + memorySize + "字节(" + Math.Round((double)memorySize / (1024 * 1024), 2) + "M)" }; Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log3)); #endregion this.formHostBig.Dispose(); this.formHostBig = null; #region 内存日志 memorySize = GetMemoryAmount(); LogModel log4 = new LogModel() { CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), FunctionName = "视频监控_释放WindowsFormsHost后", Msg = "释放WindowsFormsHost后,当前线程使用内存大小:" + memorySize + "字节(" + Math.Round((double)memorySize / (1024 * 1024), 2) + "M)" }; Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log4)); #endregion } catch (Exception ex) { #region 写日志 LogModel log1 = new LogModel() { CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Direction = LogConstParam.Directions_Out, FunctionName = "视频监控窗体_窗体关闭事件", Level = LogConstParam.LogLevel_Error, Msg = "释放视频资源时异常:" + ex.Message, Origin = LoginUser.Role.Name, OperateUserName = LoginUser.Name }; Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log1)); #endregion } #endregion #region 释放历史回放监控资源 try { this.formHis.Dispose(); this.formHis = null; #region 写日志 LogModel log2 = new LogModel() { CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Direction = LogConstParam.Directions_Out, FunctionName = "视频监控窗体_窗体关闭事件", Level = LogConstParam.LogLevel_Info, Msg = "释放历史回放视频资源成功", Origin = LoginUser.Role.Name, OperateUserName = LoginUser.Name }; Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log2)); #endregion } catch (Exception ex) { #region 写日志 LogModel log1 = new LogModel() { CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Direction = LogConstParam.Directions_Out, FunctionName = "视频监控窗体_窗体关闭事件", Level = LogConstParam.LogLevel_Error, Msg = "释放历史回放视频资源时异常:" + ex.Message, Origin = LoginUser.Role.Name, OperateUserName = LoginUser.Name }; Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log1)); #endregion } #endregion this.Close(); } catch (Exception ex) { #region 写日志 LogModel log1 = new LogModel() { CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Direction = LogConstParam.Directions_Out, FunctionName = "视频监控窗体_窗体关闭事件", Level = LogConstParam.LogLevel_Error, Msg = "窗体关闭时异常:" + ex.Message, Origin = LoginUser.Role.Name, OperateUserName = LoginUser.Name }; Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log1)); #endregion } }