示例#1
0
 private void btnStop2_Click(object sender, EventArgs e)
 {
     if (DHClient.DHPlayBackControl(playRecordFile, PLAY_CONTROL.Stop) == false)//停止回放
     {
         MessageBox.Show("Ocurrió un error al detener la grabación", pMsgTitle);
     }
     btnCancelar_Click(null, null);
 }
示例#2
0
        /// <summary>
        /// 多设备演示程序加载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmMultiDVRSample_Load(object sender, EventArgs e)
        {
            disConnect = new fDisConnect(DisConnectEvent);
            DHClient.DHInit(disConnect, IntPtr.Zero);
            DHClient.DHSetEncoding(LANGUAGE_ENCODING.gb2312);//字符编码格式设置,默认为gb2312字符编码,如果为其他字符编码请设置

            StringUtil.InitControlText(this);
        }
示例#3
0
        private void login(int cantidadVentanas)
        {
            //this.initPantallas(cantidadVentanas);
            //this.inicializarVentanas(cantidadVentanas);

            int error = 0;

            if (pLoginID == 0)
            {
                deviceInfo = new NET_DEVICEINFO();
                pLoginID   = DHClient.DHLogin(this.ip, this.port, this.user, this.pass, out deviceInfo, out error);
            }
            if (pLoginID != 0)
            {
                this.startButtons(false);

                pRealPlayHandle = new int[deviceInfo.byChanNum];
                cantidadCamaras = deviceInfo.byChanNum;
                comboBoxCamaras.Items.Clear();
                for (int i = 0; i < cantidadCamaras; i++)
                {
                    comboBoxCamaras.Items.Add((i + 1).ToString());
                }

                //this.play(this.channel);

                comboBoxCamaras.SelectedIndex  = this.channel;
                comboBoxVentanas.SelectedIndex = this.getIndexCantidadVentanas(cantidadVentanas);
                realPlay();
            }
            else
            {
                /*btnStartRealPlay.Enabled = false;
                 * btnLogin.Enabled = true;
                 * btnLogout.Enabled = false;*/
                this.startButtons(true);
                if (DHClient.LastOperationInfo.errCode == "-2147483548")
                {
                    MessageBox.Show("Error de conexion a la camara: Password incorrecto!", pMsgTitle);
                }
                else if (DHClient.LastOperationInfo.errCode == "-2147483547")
                {
                    MessageBox.Show("Error de conexion a la camara: Usuario incorrecto!", pMsgTitle);
                }
                else if (DHClient.LastOperationInfo.errCode == "-2147483541")
                {
                    MessageBox.Show("Error de conexion a la camara! No fue posible conectar a la IP o puerto especificado", pMsgTitle);
                }
                else
                {
                    MessageBox.Show("Error de conexion a la camara:" + DHClient.LastOperationInfo.errCode, pMsgTitle);
                }



                Application.Exit();
            }
        }
示例#4
0
        /// <summary>
        /// 按时间回放按钮按下
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPlayBackByTime_Click(object sender, EventArgs e)
        {
            playBy = 1;
            frm_PlayBackByTimeSet fPBSet = new frm_PlayBackByTimeSet();

            fPBSet.cmbChannelSelect.Items.Clear();
            for (int i = 0; i < deviceInfo.byChanNum; i++)
            {
                fPBSet.cmbChannelSelect.Items.Add(i.ToString());
            }
            fileInfo = new NET_RECORDFILE_INFO();
            int  fileCount          = 0;
            bool blnQueryRecordFile = false;

            fPBSet.ShowDialog();
            if (fPBSet.blnOKEnter == true)
            {
                DateTime startTime = fPBSet.dtpStart.Value;
                DateTime endTime   = fPBSet.dtpEnd.Value;
                if (startTime.Date >= endTime.Date)
                {
                    MessageBox.Show("开始日期不在结束日期设置前,请重新设置!", pMsgTitle);
                }
                else
                {
                    blnQueryRecordFile = DHClient.DHQueryRecordFile(pLoginID, int.Parse(fPBSet.txtChannelID.Text.ToString()), RECORD_FILE_TYPE.ALLRECORDFILE,
                                                                    startTime, endTime, null, ref fileInfo, Marshal.SizeOf(typeof(NET_RECORDFILE_INFO)), out fileCount, 5000, false); //按时间回放
                    if (blnQueryRecordFile == true)
                    {
                        if (picRealPlay == null)
                        {
                            picRealPlay = picRealPlay15;
                        }
                        pPlayBackChannelID = int.Parse(fPBSet.txtChannelID.Text.ToString());
                        pPlayBackHandle[pPlayBackChannelID] = DHClient.DHPlayBackByTime(pLoginID, pPlayBackChannelID, startTime, endTime, picRealPlay.Handle, null, IntPtr.Zero);
                        if (pPlayBackHandle[pPlayBackChannelID] == 0)
                        {
                            MessageBox.Show("按时间回放失败!", pMsgTitle);
                        }
                        else
                        {
                            btnPlay.Text = "||";
                            //画面按钮有效性控制
                            btnPlayBackByTime.Enabled   = false;
                            gpbPlayBackControl.Enabled  = true;
                            btnPlay.Enabled             = true;
                            btnSlow.Enabled             = true;
                            btnStop.Enabled             = true;
                            btnFast.Enabled             = true;
                            btnSetpPlayS.Enabled        = true;
                            hsbPlayBack.Enabled         = true;
                            btnPlayByRecordFile.Enabled = false;
                        }
                    }
                }
                //MessageBox.Show(blnQueryRecordFile.ToString(),MsgTitle);
            }
        }
示例#5
0
 private void btnLogout_Click(object sender, EventArgs e)
 {
     blnSetRealDataCallBack   = false;
     btnStartRealPlay.Enabled = false;
     btnStopRealPlay.Enabled  = false;
     btnLogout.Enabled        = false;
     btnLogin.Enabled         = true;
     DHClient.DHLogout(pLoginID);
 }
示例#6
0
        /// <summary>
        /// 下载回调
        /// </summary>
        /// <param name="lPlayHandle">播放句柄</param>
        /// <param name="dwTotalSize">累计大小</param>
        /// <param name="dwDownLoadSize">下载大小</param>
        /// <param name="dwUser">用户数据</param>
        private void DownLoadPosFun(int lPlayHandle, UInt32 dwTotalSize, UInt32 dwDownLoadSize, IntPtr dwUser)
        {
            this.Invoke(setProgressPos, new object[] { lPlayHandle, dwTotalSize, dwDownLoadSize });

            if (0xFFFFFFFF == dwDownLoadSize || 0xFFFFFFFE == dwDownLoadSize)
            {
                DHClient.DHStopDownload(lPlayHandle);
            }
        }
示例#7
0
 /// <summary>
 /// 快放按钮按下
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnFast_Click(object sender, EventArgs e)
 {
     //停止步进播放
     if (btnStepPlayE.Enabled == true)
     {
         btnStepPlayE_Click(null, null);
     }
     DHClient.DHPlayBackControl(pPlayBackHandle[pPlayBackChannelID], PLAY_CONTROL.Fast);//快放控制
 }
示例#8
0
        /// <summary>
        /// 用户登录按钮按下处理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        //private void btnUserLogin_Click(object sender, EventArgs e)
        //{
        //    string strBtn = btnUserLogin.Text;
        //    if (strBtn == Utility.StringUtil.ConvertString("设备用户登录"))
        //    {
        //        frm_AddDevice fLogin = new frm_AddDevice();
        //        fLogin.ShowDialog();
        //        if (fLogin.blnOKEnter == true)
        //        {
        //            //设备用户信息获得
        //            deviceInfo = new NET_DEVICEINFO();
        //            int error = 0;
        //            //设备用户登录
        //            pLoginID = DHClient.DHLogin(fLogin.cmbDevIP.Text.ToString(), ushort.Parse(fLogin.txtDevProt.Text.ToString()), fLogin.txtName.Text.ToString(), fLogin.txtPassword.Text.ToString(), out deviceInfo, out error);
        //            if (pLoginID != 0)
        //            {
        //                strUserName = fLogin.txtDevName.Text;
        //                btnUserLogin.BackColor = Color.Yellow;
        //                btnUserLogin.Text = StringUtil.ConvertString("设备用户注销");
        //                grbMain.Enabled = true;
        //            }
        //            else
        //            {
        //                //报最后一次操作的错误信息
        //                MessageUtil.ShowMsgBox(StringUtil.ConvertString(DHClient.LastOperationInfo.errMessage, "ErrorMessage"),
        //                                       StringUtil.ConvertString(pMsgTitle));
        //            }
        //        }
        //    }
        //    else if (strBtn == Utility.StringUtil.ConvertString("设备用户注销"))
        //    {
        //        bool result = DHClient.DHLogout(pLoginID);
        //        if (result == false)
        //        {
        //            //报最后一次操作的错误信息
        //            MessageUtil.ShowMsgBox(StringUtil.ConvertString(DHClient.LastOperationInfo.errMessage, "ErrorMessage"),
        //                                   StringUtil.ConvertString(pMsgTitle));
        //        }
        //        btnUserLogin.BackColor = Color.Transparent;
        //        btnUserLogin.Text = StringUtil.ConvertString("设备用户登录");
        //        grbMain.Enabled = false;

        //        Utility.StringUtil.InitControlText(this);
        //    }
        //}

        /// <summary>
        /// 按文件下载按钮按下
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDownLoad1_Click(object sender, EventArgs e)
        {
            frm_PlayBackByFileSet fpf = new frm_PlayBackByFileSet();
            int pPlayBackChannelID    = 0;
            NET_RECORDFILE_INFO fileInfo;

            fpf.gLoginID        = pLoginID;
            fpf.txtDevName.Text = strUserName;
            fpf.cmbChannelSelect.Items.Clear();

            //for (int i = 1; i <= deviceInfo.byChanNum; i++)
            for (int i = 0; i < 5; i++)
            {
                fpf.cmbChannelSelect.Items.Add(i);
            }
            fpf.ShowDialog(this);
            if (fpf.blnOKEnter == true)
            {
                pPlayBackChannelID = int.Parse(fpf.txtChannelID.Text.ToString());
                fileInfo           = fpf.gFileInfo;
                //**********按文件下载**********
                if (txtDirPath1.Text.Trim().Length > 0 && txtFileName1.Text.Trim().Length > 0)
                {
                    string strFileName = txtFileName1.Text;
                    strFileName = strFileName.ToLower();
                    if (!strFileName.EndsWith(".dav"))
                    {
                        strFileName += ".dav";
                    }

                    pDownloadHandleByFile = DHClient.DHDownloadByRecordFile(pLoginID, fileInfo, txtDirPath1.Text + @"\" + strFileName, downLoadFun, IntPtr.Zero);
                    if (pDownloadHandleByFile != 0)
                    {
                        btnDownLoad1.Tag         = "下载中";
                        pDownloadHandle          = pDownloadHandleByFile;
                        btnDownLoad2.Enabled     = false;
                        btnDownLoad1.Enabled     = false;
                        btnStopDownLoad1.Enabled = true;
                        MessageUtil.ShowMsgBox(StringUtil.ConvertString("开始下载!"),
                                               StringUtil.ConvertString(pMsgTitle));
                    }
                    else
                    {
                        MessageUtil.ShowMsgBox(StringUtil.ConvertString(DHClient.LastOperationInfo.errMessage, "ErrorMessage"),
                                               StringUtil.ConvertString(pMsgTitle));
                    }
                }
                else
                {
                    MessageUtil.ShowMsgBox(StringUtil.ConvertString("请输入有效的录像保存目录和文件名!"),
                                           StringUtil.ConvertString(pMsgTitle));
                }

                //******************************
            }
        }
示例#9
0
 private void StopRealPlay(CarPlateDevice device)
 {
     if (device != null && device.m_nLoginID != 0 && device.m_realPlayH != 0)
     {
         //停止监视
         DHClient.DHStopRealPlay(device.m_realPlayH);
         device.m_realPlayH       = 0;
         this.pictureBoxImg.Image = null;
     }
 }
示例#10
0
 /// <summary>
 /// 删除预置点处理
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnDelPoint_Click(object sender, EventArgs e)
 {
     if (DHClient.DHPTZControl(LoginID, (int)nudChannel.Value, PTZ_CONTROL.PTZ_POINT_DEL_CONTROL, (ushort)nudPointNO.Value /*预置点值*/, false))
     {
     }
     else
     {
         MessageBox.Show("云台控制:删除预定点失败!", "提示");
     }
 }
示例#11
0
 private void btnPTZZoomOut_Click(object sender, EventArgs e)
 {
     if (cantidadVentanas == 1 && pLoginID > 0)
     {
         if (!DHClient.DHPTZControl(pLoginID, this.channel, DHNetSDK.PTZ_CONTROL.PTZ_ZOOM_DEC_CONTROL, 1, false))
         {
             MessageBox.Show("La función no está habilitada para este dispositivo", "Error");
         }
     }
 }
示例#12
0
        //private void TimeDownLoadPosFun(int lPlayHandle, UInt32 dwTotalSize, UInt32 dwDownLoadSize, int index, NET_RECORDFILE_INFO recordfileinfo, IntPtr dwUser)
        //private void TimeDownLoadPosFun(int lPlayHandle, UInt32 dwTotalSize, UInt32 dwDownLoadSize, IntPtr dwUser)
        public void TimeDownLoadPosFun(int lPlayHandle, int dwTotalSize, int dwDownLoadSize, int index
                                       , NET_RECORDFILE_INFO recordfileinfo, IntPtr dwUser)
        {
            this.Invoke(setProgressPos, new object[] { lPlayHandle, (UInt32)dwTotalSize, (UInt32)dwDownLoadSize });

            if (0xFFFFFFFF == dwDownLoadSize || 0xFFFFFFFE == dwDownLoadSize)
            {
                DHClient.DHStopDownload(lPlayHandle);
            }
        }
 private void btnFast_Click(object sender, EventArgs e)
 {
     if (playRecordFile > 0)
     {
         if (DHClient.DHPlayBackControl(playRecordFile, PLAY_CONTROL.Fast) == false)
         {
             MessageBox.Show("No se pudo aplicar la operación", "error");
         }
     }
 }
示例#14
0
 /// <summary>
 /// 初始化SDK
 /// </summary>
 public bool InitSDK()
 {
     //初始化SDK
     if (initialized == false)
     {
         DHClient.DHInit(disConnect, IntPtr.Zero);
         DHClient.DHSetAutoReconnect(onlineMsg, IntPtr.Zero);
         initialized = true;
     }
     return(initialized);
 }
示例#15
0
 /// <summary>
 /// 雨刷开关处理
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnLamControl_Click(object sender, EventArgs e)
 {
     if (DHClient.DHPTZControl(LoginID, (int)nudChannel.Value, PTZ_CONTROL.PTZ_LAMP_CONTROL, (ushort)(blnLam == true ? 1 : 0), false))
     {
         blnLam = !blnLam;
     }
     else
     {
         MessageBox.Show("云台控制:雨刷功能失败!", "提示");
     }
 }
示例#16
0
 public void Close()
 {
     try
     {
         DHClient.DHLogout(iLogin);
         IsLogin = true;
     }
     catch (Exception ex)
     {
         Log.WriteLog("大华视频显示控件-关掉视频:", ex);
     }
 }
示例#17
0
        private void stop()
        {
            this.startButtons(true);
            for (int i = 0; i < pRealPlayHandle.Length; i++)
            {
                if (pRealPlayHandle[i] != 0)
                {
                    bool pudo = DHClient.DHStopRealPlay(pRealPlayHandle[i]);

                    /*int xxx = 0;
                     * if (!pudo && xxx < 5)
                     * {
                     *  pudo = DHClient.DHStopRealPlayEx(pRealPlayHandle[i]);
                     *  xxx++;
                     * }*/
                }


                pRealPlayHandle[i] = 0;
            }
            Thread.Sleep(800);
            for (int i = 0; i < cantidadVentanas; i++)
            {
                if (i < pantallas.Count)
                {
                    pantallas[i].Refresh();
                }
            }
            //groupBoxVentanas16.Visible = false;
            //groupBoxVentanas16.Visible = true;

            /*for (int i = 0; i < cantidadVentanas; i++)
             * {
             *  if (i < pantallas.Count) pantallas[i].Refresh();
             *
             * }
             * for (int i = 0; i < cantidadVentanas; i++)
             * {
             *  if (i < pantallas.Count) pantallas[i].Refresh();
             *
             * }
             * for (int i = 0; i < cantidadVentanas; i++)
             * {
             *  if (i < pantallas.Count) pantallas[i].Refresh();
             *
             * }*/

            DHClient.DHLogout(pLoginID);

            //DHClient.DHCleanup();
            //DHClient.DHStopService(pLoginID);
            pLoginID = 0;
        }
示例#18
0
        private void frm_Main_Load(object sender, EventArgs e)
        {
            groupBoxVentanas1.Location  = new Point(4, 4);
            groupBoxVentanas4.Location  = groupBoxVentanas1.Location;
            groupBoxVentanas9.Location  = groupBoxVentanas1.Location;
            groupBoxVentanas16.Location = groupBoxVentanas1.Location;

            disConnect = new fDisConnect(DisConnectEvent);
            bool blnInit = DHClient.DHInit(disConnect, IntPtr.Zero);

            login(this.cantidadVentanas);
        }
示例#19
0
 /// <summary>
 /// 抓图处理代码
 /// </summary>
 /// <param name="hPlayHandle">播放句柄</param>
 /// <param name="bmpPath">图像促存路径</param>
 private void CapturePicture(int hPlayHandle, string bmpPath)
 {
     if (DHClient.DHCapturePicture(hPlayHandle, bmpPath))
     {
         //抓图成功处理
         MessageBox.Show("抓图成功!  图片路径:" + bmpPath, pMsgTitle);
     }
     else
     {
         //抓图失败处理
         MessageBox.Show("抓图失败!", pMsgTitle);
     }
 }
示例#20
0
        /// <summary>
        /// 自动重连成功事件
        /// </summary>
        /// <param name="lLoginID"></param>
        /// <param name="pchDVRIP"></param>
        /// <param name="nDVRPort"></param>
        /// <param name="dwUser"></param>
        private void OnlineEvent(int lLoginID, StringBuilder pchDVRIP, int nDVRPort, IntPtr dwUser)
        {
            CarPlateDevice device = _Devices.SingleOrDefault(d => d.m_nLoginID == lLoginID);

            if (device != null)
            {
                //自动重连成功事件后,发起订阅设备事件消息

                device.m_nRealLoadPic = DHClient.DHRealLoadPicture(device.m_nLoginID, device.VideoID, EventIvs.EVENT_IVS_ALL, anaCallback, 0);

                device.State = 1;
            }
        }
 /// <summary>
 /// 抓图处理代码
 /// </summary>
 /// <param name="hPlayHandle">播放句柄</param>
 /// <param name="bmpPath">图像促存路径</param>
 private bool CapturePicture(int hPlayHandle, string bmpPath)
 {
     if (DHClient.DHCapturePicture(hPlayHandle, bmpPath))
     {
         //抓图成功处理
         return(true);
     }
     else
     {
         //抓图失败处理
         return(false);
     }
 }
示例#22
0
        /// <summary>
        /// 画面加载初期化
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmMain_Load(object sender, EventArgs e)
        {
            disConnect = new fDisConnect(DisConnectEvent);
            DHClient.DHInit(disConnect, IntPtr.Zero);
            downLoadFun     = new fDownLoadPosCallBack(DownLoadPosFun);
            timeDownLoadFun = new fTimeDownLoadPosCallBack(TimeDownLoadPosFun);
            //timeDownLoadFun = new fDownLoadPosCallBack(TimeDownLoadPosFun);
            setProgressPos   = new fSetProgressPos(DownloadProgress);
            grbMain.Enabled  = false;
            btnDownLoad1.Tag = "";
            btnDownLoad2.Tag = "";

            StringUtil.InitControlText(this);
        }
示例#23
0
 private void InitSDK()
 {
     m_disConnect = new fDisConnect(DisConnectEvent);
     m_SnapRecv   = new fSnapRev(SnapRev);
     m_bInit      = DHClient.DHInit(m_disConnect, IntPtr.Zero);
     if (!m_bInit)
     {
         MessageBox.Show("初始化失败");
     }
     else
     {
         DHClient.DHSetSnapRevCallBack(m_SnapRecv, 0);
     }
 }
示例#24
0
        /// <summary>
        /// 触发手动抓拍
        /// </summary>
        /// <param name="device"></param>
        private void ManualSnap(CarPlateDevice device)
        {
            device.ResetResult();
            //触发手动抓拍测试
            MANUAL_SNAP_PARAMETER snap = new MANUAL_SNAP_PARAMETER();

            snap.nChannel = device.VideoID;
            IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(snap));

            Marshal.StructureToPtr(snap, ptr, false);
            bool bRet = DHClient.DHControlDevice(device.m_nLoginID, CtrlType.DH_MANUAL_SNAP, ptr, 1000);

            System.Runtime.InteropServices.Marshal.FreeHGlobal(ptr);
        }
示例#25
0
        private void btnGrabaciones_Click(object sender, EventArgs e)
        {
            DHClient.DHPlayBackControl(playRecordFile, PLAY_CONTROL.Stop);
            frm_PlayBackByFileSet fpf = new frm_PlayBackByFileSet();

            fpf.gLoginID      = pLoginID;
            fpf.ipDispositivo = this.ip;//pasa el ip actual

            //carga canales en combochanel de grabaciones
            fpf.cmbChannelSelect.Items.Clear();
            for (int i = 0; i < deviceInfo.byChanNum; i++)
            {
                fpf.cmbChannelSelect.Items.Add((i + 1).ToString());
            }
            //setea el combochanel de grabaciones en el canal actual
            fpf.cmbChannelSelect.SelectedIndex = comboBoxCamaras.SelectedIndex;
            //setea el textbox chanel en el canal actual
            fpf.channelActual = comboBoxCamaras.SelectedIndex.ToString();

            fpf.ShowDialog(this);

            /*
             * if (fpf.blnOKEnter == true)
             * {
             *  pPlayBackChannelID = int.Parse(fpf.txtChannelID.Text.ToString());
             *  fileInfo = fpf.gFileInfo;
             *  playRecordFile = DHClient.DHPlayBackByRecordFile(pLoginID, ref fileInfo, picRecord.Handle, null, IntPtr.Zero);
             *  if (playRecordFile == 0)
             *  {
             *      MessageBox.Show("Ocurrió un error con al cargar la grabación", pMsgTitle);
             *      btnCancelar_Click(null, null);
             *  }
             *  else
             *  {
             *      btnPlay2.Text = "||";
             *      groupBoxVentanas1.Visible = false;
             *      groupBoxVentanas4.Visible = false;
             *      groupBoxVentanas9.Visible = false;
             *      groupBoxVentanas16.Visible = false;
             *      groupBoxRecord.Visible = true;
             *      gpbPlayBackControl.Enabled = true;
             *      btnTomarFoto.Enabled = false;
             *      groupBox5.Enabled = false;
             *      groupBox4.Enabled = false;
             *      btnStop.Enabled = false;
             *      btnPlay.Enabled = false;
             *  }
             * }
             * */
        }
 private void btnStepPlayE_Click_1(object sender, EventArgs e)
 {
     try
     {
         if (DHClient.DHPlayBackControl(playRecordFile, PLAY_CONTROL.StepStop) == false)//单步播放停止
         {
             // MessageBox.Show("Ocurrió un error al reproducir la grabación", "Error");
         }
     }
     catch
     {
         MessageBox.Show(DHClient.LastOperationInfo.ToString(), "Error");
     }
     btnStepPlayE.Enabled = false;
 }
示例#27
0
        private bool _Inited = false;              //窗体是否已进行初始化了
        #endregion

        #region 回调事件
        /// <summary>
        /// 设备离线事件
        /// </summary>
        /// <param name="lLoginID"></param>
        /// <param name="pchDVRIP"></param>
        /// <param name="nDVRPort"></param>
        /// <param name="dwUser"></param>
        private void DisConnectEvent(int lLoginID, StringBuilder pchDVRIP, int nDVRPort, IntPtr dwUser)
        {
            CarPlateDevice device = _Devices.SingleOrDefault(d => d.m_nLoginID == lLoginID);

            if (device != null)
            {
                //设备离线消息;设备非正常关机,SDK可以检测到;需要取消订阅,当重新在线消息时,再发起订阅事件
                if (device.m_nRealLoadPic != 0)
                {
                    DHClient.DHStopLoadPic(device.m_nRealLoadPic);
                    device.m_nRealLoadPic = 0;
                }
                device.State = 2;
            }
        }
示例#28
0
 /// <summary>
 /// 步进播放停止
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnStepPlayE_Click(object sender, EventArgs e)
 {
     try
     {
         if (DHClient.DHPlayBackControl(pPlayBackHandle[pPlayBackChannelID], PLAY_CONTROL.StepStop) == false)//单步播放停止
         {
             MessageBox.Show("单步播放停止错误!", pMsgTitle);
         }
     }
     catch
     {
         MessageBox.Show(DHClient.LastOperationInfo.ToString(pErrInfoFormatStyle), pMsgTitle);
     }
     btnStepPlayE.Enabled = false;
 }
        private void procesoPlay2()
        {
            gFileInfo = nriFileInfo[lsvFiles.SelectedItems[0].Index];

            pPlayBackChannelID = int.Parse(txtChannelID.Text.ToString());
            fileInfo           = gFileInfo;



            playRecordFile = DHClient.DHPlayBackByRecordFile(gLoginID, ref fileInfo, pictureBoxPlayback.Handle, null, IntPtr.Zero);
            if (playRecordFile == 0)
            {
                // MessageBox.Show("Ocurrió un error con al cargar la grabación", "Error");
                btnCancelar_Click(null, null);
                playRecordFile = DHClient.DHPlayBackByRecordFile(gLoginID, ref fileInfo, pictureBoxPlayback.Handle, null, IntPtr.Zero);
            }
            if (playRecordFile > 0)
            {
                uint sizeFilecharge = fileInfo.size / 100;

                uint currentFrames = DHPlay.DHPlayControl(PLAY_COMMAND.GetCurrentFrameNum, 0, true);

                lblCurrentFrame.Text = currentFrames.ToString();
                lblCurrentTime.Text  = fileInfo.starttime.dwHour.ToString() + ":" + fileInfo.starttime.dwMinute.ToString() + ":" + fileInfo.starttime.dwSecond.ToString();
                lblInfoVideo.Text    = fileInfo.starttime.dwHour.ToString() + ":" + fileInfo.starttime.dwMinute.ToString() + ":" + fileInfo.starttime.dwSecond.ToString() + " - " + fileInfo.endtime.dwHour.ToString() + ":" + fileInfo.endtime.dwMinute.ToString() + ":" + fileInfo.endtime.dwSecond.ToString();

                DateTime startTime = new DateTime(fileInfo.starttime.dwYear, fileInfo.starttime.dwMonth, fileInfo.starttime.dwDay, fileInfo.starttime.dwHour, fileInfo.starttime.dwMinute, fileInfo.starttime.dwSecond);
                DateTime endTime   = new DateTime(fileInfo.endtime.dwYear, fileInfo.endtime.dwMonth, fileInfo.endtime.dwDay, fileInfo.endtime.dwHour, fileInfo.endtime.dwMinute, fileInfo.endtime.dwSecond);
                TimeSpan span      = endTime.Subtract(startTime);

                segundosTotales   = (int)span.TotalSeconds;
                lblTotalTime.Text = span.Hours.ToString() + ":" + span.Minutes.ToString() + ":" + span.Seconds.ToString();


                trbPlayFrames.Maximum = 100;//(int) sizeFilecharge;

                timerGetPlayInfo.Enabled = true;

                btnPlay2.Tag = "||";
                play2State();
                gpbPlayBackControl.Enabled = true;
            }
            else
            {
                MessageBox.Show("Ocurrió un error con al cargar la grabación", "Error");
                btnCancelar_Click(null, null);
            }
        }
示例#30
0
 /// <summary>
 /// [设备用户注销]按钮按下
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnUserLogout_Click(object sender, EventArgs e)
 {
     try
     {
         bool result = DHClient.DHLogout(pLoginID);
         if (result == false)
         {
             //报最后一次操作的错误信息
             MessageBox.Show(DHClient.LastOperationInfo.ToString(pErrInfoFormatStyle), pMsgTitle);
         }
         picRealPlay0.Refresh();
         picRealPlay1.Refresh();
         picRealPlay2.Refresh();
         picRealPlay3.Refresh();
         picRealPlay4.Refresh();
         picRealPlay5.Refresh();
         picRealPlay6.Refresh();
         picRealPlay7.Refresh();
         if (picRealPlay != null)
         {
             picRealPlay.Refresh();
         }
         //画面初期化
         this.Controls.Clear();
         InitializeComponent();
         StringUtil.InitControlText(this);
         pLoginID                    = 0;
         fileInfo                    = new NET_RECORDFILE_INFO();
         playBy                      = 0;
         pRealPlayHandle             = new int[16];
         pPlayBackHandle             = new int[16];
         pPlayBackChannelID          = 0;
         deviceInfo                  = new NET_DEVICEINFO();
         this.WindowState            = FormWindowState.Normal;
         btnRealPlay.Enabled         = false;
         btnPlayBackByTime.Enabled   = false;
         gpbPlayBackControl.Enabled  = false;
         btnUserLogout.Enabled       = false;
         btnRealPlay.Text            = StringUtil.ConvertString("实时监视开始");
         btnPlayByRecordFile.Enabled = false;
         gpbPlayBackControl.Enabled  = false;
         gpbPTZControl.Enabled       = false;
     }
     catch
     {
         MessageBox.Show("设备用户注销失败!", pMsgTitle);
     }
 }