void shoutsWorker_DoWork(object sender, DoWorkEventArgs e) { AnimeSeriesVM ser = e.Argument as AnimeSeriesVM; List <Trakt_ShoutUserVM> tempShouts = new List <Trakt_ShoutUserVM>(); try { System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate() { Shouts.Clear(); }); // get shouts from trakt List <JMMServerBinary.Contract_Trakt_ShoutUser> rawShouts = JMMServerVM.Instance.clientBinaryHTTP.GetTraktShoutsForAnime(ser.AniDB_ID); foreach (JMMServerBinary.Contract_Trakt_ShoutUser contract in rawShouts) { Trakt_ShoutUserVM shout = new Trakt_ShoutUserVM(contract); shout.DelayedUserImage = @"/Images/blankposter.png"; System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate() { Shouts.Add(shout); }); imagesToDownload.Add(shout); } // get recommendations from AniDB List <JMMServerBinary.Contract_AniDB_Recommendation> rawRecs = JMMServerVM.Instance.clientBinaryHTTP.GetAniDBRecommendations(ser.AniDB_ID); foreach (JMMServerBinary.Contract_AniDB_Recommendation contract in rawRecs) { AniDB_RecommendationVM rec = new AniDB_RecommendationVM(contract); rec.DelayedUserImage = @"/Images/blankposter.png"; System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate() { Shouts.Add(rec); }); imagesToDownload.Add(rec); } } catch (Exception ex) { logger.ErrorException(ex.ToString(), ex); } }
private void RefreshData() { AnimeSeriesVM ser = this.DataContext as AnimeSeriesVM; if (ser == null) { return; } ser.RefreshBase(); UnwatchedEpisodeCount = ser.UnwatchedEpisodeCount; UnwatchedEpisodes.Clear(); Recommendations.Clear(); Shouts.Clear(); RefreshUnwatchedEpisodes(); }