首页 新闻 会员 周边 捐助

播放器播放中 然后我按关闭窗口就会卡住

0
悬赏园豆:100 [已关闭问题] 关闭于 2013-03-06 16:19

private void tbVideo_Loaded(object sender, RoutedEventArgs e)
        {
           
            List<FileDownloadPath> vlist = new EncodeListManager().GetVideoListByProductID(this.productid);
            int count = 0;

            foreach (FileDownloadPath v in vlist)
            {
                StackPanel sp = new StackPanel { Orientation = Orientation.Vertical,Width=300,Height=300 };
                Label label = new Label { Content = v.Name,HorizontalAlignment=System.Windows.HorizontalAlignment.Center};
                WindowsFormsHost wfh = new WindowsFormsHost { Width = 200, Height = 173};
                //if (!v.URL.EndsWith(".mp4"))
                //{
                    WMPControl wmp = new WMPControl(); 

//WMPControl继承AxWindowsMediaPlayer
                    wmp.Player.URL = new Uri(v.URL).ToString();
                    wmp.Player.close();
                    wfh.Child = wmp;
                    sp.Children.Add(label);
                    sp.Children.Add(wfh);
                    wps.Add(wmp);
                 
                //}
                //else
                //{
                //    TIVCControl tivc = new TIVCControl();
                //    tivc.Player.URL = v.URL;
                //    wfh.Child = tivc;
                //    sp.Children.Add(label);
                //    sp.Children.Add(wfh);
                //}
                gridVideo.Children.Add(sp);
                if ((count++ % 4) == 0)
                {
                    gridVideo.RowDefinitions.Add(new RowDefinition());
                }
                Grid.SetColumn(sp, (count -1)% 4);
                Grid.SetRow(sp, (count-1) / 4);
            }
        }

 

 

private void Window_Closed(object sender, EventArgs e)
        {

          
            mediaVideo.Player.Dispose();

               
        }

求学求财的主页 求学求财 | 初学一级 | 园豆:6
提问于:2013-03-06 14:57
< >
分享
所有回答(1)
0

关闭流程 要搞得详细一些,一个一个的关闭,要有顺序。

为神马卡住了 因为你的直接走了最后一步,中间好几部省了,所以他需要一些时间处理关闭之前的事

zhibudao | 园豆:525 (小虾三级) | 2013-03-06 16:27
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册