DownloadVideo() public static method

public static DownloadVideo ( YouTubeVideoModel vidDownloader ) : void
vidDownloader YouTubeVideoModel
return void
Ejemplo n.º 1
0
 private void DownloadVideo(YouTubeVideoModel videoDownloader)
 {
     try
     {
         //Store VideoInfo object in model
         videoDownloader.VideoInfo = FileDownloader.GetVideoInfos(videoDownloader);
         //Stores VideoInfo object in model
         videoDownloader.Video = FileDownloader.GetVideoInfo(videoDownloader);
         UpdateLabel(videoDownloader.Video.Title + videoDownloader.Video.VideoExtension);
         //Stores FilePath in model
         videoDownloader.FilePath  = FileDownloader.GetPath(videoDownloader);
         videoDownloader.FilePath += videoDownloader.Video.VideoExtension;
         //Stores VideoDownloaderType object in model
         videoDownloader.VideoDownloaderType = FileDownloader.GetVideoDownloader(videoDownloader);
         //stop timer after download
         videoDownloader.VideoDownloaderType.DownloadFinished += (sender, args) => timer1.Stop();
         //Enable interface once download is complete
         videoDownloader.VideoDownloaderType.DownloadFinished += (sender, args) => EnableAccessibility();
         //open folder with downloaded file selected
         videoDownloader.VideoDownloaderType.DownloadFinished        += (sender, args) => OpenFolder(videoDownloader.FilePath);
         videoDownloader.VideoDownloaderType.DownloadProgressChanged += (sender, args) => pgDownload.Value = (int)args.ProgressPercentage;
         CheckForIllegalCrossThreadCalls = false;
         //download video
         FileDownloader.DownloadVideo(videoDownloader);
     }
     catch (Exception)
     {
         MessageBox.Show("Download canceled.");
         EnableAccessibility();
     }
 }
Ejemplo n.º 2
0
        // Download the video
        private void DownloadVideo(YouTubeVideo video)
        {
            try
            {
                // Get video information
                video.VideoInfo           = FileDownloader.GetVideoInfos(video);
                video.Video               = FileDownloader.GetVideoInfo(video);
                lblFileDownloading.Text   = video.Video.Title;
                video.FilePath            = FileDownloader.GetPath(video) + video.Video.VideoExtension;
                video.VideoDownloaderType = FileDownloader.GetVideoDownloader(video);

                // Open file location
                video.VideoDownloaderType.DownloadFinished += (sender, args) => OpenFolder(video.FilePath);

                // Download bar
                video.VideoDownloaderType.DownloadProgressChanged +=
                    (sender, args) => pgDownload.Value             = (int)args.ProgressPercentage;
                video.VideoDownloaderType.DownloadProgressChanged +=
                    (sender, args) => lblPercent.Text              = ((int)args.ProgressPercentage).ToString() + "%";

                // Allow user to use the UI after download is finished
                video.VideoDownloaderType.DownloadFinished += (sender, args) => EnableUI();

                CheckForIllegalCrossThreadCalls = false;

                // Download
                FileDownloader.DownloadVideo(video);
            }
            catch (Exception)
            {
                EnableUI();
                lblValidation.Text = "Error Downloading Video";
            }
        }
Ejemplo n.º 3
0
 private void Download(string validatedLink)
 {
     if (cboFileType.SelectedIndex == 0) //user wants to download video
     {
         YouTubeVideoModel videoDownloader = new YouTubeVideoModel();
         videoDownloader.Link       = validatedLink;
         videoDownloader.FolderPath = txtDownloadFolder.Text;
         FileDownloader.DownloadVideo(videoDownloader);
     }
 }
Ejemplo n.º 4
0
 private void DownloadVideo(YouTubeVideoModel videoDownloader)
 {
     try
     {
         //Store VideoInfo object in model
         videoDownloader.VideoInfo = FileDownloader.GetVideoInfos(videoDownloader);
         //Stores VideoInfo object in model
         videoDownloader.Video = FileDownloader.GetVideoInfo(videoDownloader);
         //Stores FilePath in model
         videoDownloader.FilePath  = FileDownloader.GetPath(videoDownloader);
         videoDownloader.FilePath += videoDownloader.Video.VideoExtension;
         //Stores VideoDownloaderType object in model
         videoDownloader.VideoDownloaderType = FileDownloader.GetVideoDownloader(videoDownloader);
         //Download video
         FileDownloader.DownloadVideo(videoDownloader);
     }
     catch (Exception)
     {
         MessageBox.Show("Download canceled.");
         EnableAccessibility();
     }
 }