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);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 按文件回放按钮按下
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void btnPlayByRecordFile_Click(object sender, EventArgs e)
        {
            playBy = 0;
            frm_PlayBackByFileSet fpf = new frm_PlayBackByFileSet();

            fpf.gLoginID = pLoginID;
            fpf.cmbChannelSelect.Items.Clear();

            for (int i = 0; i < 5; i++)
            {
                fpf.cmbChannelSelect.Items.Add(i.ToString());
            }
            fpf.ShowDialog(this);
            if (fpf.blnOKEnter == true)
            {
                groupBox1.Text = "视频回放";
                if (picRealPlay == null)
                {
                    picRealPlay = picRealPlay6;
                }
                pPlayBackChannelID = int.Parse(fpf.txtChannelID.Text.ToString());
                fileInfo           = fpf.gFileInfo;
                //**********按文件回放**********
                //自己定义长度
                pPlayBackHandle = new int[5];

                picRealPlay1.Visible = false;
                picRealPlay2.Visible = false;
                picRealPlay3.Visible = false;
                picRealPlay4.Visible = false;
                picRealPlay5.Visible = false;
                picRealPlay6.Visible = true;

                pPlayBackHandle[pPlayBackChannelID] = DHClient.DHPlayBackByRecordFile(pLoginID, ref fileInfo, picRealPlay.Handle, null, IntPtr.Zero);
                //******************************
                if (pPlayBackHandle[pPlayBackChannelID] == 0)
                {
                    MessageBox.Show("按时间回放失败!", pMsgTitle);
                }
                else
                {
                    //**********画面控制代码**********
                    btnPlay.Text = "||";

                    btnVideo1.Enabled          = false;
                    btnVideo2.Enabled          = false;
                    btnVideo3.Enabled          = false;
                    btnAisle.Enabled           = false;
                    btnControlroom.Enabled     = false;
                    groupVadioDownload.Enabled = false;
                    //画面按钮有效性控制
                    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;
                    //*********************************
                }
            }
        }