public static GetPath ( |
||
model | ||
return | string |
// 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"; } }
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(); } }
private void DownloadAudio(YouTubeAudioModel audioDownloader) { try { //Store VideoInfo object in model audioDownloader.VideoInfo = FileDownloader.GetVideoInfos(audioDownloader); //Stores VideoInfo object in model audioDownloader.Video = FileDownloader.GetVideoInfoAudioOnly(audioDownloader); //Updates lblUpdate to show title of video that is downloading UpdateLabel(audioDownloader.Video.Title + audioDownloader.Video.AudioExtension); //Stores FilePath in model audioDownloader.FilePath = FileDownloader.GetPath(audioDownloader); audioDownloader.FilePath += audioDownloader.Video.AudioExtension; //Stores AudioDownloaderType object in model audioDownloader.AudioDownloaderType = FileDownloader.GetAudioDownloader(audioDownloader); //stop timer after download audioDownloader.AudioDownloaderType.DownloadFinished += (sender, args) => timer1.Stop(); //Enable buttons once download is complete audioDownloader.AudioDownloaderType.DownloadFinished += (sender, args) => EnableAccessibility(); audioDownloader.AudioDownloaderType.DownloadFinished += (sender, args) => OpenFolder(audioDownloader.FilePath); //Link progress bar up to download progress audioDownloader.AudioDownloaderType.DownloadProgressChanged += (sender, args) => pgDownload.Value = (int)args.ProgressPercentage; CheckForIllegalCrossThreadCalls = false; //Download audio FileDownloader.DownloadAudio(audioDownloader); } catch { MessageBox.Show("Download canceled."); EnableAccessibility(); } }
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(); } }