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 && JMMServerVM.Instance.CurrentUser.EvaluateAnime(ep.AniDB_Anime)) { ep.SetTvDBInfo(); EpsWatchedRecently.Add(ep); } } ViewEpsWatchedRecently.Refresh(); }); } 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 <VM_AnimeEpisode_User> epContracts = VM_ShokoServer.Instance.ShokoServices.GetEpisodesRecentlyWatched(VM_UserSettings.Instance.Dash_RecentlyWatchedEp_Items, VM_ShokoServer.Instance.CurrentUser.JMMUserID).CastList <VM_AnimeEpisode_User>(); System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate { foreach (VM_AnimeEpisode_User ep in epContracts) { ep.RefreshAnime(); if (ep.AniDB_Anime == null) { ep.RefreshAnime(true); // this might be a new series } if (ep.AniDB_Anime != null && VM_ShokoServer.Instance.CurrentUser.EvaluateAnime(ep.AniDB_Anime)) { ep.SetTvDBInfo(); EpsWatchedRecently.Add(ep); } } ViewEpsWatchedRecently.Refresh(); }); } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
public void RefreshData(bool refreshContinueWatching, bool refreshRecentAdditions, bool refreshOtherWidgets, RecentAdditionsType addType) { try { IsLoadingData = true; // clear all displayed data System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate() { if (refreshContinueWatching) { EpsWatchNext_Recent.Clear(); } if (refreshRecentAdditions) { RecentAdditions.Clear(); } if (refreshOtherWidgets) { SeriesMissingEps.Clear(); EpsWatchedRecently.Clear(); MiniCalendar.Clear(); RecommendationsWatch.Clear(); RecommendationsDownload.Clear(); } if (refreshOtherWidgets) { ViewEpsWatchedRecently.Refresh(); ViewSeriesMissingEps.Refresh(); ViewMiniCalendar.Refresh(); ViewRecommendationsWatch.Refresh(); ViewRecommendationsDownload.Refresh(); ViewRecentAdditions.Refresh(); } if (refreshContinueWatching) { ViewEpsWatchNext_Recent.Refresh(); } if (refreshRecentAdditions) { ViewRecentAdditions.Refresh(); } }); DateTime start = DateTime.Now; MainListHelperVM.Instance.RefreshGroupsSeriesData(); TimeSpan ts = DateTime.Now - start; logger.Trace("Dashboard Time: RefreshGroupsSeriesData: {0}", ts.TotalMilliseconds); if (refreshContinueWatching && UserSettingsVM.Instance.DashWatchNextEpExpanded) { RefreshEpsWatchNext_Recent(); } if (refreshRecentAdditions && UserSettingsVM.Instance.DashRecentAdditionsExpanded) { RefreshRecentAdditions(addType); } if (refreshOtherWidgets) { if (UserSettingsVM.Instance.DashRecentlyWatchEpsExpanded) { RefreshRecentlyWatchedEps(); } if (UserSettingsVM.Instance.DashSeriesMissingEpisodesExpanded) { RefreshSeriesMissingEps(); } if (UserSettingsVM.Instance.DashMiniCalendarExpanded) { RefreshMiniCalendar(); } if (UserSettingsVM.Instance.DashRecommendationsWatchExpanded) { RefreshRecommendationsWatch(); } if (UserSettingsVM.Instance.DashRecommendationsDownloadExpanded) { RefreshRecommendationsDownload(); } } IsLoadingData = false; } catch (Exception ex) { Utils.ShowErrorMessage(ex); } finally { } }