Exemplo n.º 1
0
        private void button_play_Click(object sender, EventArgs e)
        {
            VideoPlayer player = videoPlayerManageCtrl1.ActiveBox;

            if (player != null)
            {
                if (player.Active)
                {
                    player.Close();
                    player.Config = null;
                    player.Refresh();
                }
                else
                {
                    IVideoSourceConfig vsConfig = null;

                    TreeNode node = dataTreeView1.SelectedNode;
                    if (node != null)
                    {
                        vsConfig = VSUtil.GetRealPlayConfig(node.Tag as DataRow);
                    }

                    if (vsConfig != null)
                    {
                        player.Config = vsConfig;
                        player.Play();
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void button_backplay_Click(object sender, EventArgs e)
        {
            VideoPlayer player = videoPlayerManageCtrl1.ActiveBox;

            if (player != null)
            {
                if (player.Active)
                {
                    player.Close();
                    player.Config = null;
                    player.Refresh();
                }
                else
                {
                    IVideoSourceConfig vsConfig = null;

                    TreeNode node = dataTreeView1.SelectedNode;
                    if (node != null)
                    {
                        vsConfig = VSUtil.GetBackPlayConfig(node.Tag as DataRow);
                        //vsConfig.StopTime = DateTime.Now;
                        //vsConfig.StartTime = vsConfig.StopTime.AddDays(-1);

                        vsConfig.StartTime = dateTimePicker_begin.Value;
                        vsConfig.StopTime  = dateTimePicker_end.Value;
                    }

                    if (vsConfig != null)
                    {
                        player.Config = vsConfig;
                        player.Play();
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void button_download_Click(object sender, EventArgs e)
        {
            if (this.saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                VideoPlayer player = videoPlayerManageCtrl1.ActiveBox;
                if (player != null)
                {
                    IBackPlayer backPlay = player.VideoSource as IBackPlayer;
                    if (backPlay != null)
                    {
                        //backPlay.StartDownload(this.saveFileDialog1.FileName);
                        backPlay.StartDownload(dateTimePicker_begin.Value, dateTimePicker_end.Value, this.saveFileDialog1.FileName);
                        return;
                    }
                }

                TreeNode node = dataTreeView1.SelectedNode;
                if (node != null)
                {
                    IVideoSourceConfig vsConfig = VSUtil.GetBackPlayConfig(node.Tag as DataRow);
                    if (vsConfig != null)
                    {
                        vsConfig.StartTime = dateTimePicker_begin.Value;
                        vsConfig.StopTime  = dateTimePicker_end.Value;

                        IVideoSource vs = CLocalSystem.VideoSourceManager.Open(vsConfig, IntPtr.Zero);
                        if (vs != null)
                        {
                            IBackPlayer backPlay = vs as IBackPlayer;
                            if (backPlay != null)
                            {
                                backPlay.RecordFile.OnDownProgress += new RECORDFILE_DOWNPROGRESS(DoDownProgress);
                                backPlay.StartDownload(this.saveFileDialog1.FileName);
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 4
0
        private void dataTreeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            VideoPlayer player = videoPlayerManageCtrl1.ActiveBox;

            if (player != null)
            {
                if (player.Active)
                {
                    player.Close();
                    player.Config = null;
                    player.Refresh();
                }
                else
                {
                    IVideoSourceConfig vsConfig = VSUtil.GetVSConfig(e.Node.Tag as DataRow);
                    if (vsConfig != null)
                    {
                        player.Config = vsConfig;
                        player.Play();
                    }
                }
            }
        }