public void SelectDetailsVideo(VideoViewModel videoModel) { if (BackgroundTask.Instance.IsExecuting) return; BackgroundTask.Instance.Start<List<string>>( () => { return SelectedSite.Site.GetMultipleVideoUrls(videoModel.VideoInfo); }, (success, urls) => { if (success) { Helpers.UriUtils.RemoveInvalidUrls(urls); // if no valid urls were returned show error msg if (urls == null || urls.Count == 0) { ServiceRegistration.Get<IDialogManager>().ShowDialog("[OnlineVideos.Error]", "[OnlineVideos.UnableToPlayVideo]", DialogType.OkDialog, false, DialogButtonType.Ok); } else { SelectedDetailsVideo = videoModel; SelectedDetailsVideo.ChoosePlaybackOptions(urls[0], (url) => { urls[0] = url; SelectedDetailsVideo.Play(urls); }); } } }, Translation.Instance.GettingPlaybackUrlsForVideo); }
public void SelectDetailsVideo(VideoViewModel videoModel) { if (BackgroundTask.Instance.IsExecuting) { return; } BackgroundTask.Instance.Start <List <string> >( () => { return(SelectedSite.Site.GetMultipleVideoUrls(videoModel.VideoInfo)); }, (success, urls) => { if (success) { if (SelectedSite.Site.Settings.Player != PlayerType.Browser) { Helpers.UriUtils.RemoveInvalidUrls(urls); } // if no valid urls were returned show error msg if (urls == null || urls.Count == 0) { ServiceRegistration.Get <IDialogManager>().ShowDialog("[OnlineVideos.Error]", "[OnlineVideos.UnableToPlayVideo]", DialogType.OkDialog, false, DialogButtonType.Ok); } else { SelectedDetailsVideo = videoModel; SelectedDetailsVideo.ChoosePlaybackOptions(urls[0], (url) => { urls[0] = url; SelectedDetailsVideo.Play(urls); }); } } }, Translation.Instance.GettingPlaybackUrlsForVideo); }
public void SelectVideo(VideoViewModel videoModel) { if (BackgroundTask.Instance.IsExecuting) return; if (videoModel.VideoInfo == null) { // discover and append next page videos BackgroundTask.Instance.Start<List<VideoInfo>>( () => { return SelectedSite.Site.GetNextPageVideos(); }, (success, nextPageVideos) => { if (success) { VideosList.Remove(videoModel); int selectNr = VideosList.Count; nextPageVideos.ForEach(r => { r.CleanDescriptionAndTitle(); VideosList.Add(new VideoViewModel(r, SelectedCategory != null ? SelectedCategory.Category : null, SelectedSite.Name, SelectedSite.Site.Settings.UtilName, false) { Selected = VideosList.Count == selectNr }); }); if (SelectedSite.Site.HasNextPage) VideosList.Add(new VideoViewModel(Translation.Instance.NextPage, "NextPage.png")); VideosList.FireChange(); ImageDownloader.GetImages<VideoInfo>(nextPageVideos); } }, Translation.Instance.GettingNextPageVideos); } else { if (SelectedSite.Site is Sites.IChoice && videoModel.VideoInfo.HasDetails) { // get details videos and show details view BackgroundTask.Instance.Start<List<DetailVideoInfo>>( () => { return ((Sites.IChoice)SelectedSite.Site).GetVideoChoices(videoModel.VideoInfo); }, (success, choices) => { if (success) { SelectedVideo = videoModel; ShowDetails(choices); } }, Translation.Instance.GettingVideoDetails); } else { // get playback urls and play or show dialog to select playback options BackgroundTask.Instance.Start<List<string>>( () => { return SelectedSite.Site.GetMultipleVideoUrls(videoModel.VideoInfo); }, (success, urls) => { if (success) { Helpers.UriUtils.RemoveInvalidUrls(urls); // if no valid urls were returned show error msg if (urls == null || urls.Count == 0) { ServiceRegistration.Get<IDialogManager>().ShowDialog("[OnlineVideos.Error]", "[OnlineVideos.UnableToPlayVideo]", DialogType.OkDialog, false, DialogButtonType.Ok); } else { SelectedVideo = videoModel; SelectedVideo.ChoosePlaybackOptions(urls[0], (url) => { urls[0] = url; SelectedVideo.Play(urls); }); } } }, Translation.Instance.GettingPlaybackUrlsForVideo); } } }
public void SelectVideo(VideoViewModel videoModel) { if (BackgroundTask.Instance.IsExecuting) { return; } if (videoModel.VideoInfo == null) { // discover and append next page videos BackgroundTask.Instance.Start <List <VideoInfo> >( () => { return(SelectedSite.Site.GetNextPageVideos()); }, (success, nextPageVideos) => { if (success) { VideosList.Remove(videoModel); int selectNr = VideosList.Count; nextPageVideos.ForEach(r => { r.CleanDescriptionAndTitle(); VideosList.Add(new VideoViewModel(r, SelectedCategory != null ? SelectedCategory.Category : null, SelectedSite.Site.Settings, false) { Selected = VideosList.Count == selectNr }); }); if (SelectedSite.Site.HasNextPage) { VideosList.Add(new VideoViewModel(Translation.Instance.NextPage, "NextPage.png")); } VideosList.FireChange(); ImageDownloader.GetImages <VideoInfo>(nextPageVideos); } }, Translation.Instance.GettingNextPageVideos); } else { if (SelectedSite.Site is Sites.IChoice && videoModel.VideoInfo.HasDetails) { // get details videos and show details view BackgroundTask.Instance.Start <List <DetailVideoInfo> >( () => { return(((Sites.IChoice)SelectedSite.Site).GetVideoChoices(videoModel.VideoInfo)); }, (success, choices) => { if (success) { SelectedVideo = videoModel; ShowDetails(choices); } }, Translation.Instance.GettingVideoDetails); } else { // get playback urls and play or show dialog to select playback options BackgroundTask.Instance.Start <List <string> >( () => { return(SelectedSite.Site.GetMultipleVideoUrls(videoModel.VideoInfo)); }, (success, urls) => { if (success) { if (SelectedSite.Site.Settings.Player != PlayerType.Browser) { Helpers.UriUtils.RemoveInvalidUrls(urls); } // if no valid urls were returned show error msg if (urls == null || urls.Count == 0) { ServiceRegistration.Get <IDialogManager>().ShowDialog("[OnlineVideos.Error]", "[OnlineVideos.UnableToPlayVideo]", DialogType.OkDialog, false, DialogButtonType.Ok); } else { SelectedVideo = videoModel; SelectedVideo.ChoosePlaybackOptions(urls[0], (url) => { urls[0] = url; SelectedVideo.Play(urls); }); } } }, Translation.Instance.GettingPlaybackUrlsForVideo); } } }