private void VideoDragDropHandling(object sender, VideoSourceInfo video)
        {
            VideoPanel panel = sender as VideoPanel;

            if (panel != null)
            {
                int index = _Videoes.FindIndex(vp => vp == panel);
                if (index >= 0)
                {
                    RemoveVideoPanel(panel);

                    //视频类型不同的,重新创建视频
                    VideoPanel p = CreateVideoPanel(video.VideoSourceType, panel.Name, panel.Visible);
                    p.Left          = panel.Left;
                    p.Top           = panel.Top;
                    p.Width         = panel.Width;
                    p.Height        = panel.Height;
                    _Videoes[index] = p;

                    int aIndex = _ActiveVideoes.FindIndex(vp => vp == panel);
                    if (aIndex >= 0)
                    {
                        _ActiveVideoes[aIndex] = p;
                    }

                    p.VideoSource = video;
                    p.Play(true);
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// 显示并播放视频,如果视频已经在网格中,则播放它.如果已经打开的视频大于网格可以显示的最大视频数量,则超出的视频不会显示出来
        /// </summary>
        /// <param name="video"></param>
        public void RenderAndPlayVideo(VideoSourceInfo video)
        {
            VideoPanel p = _Videoes.SingleOrDefault(vp => vp.VideoSource == video);

            if (p != null)
            {
                p.Play(true);
            }
            else
            {
                p = _Videoes.FirstOrDefault(vp => vp.VideoSource == null);
                if (p != null)
                {
                    p.VideoSource = video;
                    p.Play(true);
                }
            }
        }