Esempio n. 1
0
        //打开网络视频源
        private void button_Capture_Click(object sender, EventArgs e)
        {
            //关闭网络视频
            MainForm.videoplayer.CloseVideo();
            MainForm.videoplayer.Close();

            try
            {
                bVideoType           = true;//选择网络视频
                MainForm.videoplayer = new VideoPlayer();

                login = new LoginForm();
                login.MainFormMessageEvent += new LoginForm.MainFormMessage(VideoShow);//视频线程初始化
                login.ShowDialog();

                if (MainForm.videoplayer.IsPlaying())
                {
                    button3.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                DebugOutput.ProcessMessage("网络启动摄像头失败:" + ex.Message);
            }
        }
Esempio n. 2
0
        //网络视频显示
        private void VideoShow(string ip, string portstring, string name, string password)
        {
            try
            {
                MainForm.videoplayer.TopLevel = false;                       // 这一步最重要, 去除子窗体的顶级窗体设置
                //videoplayer.Parent = this.pictureBox_BackGround; // 子窗体的父容器
                MainForm.videoplayer.FormBorderStyle = FormBorderStyle.None; // 去边框标题栏等
                MainForm.videoplayer.StartVideo(name, password, ip);         //启动视频
                MainForm.videoplayer.Show();                                 //显示界面

                //判别是否连接成功
                if (MainForm.videoplayer.IsPlaying())
                {
                    button3.Enabled = false;
                    button1.Enabled = true;
                    MessageBox.Show("登录成功!", "提示");
                    login.Close();

                    MainForm.videoplayer.Parent = this.pictureBox_BackGround; // 子窗体的父容器
                    MainForm.videoplayer.Dock   = DockStyle.Fill;
                }
                else
                {
                    MessageBox.Show("登录失败!", "提示");
                }
            }

            catch (Exception ex)
            {
                DebugOutput.ProcessMessage("网络登录显示失败:" + ex.Message);
            }
        }
Esempio n. 3
0
        //打开网络视频源
        private void button_Camera_Open_Click(object sender, EventArgs e)
        {
            try
            {
                bVideoType           = true;//选择网络视频
                MainForm.videoplayer = new VideoPlayer();

                login = new LoginForm();
                login.MainFormMessageEvent += new LoginForm.MainFormMessage(VideoShow);//视频线程初始化
                login.ShowDialog();

                if (MainForm.videoplayer.IsPlaying())
                {
                    this.Button_VideoFile_Open.Enabled = false; //打开本地视频按钮
                    this.button_Detect.Enabled         = true;  //开始检测按钮
                    this.Button_Detect_Stop.Enabled    = false; //停止检测
                    this.button_Detect_Close.Enabled   = true;  //关闭视频
                }

                currentFrameN = 0;

                /*
                 * isNetVideoType = true;
                 * this.timer_Video.Enabled = false;
                 *
                 * m_factory = new MediaPlayerFactory();
                 * m_player = m_factory.CreatePlayer<IVideoPlayer>();
                 * m_player.WindowHandle = pictureBox1.Handle;//panel1.Handle;
                 *
                 * StartVideo("", "", "");
                 *
                 */
            }
            catch (Exception ex)
            {
                DebugOutput.ProcessMessage("网络启动摄像头失败:" + ex.Message);
            }
        }