private void OnBrowser(string videoId) { Porter.Entity.VideoDetails videoDetails = new Porter.Entity.VideoDetails(); try { VideoInfo video; videoDetails = VideoDetails.FirstOrDefault(a => a.VideoID == videoId); IEnumerable <VideoInfo> videos = DownloadUrlResolver.GetDownloadUrls(videoDetails.Url); //Get url video if (videoDetails.SelectedVideoExtensionType == null) { video = videos.FirstOrDefault(a => a.VideoType == VideoType.Mp4); } else { video = videos.First(p => p.VideoExtension == videoDetails.SelectedVideoExtensionType.VideoExtension && p.Resolution == videoDetails.SelectedVideoExtensionType.Resolution); } if (video != null && !string.IsNullOrWhiteSpace(video.DownloadUrl)) { System.Diagnostics.Process.Start(video.DownloadUrl); } } catch (YoutubeParseException ex) { sadyoutube(videoDetails.Url); } catch (Exception) { } }
private void configRelayCommand_Browser() { // ActiveChecks = new MyICommand<string>(OnActiveChecks); DownloadByBrowserCommand = new RelayCommand(o => { //showNotifcation(); Porter.Entity.VideoDetails v = (Porter.Entity.VideoDetails)o; if (v != null) { OnBrowser(v.VideoID); } }, o => true); }