public FileTypeSelectionWindow(AxDVRMVPlayerCtrl playerCtr) { this.InitializeComponent(); _playerCtr = playerCtr; // 在此点之下插入创建对象所需的代码。 }
void PreviewVideoWin_Loaded(object sender, RoutedEventArgs e) { Storyboard warningsb = this.FindResource("Storyboard1") as Storyboard; warningsb.Begin(); playerCtr = new AxDVRMVPlayerCtrl(); _host = new WindowsFormsHost(); playerCtr.Width = (int)_playGrid.ActualWidth; playerCtr.Height = (int)_playGrid.ActualHeight; playerCtr.BeginInit(); _host.Child = playerCtr; playerCtr.EndInit(); _playGrid.Children.Add(_host); _playGrid.Visibility = Visibility.Collapsed; Thread t = new Thread(new ThreadStart(delegate { string temp = System.Environment.GetEnvironmentVariable("TEMP") + "\\"; string [] tempArray = downLoadUrl.Split('/'); string filename = tempArray[tempArray.Length - 1]; filename = filename.Substring(0, filename.IndexOf('.')); filename = filename + "_" + DateTime.Now.ToFileTimeUtc().ToString() + ".vs"; temp += filename; saveFullName = temp; //download file bool bRet = DownloadFile( downLoadUrl, saveFullName); warningsb = this.FindResource("Storyboard1") as Storyboard; warningsb.Stop(); if (bRet == false) { this.Dispatcher.Invoke(new Action(delegate { _info.Text = "下载失败"; }), null); return; } this.Dispatcher.Invoke(new Action(delegate { _playGrid.Visibility = Visibility.Visible; playerCtr.SplitWindow(1); playerCtr.OpenFile(saveFullName); }), null); })); t.Start(); }