Ejemplo n.º 1
0
        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.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
            {
            }
        }
Ejemplo n.º 2
0
        public void RefreshNewEpisodes()
        {
            try
            {
                System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate {
                    NewEpisodes.Clear();
                });

                List <VM_AnimeEpisode_User> epContracts =
                    VM_ShokoServer.Instance.ShokoServices.GetEpisodesRecentlyAddedSummary(VM_UserSettings.Instance.DashMetro_NewEpisodes_Items, VM_ShokoServer.Instance.CurrentUser.JMMUserID).CastList <VM_AnimeEpisode_User>();

                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)
                    {
                        //ep.SetTvDBInfo();

                        var imageName = AppSettings.DashMetroImageType == DashboardMetroImageType.Fanart ? ep.AnimeSeries.AniDBAnime.AniDBAnime.FanartPath : ep.AnimeSeries.AniDBAnime.AniDBAnime.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.Error(ex, ex.ToString());
            }
        }