void btnTvDBLinkAdd_Click(object sender, RoutedEventArgs e) { try { // get the current tvdb link AnimeEpisodeVM ep = this.DataContext as AnimeEpisodeVM; ep.RefreshAnime(); if (ep.AniDB_Anime == null || ep.AniDB_Anime.TvSummary == null || ep.AniDB_Anime.TvSummary.CrossRefTvDBV2 == null || ep.AniDB_Anime.TvSummary.CrossRefTvDBV2.Count == 0) { Utils.ShowErrorMessage(Properties.Resources.EpisodeDetail_TvDBLink); return; } Window wdw = Window.GetWindow(this); this.Cursor = Cursors.Wait; SelectTvDBEpisodeForm frm = new SelectTvDBEpisodeForm(); frm.Owner = wdw; frm.Init(ep, ep.AniDB_Anime); bool?result = frm.ShowDialog(); if (result.Value) { // update info JMMServerBinary.Contract_AnimeEpisode contract = JMMServerVM.Instance.clientBinaryHTTP.GetEpisode( ep.AnimeEpisodeID, JMMServerVM.Instance.CurrentUser.JMMUserID.Value); if (contract != null) { ep.RefreshAnime(true); ep.Populate(contract); ep.SetTvDBInfo(); } } this.Cursor = Cursors.Arrow; } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
public void DisplayFiles() { try { AnimeEpisodeVM ep = this.DataContext as AnimeEpisodeVM; if (ep != null) { ep.RefreshFilesForEpisode(); ep.RefreshAnime(); fileSummary.DataContext = null; fileSummary.DataContext = ep.AniDB_Anime; lbFiles.ItemsSource = ep.FilesForEpisode; } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
void btnTvDBLinkRemove_Click(object sender, RoutedEventArgs e) { try { // get the current tvdb link AnimeEpisodeVM ep = this.DataContext as AnimeEpisodeVM; Window wdw = Window.GetWindow(this); this.Cursor = Cursors.Wait; string res = JMMServerVM.Instance.clientBinaryHTTP.RemoveLinkAniDBTvDBEpisode(ep.AniDB_EpisodeID); if (res.Length > 0) { this.Cursor = Cursors.Arrow; Utils.ShowErrorMessage(res); return; } // update info JMMServerBinary.Contract_AnimeEpisode contract = JMMServerVM.Instance.clientBinaryHTTP.GetEpisode( ep.AnimeEpisodeID, JMMServerVM.Instance.CurrentUser.JMMUserID.Value); if (contract != null) { ep.RefreshAnime(true); ep.Populate(contract); ep.SetTvDBInfo(); } this.Cursor = Cursors.Arrow; } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
public void RefreshNewEpisodes() { try { System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action)delegate() { NewEpisodes.Clear(); }); List<JMMServerBinary.Contract_AnimeEpisode> epContracts = JMMServerVM.Instance.clientBinaryHTTP.GetEpisodesRecentlyAddedSummary(UserSettingsVM.Instance.DashMetro_NewEpisodes_Items, JMMServerVM.Instance.CurrentUser.JMMUserID.Value); foreach (JMMServerBinary.Contract_AnimeEpisode contract in epContracts) { AnimeEpisodeVM ep = new AnimeEpisodeVM(contract); ep.RefreshAnime(); if (ep.AniDB_Anime == null) ep.RefreshAnime(true); // this might be a new series if (ep.AniDB_Anime != null) { //ep.SetTvDBInfo(); string imageName = ""; if (AppSettings.DashMetroImageType == DashboardMetroImageType.Fanart) imageName = ep.AnimeSeries.AniDB_Anime.FanartPath; else imageName = ep.AnimeSeries.AniDB_Anime.PosterPathWithRandoms; NewEpisodeTile tile = new NewEpisodeTile() { EpisodeDetails = ep.EpisodeNumberAndName, AnimeName = ep.AnimeSeries.SeriesName, Picture = imageName, AnimeSeries = ep.AnimeSeries, TileSize = "Large", Height = 100 }; System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action)delegate() { NewEpisodes.Add(tile); }); } } OnFinishedProcess(new FinishedProcessEventArgs(DashboardMetroProcessType.NewEpisodes)); } catch (Exception ex) { logger.ErrorException(ex.ToString(), ex); } finally { } }
public void RefreshContinueWatching() { try { System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action)delegate() { ContinueWatching.Clear(); }); DateTime start = DateTime.Now; List<JMMServerBinary.Contract_AnimeEpisode> epContracts = JMMServerVM.Instance.clientBinaryHTTP.GetContinueWatchingFilter(JMMServerVM.Instance.CurrentUser.JMMUserID.Value, UserSettingsVM.Instance.DashMetro_WatchNext_Items); TimeSpan ts = DateTime.Now - start; logger.Trace("Dashboard Time: RefreshEpsWatchNext_Recent: contracts: {0}", ts.TotalMilliseconds); start = DateTime.Now; List<AnimeEpisodeVM> epList = new List<AnimeEpisodeVM>(); foreach (JMMServerBinary.Contract_AnimeEpisode contract in epContracts) { AnimeEpisodeVM ep = new AnimeEpisodeVM(contract); string animename = ep.AnimeName; // just do this to force anidb anime detail record to be loaded ep.RefreshAnime(); if (ep.AniDB_Anime == null) ep.RefreshAnime(true); // this might be a new series epList.Add(ep); } ts = DateTime.Now - start; logger.Trace("Dashboard Time: RefreshEpsWatchNext_Recent: episode details: {0}", ts.TotalMilliseconds); System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action)delegate() { foreach (AnimeEpisodeVM ep in epList) { string imageName = ""; if (AppSettings.DashMetroImageType == DashboardMetroImageType.Fanart) imageName = ep.AniDB_Anime.FanartPathPreferThumb; else imageName = ep.AniDB_Anime.PosterPathWithRandoms; ContinueWatching.Add(new ContinueWatchingTile() { EpisodeDetails = ep.EpisodeNumberAndName, AnimeName = ep.AnimeSeries.SeriesName, Picture = imageName, AnimeSeries = ep.AnimeSeries, UnwatchedEpisodes = ep.AnimeSeries.UnwatchedEpisodeCount, TileSize = "Large", Height = 100 }); } ViewContinueWatching.Refresh(); }); OnFinishedProcess(new FinishedProcessEventArgs(DashboardMetroProcessType.ContinueWatching)); } catch (Exception ex) { Utils.ShowErrorMessage(ex); } finally { } }
public void RefreshRecentlyWatchedEps() { try { System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action)delegate() { EpsWatchedRecently.Clear(); }); List<JMMServerBinary.Contract_AnimeEpisode> epContracts = JMMServerVM.Instance.clientBinaryHTTP.GetEpisodesRecentlyWatched(UserSettingsVM.Instance.Dash_RecentlyWatchedEp_Items, JMMServerVM.Instance.CurrentUser.JMMUserID.Value); System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action)delegate() { foreach (JMMServerBinary.Contract_AnimeEpisode contract in epContracts) { AnimeEpisodeVM ep = new AnimeEpisodeVM(contract); ep.RefreshAnime(); if (ep.AniDB_Anime == null) ep.RefreshAnime(true); // this might be a new series if (ep.AniDB_Anime != null && JMMServerVM.Instance.CurrentUser.EvaluateAnime(ep.AniDB_Anime)) { ep.SetTvDBInfo(); EpsWatchedRecently.Add(ep); } } ViewEpsWatchedRecently.Refresh(); }); } catch (Exception ex) { Utils.ShowErrorMessage(ex); } finally { } }
public void RefreshRecentAdditions(RecentAdditionsType addType) { try { System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action)delegate() { RecentAdditions.Clear(); }); if (addType == RecentAdditionsType.Episode) { List<JMMServerBinary.Contract_AnimeEpisode> epContracts = JMMServerVM.Instance.clientBinaryHTTP.GetEpisodesRecentlyAdded(UserSettingsVM.Instance.Dash_RecentAdditions_Items, JMMServerVM.Instance.CurrentUser.JMMUserID.Value); System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action)delegate() { foreach (JMMServerBinary.Contract_AnimeEpisode contract in epContracts) { AnimeEpisodeVM ep = new AnimeEpisodeVM(contract); ep.RefreshAnime(); if (ep.AniDB_Anime == null) ep.RefreshAnime(true); // this might be a new series if (ep.AniDB_Anime != null) { ep.SetTvDBInfo(); RecentAdditions.Add(ep); } } ViewRecentAdditions.Refresh(); }); } else { List<JMMServerBinary.Contract_AnimeSeries> serContracts = JMMServerVM.Instance.clientBinaryHTTP.GetSeriesRecentlyAdded(UserSettingsVM.Instance.Dash_RecentAdditions_Items, JMMServerVM.Instance.CurrentUser.JMMUserID.Value); System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action)delegate() { foreach (JMMServerBinary.Contract_AnimeSeries contract in serContracts) { AnimeSeriesVM ser = new AnimeSeriesVM(contract); RecentAdditions.Add(ser); } ViewRecentAdditions.Refresh(); }); } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } finally { } }
public void RefreshEpsWatchNext_Recent() { try { System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action)delegate() { EpsWatchNext_Recent.Clear(); }); DateTime start = DateTime.Now; List<JMMServerBinary.Contract_AnimeEpisode> epContracts = JMMServerVM.Instance.clientBinaryHTTP.GetContinueWatchingFilter(JMMServerVM.Instance.CurrentUser.JMMUserID.Value, UserSettingsVM.Instance.Dash_WatchNext_Items); TimeSpan ts = DateTime.Now - start; logger.Trace("Dashboard Time: RefreshEpsWatchNext_Recent: contracts: {0}", ts.TotalMilliseconds); start = DateTime.Now; List<AnimeEpisodeVM> epList = new List<AnimeEpisodeVM>(); foreach (JMMServerBinary.Contract_AnimeEpisode contract in epContracts) { AnimeEpisodeVM ep = new AnimeEpisodeVM(contract); string animename = ep.AnimeName; // just do this to force anidb anime detail record to be loaded if (ep.AniDB_Anime == null) ep.RefreshAnime(true); // this might be a new series ts = DateTime.Now - start; logger.Trace("Dashboard Time: RefreshEpsWatchNext_Recent: episode details: Stage 1: {0}", ts.TotalMilliseconds); ep.RefreshAnime(); ts = DateTime.Now - start; logger.Trace("Dashboard Time: RefreshEpsWatchNext_Recent: episode details: Stage 2: {0}", ts.TotalMilliseconds); ep.SetTvDBInfo(); ts = DateTime.Now - start; logger.Trace("Dashboard Time: RefreshEpsWatchNext_Recent: episode details: Stage 3: {0}", ts.TotalMilliseconds); epList.Add(ep); } ts = DateTime.Now - start; logger.Trace("Dashboard Time: RefreshEpsWatchNext_Recent: episode details: {0}", ts.TotalMilliseconds); System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action)delegate() { foreach (AnimeEpisodeVM ep in epList) { EpsWatchNext_Recent.Add(ep); } ViewEpsWatchNext_Recent.Refresh(); }); } catch (Exception ex) { Utils.ShowErrorMessage(ex); } finally { } }
public List <string> GetParms() { List <string> parms = new List <string>(); if (searchType == DownloadSearchType.Episode) { AnimeEpisodeVM ep = searchParameter as AnimeEpisodeVM; if (ep.AniDB_Anime == null) { ep.RefreshAnime(); } AniDB_AnimeVM anime = ep.AniDB_Anime; if (anime == null) { return(parms); } // only use the first 2 words of the anime's title string[] titles = anime.MainTitle.Split(' '); int i = 0; foreach (string s in titles) { i++; parms.Add(s.Trim()); if (i == 2) { break; } } parms.Add(ep.EpisodeNumber.ToString().PadLeft(2, '0')); } if (searchType == DownloadSearchType.Series) { AniDB_AnimeVM anime = searchParameter as AniDB_AnimeVM; // only use the first 2 words of the anime's title string[] titles = anime.MainTitle.Split(' '); int i = 0; foreach (string s in titles) { i++; parms.Add(s.Trim()); if (i == 2) { break; } } } if (searchType == DownloadSearchType.Manual) { string[] titles = searchParameter.ToString().Split(' '); foreach (string s in titles) { parms.Add(s.Trim()); } } return(parms); }
void searchWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { try { List <TorrentLinkVM> links = e.Result as List <TorrentLinkVM>; TorrentCount = links.Count; foreach (TorrentLinkVM link in links) { TorrentLinks.Add(link); } ViewTorrentLinks.Refresh(); List <GroupVideoQualityVM> vidQualListTemp = new List <GroupVideoQualityVM>(); if (CurrentSearchCriteria.SearchType == DownloadSearchType.Episode) { AnimeEpisodeVM ep = CurrentSearchCriteria.SearchParameter as AnimeEpisodeVM; if (ep.AniDB_Anime == null) { ep.RefreshAnime(); } if (ep.AniDB_Anime != null) { List <JMMServerBinary.Contract_GroupVideoQuality> summ = JMMServerVM.Instance.clientBinaryHTTP.GetGroupVideoQualitySummary(ep.AniDB_Anime.AnimeID); foreach (JMMServerBinary.Contract_GroupVideoQuality contract in summ) { GroupVideoQualityVM vidQual = new GroupVideoQualityVM(contract); vidQualListTemp.Add(vidQual); } } } if (CurrentSearchCriteria.SearchType == DownloadSearchType.Series) { AniDB_AnimeVM anime = CurrentSearchCriteria.SearchParameter as AniDB_AnimeVM; if (anime != null) { List <JMMServerBinary.Contract_GroupVideoQuality> summ = JMMServerVM.Instance.clientBinaryHTTP.GetGroupVideoQualitySummary(anime.AnimeID); foreach (JMMServerBinary.Contract_GroupVideoQuality contract in summ) { GroupVideoQualityVM vidQual = new GroupVideoQualityVM(contract); vidQualListTemp.Add(vidQual); } } } ShowSubGroupSuggestions(vidQualListTemp); TorrentSearchStatus = string.Format("{0} Results", links.Count); } catch (Exception ex) { Utils.ShowErrorMessage(ex); } finally { this.Cursor = Cursors.Arrow; this.IsEnabled = true; } }