コード例 #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
            {
            }
        }
コード例 #2
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.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
            {
            }
        }