Beispiel #1
0
        private void lblExit_Click(object sender, EventArgs e)
        {
            if (isDownloading)
            {
                ctsDownload.Cancel(false);

                DownloadItemManager.toDeleteFiles.Add(pathToVideo);
                DownloadItemManager.StartTimer();
            }

            if (isConverting)
            {
                //Cancel the convert task
                ctsConvert.Cancel(false);
                FFMpegConverter.Abort();

                DownloadItemManager.toDeleteFiles.Add(pathToSong);
                DownloadItemManager.StartTimer();
            }



            this.Dispose();
            if (isHistory)
            {
                BLHistory.RemoveRecord(historyRecord);
                UCHistory.RepositionDownloadItems();
            }
            else
            {
                DownloadItemManager.RepositionDownloadItems();
            }
        }
 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();
     }
 }
Beispiel #3
0
 protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
 {
     //Capture ctrl+v events
     if (keyData == (Keys.Control | Keys.V) && btnDownloads.selected)
     {
         DownloadItemManager.AddDownloadItem(Clipboard.GetText(), ucDownloads.pnlVideos);
         return(true);
     }
     return(base.ProcessCmdKey(ref msg, keyData));
 }
        private void bnLoadList_Click(object sender, EventArgs e)
        {
            string path = FSManager.Files.GetSelectedFileWithPath("Text Files", "*.txt");

            if (!string.IsNullOrEmpty(path))
            {
                string commaSeperatedVideoUrls = File.ReadAllText(path);

                foreach (string url in commaSeperatedVideoUrls.Split(','))
                {
                    DownloadItemManager.AddDownloadItem(url, pnlVideos);
                }
            }
        }
        private void btnPaste_Click(object sender, EventArgs e)
        {
            DownloadItem item = DownloadItemManager.AddDownloadItem(Clipboard.GetText(), pnlVideos);


            pnlLoading.Visible = false;
            lblLoading.Visible = false;

            if (BLSettings.IsAutomaticDownload)
            {
                if (item != null)
                {
                    toAutoDownloadVideos.Add(item);
                }

                tmrDownload.Start();
            }
        }
        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);
                }
            }
        }
 public static void RepositionDownloadItems()
 {
     DownloadItemManager.RepositionDownloadItems(items);
 }