public void RefreshRecommendationsDownload() { try { System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate { RecommendationsDownload.Clear(); }); List <VM_Recommendation> contracts = VM_ShokoServer.Instance.ShokoServices.GetRecommendations(VM_UserSettings.Instance.Dash_RecDownload_Items, VM_ShokoServer.Instance.CurrentUser.JMMUserID, (int)RecommendationType.Download).CastList <VM_Recommendation>(); System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate { foreach (VM_Recommendation contract in contracts) { RecommendationsDownload.Add(contract); } // add a dummy object so that we can display a prompt // for the user to sync thier votes if (RecommendationsDownload.Count == 0) { RecommendationsDownload.Add(new SyncVotesDummy()); } ViewRecommendationsDownload.Refresh(); }); } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
public void GetMissingRecommendationsDownload() { try { IsLoadingData = true; foreach (RecommendationVM rec in RecommendationsDownload) { if (rec.Recommended_AnimeInfoNotExists) { string result = JMMServerVM.Instance.clientBinaryHTTP.UpdateAnimeData(rec.RecommendedAnimeID); if (string.IsNullOrEmpty(result)) { JMMServerBinary.Contract_AniDBAnime animeContract = JMMServerVM.Instance.clientBinaryHTTP.GetAnime(rec.RecommendedAnimeID); System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Send, (Action) delegate() { rec.PopulateRecommendedAnime(animeContract); ViewRecommendationsDownload.Refresh(); }); } } } IsLoadingData = false; } catch (Exception ex) { Utils.ShowErrorMessage(ex); } finally { } }
public void RefreshRecommendationsDownload() { try { System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate { RecommendationsDownload.Clear(); }); List <VM_Recommendation> contracts = VM_ShokoServer.Instance.ShokoServices.GetRecommendations(VM_UserSettings.Instance.Dash_RecDownload_Items, VM_ShokoServer.Instance.CurrentUser.JMMUserID, (int)RecommendationType.Download).CastList <VM_Recommendation>(); System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate { foreach (VM_Recommendation contract in contracts) { RecommendationsDownload.Add(contract); } ViewRecommendationsDownload.Refresh(); }); } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
public void RefreshRecommendationsDownload() { try { System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate() { RecommendationsDownload.Clear(); }); List <JMMServerBinary.Contract_Recommendation> contracts = JMMServerVM.Instance.clientBinaryHTTP.GetRecommendations(UserSettingsVM.Instance.Dash_RecDownload_Items, JMMServerVM.Instance.CurrentUser.JMMUserID.Value, (int)RecommendationType.Download); System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate() { foreach (JMMServerBinary.Contract_Recommendation contract in contracts) { RecommendationVM rec = new RecommendationVM(); rec.Populate(contract); RecommendationsDownload.Add(rec); } // add a dummy object so that we can display a prompt // for the user to sync thier votes if (RecommendationsDownload.Count == 0) { RecommendationsDownload.Add(new SyncVotesDummy()); } ViewRecommendationsDownload.Refresh(); }); } catch (Exception ex) { Utils.ShowErrorMessage(ex); } finally { } }
public void GetMissingRecommendationsDownload() { try { IsLoadingData = true; foreach (object obj in RecommendationsDownload) { VM_Recommendation rec = obj as VM_Recommendation; if (rec == null) { continue; } if (!rec.Recommended_AnimeInfoExists) { string result = VM_ShokoServer.Instance.ShokoServices.UpdateAnimeData(rec.RecommendedAnimeID); if (string.IsNullOrEmpty(result)) { VM_AniDB_Anime anime = (VM_AniDB_Anime)VM_ShokoServer.Instance.ShokoServices.GetAnime(rec.RecommendedAnimeID); System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Send, (Action) delegate { rec.Recommended_AniDB_Anime = anime; ViewRecommendationsDownload.Refresh(); }); } } } IsLoadingData = false; } 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 { } }