public static void TestDownloadSubtitelAsync() { var v = new VideoDetails(); v.Titel = "Difference between LOOK, WATCH & SEE - Learn English Grammar"; v.VideoPath = "C:\\Users\\aola\\Desktop\\Download\\"; v.VideoID = "JkURo4oTKNk"; //JkURo4oTKNk for (int i = 0; i < 10; i++) { using (FetchSubtitelURL sub = new FetchSubtitelURL()) { //sub.DownloadSubtitel(v,); } } }
private void Downloader_DownloadFinished(object sender, EventArgs e) { Dispatcher.CurrentDispatcher.Invoke((Action)async delegate // <--- HERE { var videoInfo = ((VideoDownloader)sender).Video; var video = VideoDetails.FirstOrDefault(a => a.Titel == videoInfo.Title); if (video != null) { if (video.ProgressPercentage == 100) { if (video.CaptionTracksEnabled) { using (FetchSubtitelURL sub = new FetchSubtitelURL()) sub.DownloadSubtitel(video, videoInfo.ListCaptionTracks); } video.DownlaodStatus = DownlaodStatus.End; } else { video.DownlaodStatus = DownlaodStatus.Cancel; } await Loging.SaveList(VideoDetails); if (IsDownloadAll && video.ProgressPercentage == 100) { startDownload(false); } } }); //Thread t = new Thread(() => { // w = new NotificationWin(); // w.Show(); //}); //t.SetApartmentState(ApartmentState.STA); //t.Start(); }