private void btnAdd_Click(object sender, RoutedEventArgs e) { string url = txtUrl.Text; if (Util.IsYoutubeVideoUrl(url)) { new YoutubeDownloadWnd(url, this).ShowDialog(); } else { try { DownloadTask dl = new DownloadTask(url).Initialize(); DlQueue.Add(dl); if (chkStartNow.IsChecked.HasValue && chkStartNow.IsChecked.Value) { string path = getSaveLocation(dl); if (path != null) { dl.DownloadAsync(path); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Oops! An error occured."); } } }