示例#1
0
        /// <summary>
        /// 开始
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ButtonPlayByTime_Click(object sender, RoutedEventArgs e)
        {
            DateTime?startTime = dptPlayStartTime.Value;
            DateTime?endTime   = dptPlayEndTime.Value;

            if (startTime == null || endTime == null || startTime >= endTime)
            {
                return;
            }
            if (_curVideoPlayBackController != null)
            {
                _curVideoPlayBackController.PlayStop();
            }
            var getCamera = videoList.SelectedItem as Camera;

            if (getCamera != null)
            {
                ReadNVRConfig();
                VideoConfig gCfg = InfoExchange.Clone(cfg); //InitReadVideoConfig();
                gCfg.CameraList.Clear();
                getCamera.Position = "1";
                getCamera.Ip       = nvrConfig.Ip;
                getCamera.PassWord = nvrConfig.PassWord;
                getCamera.UserName = nvrConfig.UserName;
                getCamera.Port     = nvrConfig.Port;

                #region 日志
                string msg = string.Format("Ip={0},Port={1},UserName={2},PassWord={3},Channel={4}", nvrConfig.Ip, nvrConfig.Port, nvrConfig.UserName, nvrConfig.PassWord, getCamera.Channel);

                LogModel log = new LogModel()
                {
                    CreateTime   = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                    Direction    = LogConstParam.Directions_OutIn,
                    FunctionName = "ReadNVRConfig()",
                    Level        = LogConstParam.LogLevel_Error,
                    Msg          = msg
                };
                Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log));
                #endregion
                //getCamera.Ip = dvrIp;
                //getCamera.PassWord = dvrPassW;
                //getCamera.UserName = dvrUserId;
                //getCamera.Channel = getCamera.DvrChannel;
                //System.Windows.Forms.MessageBox.Show(getCamera.Channel);
                //gCfg.VideoDriver=@"IoDllNew\hk\Talent.Video.HKVideo.dll";
                gCfg.CameraList.Add(getCamera);
                _curVideoPlayBackController = new VideoPlayBackController(gCfg, videoHis.Handle);
                _curVideoPlayBackController.OnShowErrMsg += _curVideoPlayBackController_OnShowErrMsg;
                _curVideoPlayBackController.PlayByTime(startTime.Value, endTime.Value);

                this.ButtonPlayPause.Content = "暂停";
            }
            else
            {
                //请选择
            }
        }
示例#2
0
        /// <summary>
        /// 毛重视频播放
        /// </summary>
        private void OpenMaoVideo()
        {
            if (this.showType == 0 || this.showType == 2)
            {
                if (weightModel != null && !string.IsNullOrEmpty(weightModel.grosstime))
                {
                    if (maoVideoPlayBackController != null)
                    {
                        maoVideoPlayBackController.PlayStop();
                    }
                    DateTime startTime = dptMZPlayStartTime.Value.Value; // DateTime.Parse(weightModel.JiMaoDate);
                    DateTime endTime   = dptMZPlayEndTime.Value.Value;   //startTime.AddMinutes(5);//计毛结束时间不晓得服务那边是否有,暂时先给计毛时间加5分钟作为计毛结束时间
                    if (endTime <= startTime)
                    {
                        return;
                    }
                    var getCamera = maoVideoList.SelectedItem as Camera;
                    if (getCamera != null)
                    {
                        //Talent.ClinetLog.SysLog.Log("选择了视频:" + getCamera.VideoName);
                        if (this.maoVideoConfig != null)
                        {
                            VideoConfig gCfg = InfoExchange.Clone <VideoConfig>(this.maoVideoConfig);
                            gCfg.CameraList.Clear();
                            //Talent.ClinetLog.SysLog.Log("清空摄像头列表");
                            getCamera.Position = "1";

                            getCamera.Ip       = maoNvrConfig.Ip;
                            getCamera.Port     = maoNvrConfig.Port;
                            getCamera.UserName = maoNvrConfig.UserName;
                            getCamera.PassWord = maoNvrConfig.PassWord;
                            //Talent.ClinetLog.SysLog.Log(string.Format("摄像头信息赋值,Ip={0};Port={1}", getCamera.Ip, getCamera.Port));
                            gCfg.CameraList.Add(getCamera);
                            //Talent.ClinetLog.SysLog.Log("准备构造摄像头Controller");
                            maoVideoPlayBackController = new VideoPlayBackController(gCfg, maoVideoHis.Handle);
                            //Talent.ClinetLog.SysLog.Log("构造摄像头Controller完毕,准备设置播放录像的时间段");
                            maoVideoPlayBackController.PlayByTime(startTime, endTime);
                            //Talent.ClinetLog.SysLog.Log("设置播放录像的时间段完毕");
                        }
                    }
                }
            }
        }
示例#3
0
        /// <summary>
        /// 皮重视频播放
        /// </summary>
        private void OpenPiVideo()
        {
            if (this.showType == 0 || this.showType == 1)
            {
                if (weightModel != null && !string.IsNullOrEmpty(weightModel.taretime))
                {
                    if (piVideoPlayBackController != null)
                    {
                        piVideoPlayBackController.PlayStop();
                    }
                    DateTime startTime = dptPZPlayStartTime.Value.Value; // DateTime.Parse(weightModel.JiMaoDate);
                    DateTime endTime   = dptPZPlayEndTime.Value.Value;   //startTime.AddMinutes(5);//
                    if (endTime <= startTime)
                    {
                        return;
                    }
                    var getCamera = piVideoList.SelectedItem as Camera;
                    if (getCamera != null)
                    {
                        if (this.piVideoConfig != null)
                        {
                            VideoConfig gCfg = InfoExchange.Clone <VideoConfig>(this.piVideoConfig);
                            gCfg.CameraList.Clear();
                            getCamera.Position = "1";

                            getCamera.Ip       = piNvrConfig.Ip;
                            getCamera.Port     = piNvrConfig.Port;
                            getCamera.UserName = piNvrConfig.UserName;
                            getCamera.PassWord = piNvrConfig.PassWord;

                            gCfg.CameraList.Add(getCamera);
                            piVideoPlayBackController = new VideoPlayBackController(gCfg, piVideoHis.Handle);
                            piVideoPlayBackController.PlayByTime(startTime, endTime);
                        }
                    }
                }
            }
        }
示例#4
0
        /// <summary>
        /// 窗体关闭事件
        /// </summary>
        private void btnClose_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                #region 毛重视频关闭及释放
                if (maoVideoPlayBackController != null)
                {
                    maoVideoPlayBackController.PlayStop();
                }
                maoVideoPlayBackController = null;
                #region 日志
                LogModel log = new LogModel()
                {
                    CreateTime   = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                    Direction    = LogConstParam.Directions_OutIn,
                    FunctionName = "数据查询_查看录像_窗体关闭(btnClose_Click)",
                    Level        = LogConstParam.LogLevel_Info,
                    Msg          = "关闭毛重视频录像成功"
                };
                Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log));
                #endregion
                maoFormHis.Dispose();
                maoFormHis = null;
                #region 日志
                LogModel log1 = new LogModel()
                {
                    CreateTime   = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                    Direction    = LogConstParam.Directions_OutIn,
                    FunctionName = "数据查询_查看录像_窗体关闭(btnClose_Click)",
                    Level        = LogConstParam.LogLevel_Info,
                    Msg          = "释放毛重视频录像成功"
                };
                Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log1));
                #endregion
                #endregion

                #region 皮重视频关闭及释放
                if (piVideoPlayBackController != null)
                {
                    piVideoPlayBackController.PlayStop();
                }
                piVideoPlayBackController = null;
                #region 日志
                LogModel log2 = new LogModel()
                {
                    CreateTime   = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                    Direction    = LogConstParam.Directions_OutIn,
                    FunctionName = "数据查询_查看录像_窗体关闭(btnClose_Click)",
                    Level        = LogConstParam.LogLevel_Info,
                    Msg          = "关闭皮重视频录像成功"
                };
                Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log2));
                #endregion
                piFormHis.Dispose();
                piFormHis = null;
                #region 日志
                LogModel log4 = new LogModel()
                {
                    CreateTime   = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                    Direction    = LogConstParam.Directions_OutIn,
                    FunctionName = "数据查询_查看录像_窗体关闭(btnClose_Click)",
                    Level        = LogConstParam.LogLevel_Info,
                    Msg          = "释放皮重视频录像成功"
                };
                Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log4));
                #endregion
                #endregion

                this.Close();
            }
            catch (Exception ex)
            {
                #region 日志
                LogModel log2 = new LogModel()
                {
                    CreateTime   = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                    Direction    = LogConstParam.Directions_OutIn,
                    FunctionName = "数据查询_查看录像_窗体关闭(btnClose_Click)",
                    Level        = LogConstParam.LogLevel_Info,
                    Msg          = "关闭窗体时异常:" + ex.Message
                };
                Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log2));
                #endregion
            }
        }
示例#5
0
        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
            }
        }