private void OpenVideo(Camera getCamera) { List <IntPtr> handelList = new List <IntPtr>(); PictureBox pb = new PictureBox() { BackColor = System.Drawing.Color.Black, Margin = new Padding(3, 0, 3, 0), Dock = DockStyle.Fill }; //Pink 改为 black 2016-3-3 11:25:18…… handelList.Add(pb.Handle); formHostBig.Child = pb; if (gCfg == null) { gCfg = InfoExchange.Clone(cfg);//InitReadVideoConfig(); } gCfg.CameraList.Clear(); getCamera.Position = "1"; gCfg.CameraList.Add(getCamera); if (_curVideoController != null) { _curVideoController.Stop(); _curVideoController.Close(); } _curVideoController = null; System.GC.Collect(); _curVideoController = new VideoController(new FtpConfig(), gCfg, handelList); _curVideoController.OnShowErrMsg += _curVideoController_OnShowErrMsg; _curVideoController.Open(); _curVideoController.Start(); }
/// <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 { //请选择 } }
public MainWindow(List <SeatAttentionWeightModel> seatAttentionInfos) { this.RegisterMessenger(); isAllowClose = false; RemoteCarMeasureViewModel rvm = this.DataContext as RemoteCarMeasureViewModel; InitializeComponent(); Rect rect = SystemParameters.WorkArea; this.MaxWidth = rect.Width + 14; this.MaxHeight = rect.Height + 14; this.WindowState = WindowState.Maximized; this.SeatNameTextBlock.Text = LoginUser.Name + "_" + LoginUser.Role.Name; this.SeatAttentionInfos = InfoExchange.Clone <List <SeatAttentionWeightModel> >(seatAttentionInfos); this.NewTaskGrid.Visibility = Visibility.Hidden; }
/// <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("设置播放录像的时间段完毕"); } } } } }
/// <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); } } } } }