private async void btnDownloadAll_Click(object sender, EventArgs e) { foreach (DownloadItem item in DownloadItemManager.GetDownloadItems().Where(dl => !dl.isRunning && dl.isReady)) //Start all non-running ones { item.Download(); } }
private void btnSaveList_Click(object sender, EventArgs e) { string commaSeperatedString = ""; string path; foreach (DownloadItem video in DownloadItemManager.GetDownloadItems()) { if (video.theVideo != null) { commaSeperatedString += "https://www.youtube.com/watch?v=" + video.theVideo.Id + ","; } } if (!string.IsNullOrEmpty(commaSeperatedString)) { path = GetSelectedPathWithFileName(); if (!string.IsNullOrEmpty(path)) { commaSeperatedString = commaSeperatedString.Substring(0, commaSeperatedString.Length - 1); File.WriteAllText(path, commaSeperatedString); } } }