Exemple #1
0
        /// <summary>
        /// 把视频网格设置成行列格局
        /// </summary>
        /// <param name="rows"></param>
        /// <param name="columns"></param>
        public void SetShowMode(int rows, int columns)
        {
            if (rows > 0 && columns > 0)
            {
                _Rows    = rows;
                _Columns = columns;
                for (int i = _Videoes.Count; i < rows * columns; i++)
                {
                    VideoPanel video = VideoPanelFactory.CreatePanel();
                    video.AllowDrop    = true;
                    video.Name         = "actiVideoPanel" + i.ToString();
                    video.ShowTitle    = true;
                    video.StretchToFit = true;
                    video.VideoSource  = null;
                    this.Controls.Add(video);
                    video.Visible = true;
                    _Videoes.Add(video);
                }
                //只显示行列数,其它的隐藏
                for (int i = 0; i < _Videoes.Count; i++)
                {
                    _Videoes[i].Visible = i < rows * columns ? true : false;
                }

                LayoutVideoes();
            }
        }
        /// <summary>
        /// 创建视频窗口
        /// </summary>
        /// <param name="videoType"></param>
        /// <param name="name"></param>
        /// <param name="visible"></param>
        /// <returns></returns>
        private VideoPanel CreateVideoPanel(int videoType, string name, bool visible)
        {
            VideoPanel video = VideoPanelFactory.CreatePanel(videoType);

            video.AllowDrop              = true;
            video.Name                   = name;
            video.ShowTitle              = true;
            video.StretchToFit           = true;
            video.VideoSource            = null;
            video.Visible                = visible;
            video.VideoDragDropHandling -= VideoDragDropHandling;
            video.VideoDragDropHandling += VideoDragDropHandling;
            this.videoPanel.Controls.Add(video);
            return(video);
        }
Exemple #3
0
        public UCVideoListView()
        {
            InitializeComponent();

            VideoPanel video = VideoPanelFactory.CreatePanel();

            video.AllowDrop       = true;
            video.Name            = "actiVideoPanel0";
            video.ShowTitle       = true;
            video.StretchToFit    = true;
            video.VideoSource     = null;
            video.Visible         = true;
            video.Dock            = DockStyle.Fill;
            this.btnLeft.Visible  = false;
            this.btnRight.Visible = false;
            this.videoPanel.Controls.Add(video);
            _Videoes.Add(video);
            Clear();
        }
Exemple #4
0
        /// <summary>
        /// 在视频列表中显示一系列图片
        /// </summary>
        /// <param name="imgs"></param>
        public void ShowVideoes(List <VideoSourceInfo> videoes)
        {
            this.btnLeft.Visible  = !(videoes == null || videoes.Count <= 1);
            this.btnRight.Visible = !(videoes == null || videoes.Count <= 1);

            _ActiveVideoes.Clear();
            if (videoes != null)
            {
                for (int i = _Videoes.Count; i < videoes.Count; i++)
                {
                    VideoPanel video = VideoPanelFactory.CreatePanel();
                    video.AllowDrop    = true;
                    video.Name         = "actiVideoPanel" + i.ToString();
                    video.ShowTitle    = true;
                    video.StretchToFit = true;
                    video.VideoSource  = null;
                    this.videoPanel.Controls.Add(video);
                    _Videoes.Add(video);
                }
                foreach (VideoPanel vp in _Videoes)
                {
                    if (!videoes.Exists(v => v == vp.VideoSource))
                    {
                        if (vp.Status == VideoStatus.Playing)
                        {
                            vp.Close();
                        }
                        vp.VideoSource = null;
                    }
                }

                foreach (VideoSourceInfo vs in videoes)
                {
                    VideoPanel video = _Videoes.FirstOrDefault(vp => vp.VideoSource == vs);
                    if (video == null)
                    {
                        VideoPanel p = _Videoes.FirstOrDefault(vp => vp.VideoSource == null);
                        if (p != null)
                        {
                            p.VideoSource = vs;
                            _ActiveVideoes.Add(p);
                        }
                    }
                    else
                    {
                        _ActiveVideoes.Add(video);
                    }
                }
            }

            if (_ActiveVideoes.Count > 0)
            {
                _CurImageIndex = 0;
                ShowVideo(_CurImageIndex);
            }
            else
            {
                _CurImageIndex = -1;
                ShowVideo(_CurImageIndex);
            }
        }