private void AddVideoOptions(ProcessFilter processFilter) { List <string[]> videoQualityList = processFilter.GetVideoOutputs(); foreach (string[] qualityOption in videoQualityList) { VideoOutputs.Items.Add(new VideoOutput(qualityOption)); } VideoOutputs.SelectedIndex = 0; }
private async void PopulateOptions() { ProcessFilter processFilter = null; string thumbnailLocation = ""; string url = urlInput.Text; string title = ""; TB_VideoTitle.Content = ""; IMG_Thumbnail.Source = null; string query = "-F " + url; ProcessStartInfo info = GetDownloaderStartInfo(query); EnableBusyIndicator(); Task getTitle = new Task(() => { GetVideoTitle(url, out title); }); Task getQuality = new Task(() => { processFilter = new ProcessFilter(info); }); Task getThumb = new Task(() => { DownloadVideoThumbnail(url, out thumbnailLocation); }); getTitle.Start(); getThumb.Start(); getQuality.Start(); await Task.WhenAll(getTitle, getThumb, getQuality); TB_VideoTitle.Content = title; if (!string.IsNullOrEmpty(thumbnailLocation)) { IMG_Thumbnail.Source = new BitmapImage(new Uri(thumbnailLocation, UriKind.Absolute)); } if (processFilter != null) { AddVideoOptions(processFilter); PlaceholderPreview.Visibility = Visibility.Hidden; CheckAudioOptions(); } DisableBusyIndicator(); }