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();
}
关闭流程 要搞得详细一些,一个一个的关闭,要有顺序。
为神马卡住了 因为你的直接走了最后一步,中间好几部省了,所以他需要一些时间处理关闭之前的事