示例#1
0
        public void RefreshRecentAdditions(RecentAdditionsType addType)
        {
            try
            {
                System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate()
                {
                    RecentAdditions.Clear();
                });

                if (addType == RecentAdditionsType.Episode)
                {
                    List <JMMServerBinary.Contract_AnimeEpisode> epContracts =
                        JMMServerVM.Instance.clientBinaryHTTP.GetEpisodesRecentlyAdded(UserSettingsVM.Instance.Dash_RecentAdditions_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)
                            {
                                ep.RefreshAnime(true); // this might be a new series
                            }
                            if (ep.AniDB_Anime != null)
                            {
                                ep.SetTvDBInfo();
                                RecentAdditions.Add(ep);
                            }
                        }
                        ViewRecentAdditions.Refresh();
                    });
                }
                else
                {
                    List <JMMServerBinary.Contract_AnimeSeries> serContracts =
                        JMMServerVM.Instance.clientBinaryHTTP.GetSeriesRecentlyAdded(UserSettingsVM.Instance.Dash_RecentAdditions_Items, JMMServerVM.Instance.CurrentUser.JMMUserID.Value);

                    System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate()
                    {
                        foreach (JMMServerBinary.Contract_AnimeSeries contract in serContracts)
                        {
                            AnimeSeriesVM ser = new AnimeSeriesVM(contract);
                            RecentAdditions.Add(ser);
                        }
                        ViewRecentAdditions.Refresh();
                    });
                }
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
            finally
            {
            }
        }
示例#2
0
        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
            {
            }
        }
示例#3
0
        public void RefreshEpsWatchNext_Recent()
        {
            try
            {
                System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate()
                {
                    EpsWatchNext_Recent.Clear();
                });

                DateTime start = DateTime.Now;

                List <JMMServerBinary.Contract_AnimeEpisode> epContracts =
                    JMMServerVM.Instance.clientBinaryHTTP.GetContinueWatchingFilter(JMMServerVM.Instance.CurrentUser.JMMUserID.Value, UserSettingsVM.Instance.Dash_WatchNext_Items);

                TimeSpan ts = DateTime.Now - start;
                logger.Trace("Dashboard Time: RefreshEpsWatchNext_Recent: contracts: {0}", ts.TotalMilliseconds);

                start = DateTime.Now;
                List <AnimeEpisodeVM> epList = new List <AnimeEpisodeVM>();
                foreach (JMMServerBinary.Contract_AnimeEpisode contract in epContracts)
                {
                    AnimeEpisodeVM ep        = new AnimeEpisodeVM(contract);
                    string         animename = ep.AnimeName;             // just do this to force anidb anime detail record to be loaded

                    ts = DateTime.Now - start;
                    logger.Trace("Dashboard Time: RefreshEpsWatchNext_Recent: episode details: Stage 1: {0}", ts.TotalMilliseconds);

                    ep.RefreshAnime();

                    ts = DateTime.Now - start;
                    logger.Trace("Dashboard Time: RefreshEpsWatchNext_Recent: episode details: Stage 2: {0}", ts.TotalMilliseconds);

                    ep.SetTvDBInfo();

                    ts = DateTime.Now - start;
                    logger.Trace("Dashboard Time: RefreshEpsWatchNext_Recent: episode details: Stage 3: {0}", ts.TotalMilliseconds);

                    epList.Add(ep);
                }
                ts = DateTime.Now - start;
                logger.Trace("Dashboard Time: RefreshEpsWatchNext_Recent: episode details: {0}", ts.TotalMilliseconds);

                System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate()
                {
                    foreach (AnimeEpisodeVM ep in epList)
                    {
                        EpsWatchNext_Recent.Add(ep);
                    }

                    ViewEpsWatchNext_Recent.Refresh();
                });
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
            finally
            {
            }
        }
示例#4
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
            {
            }
        }
示例#5
0
        public void RefreshContinueWatching()
        {
            try
            {
                System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate()
                {
                    ContinueWatching.Clear();
                });

                DateTime start = DateTime.Now;

                List <JMMServerBinary.Contract_AnimeEpisode> epContracts =
                    JMMServerVM.Instance.clientBinaryHTTP.GetContinueWatchingFilter(JMMServerVM.Instance.CurrentUser.JMMUserID.Value, UserSettingsVM.Instance.DashMetro_WatchNext_Items);

                TimeSpan ts = DateTime.Now - start;
                logger.Trace("Dashboard Time: RefreshEpsWatchNext_Recent: contracts: {0}", ts.TotalMilliseconds);

                start = DateTime.Now;
                List <AnimeEpisodeVM> epList = new List <AnimeEpisodeVM>();
                foreach (JMMServerBinary.Contract_AnimeEpisode contract in epContracts)
                {
                    AnimeEpisodeVM ep        = new AnimeEpisodeVM(contract);
                    string         animename = ep.AnimeName;             // just do this to force anidb anime detail record to be loaded
                    ep.RefreshAnime();
                    //ep.SetTvDBInfo();
                    epList.Add(ep);
                }
                ts = DateTime.Now - start;
                logger.Trace("Dashboard Time: RefreshEpsWatchNext_Recent: episode details: {0}", ts.TotalMilliseconds);

                System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate()
                {
                    foreach (AnimeEpisodeVM ep in epList)
                    {
                        string imageName = "";
                        if (AppSettings.DashMetroImageType == DashboardMetroImageType.Fanart)
                        {
                            imageName = ep.AniDB_Anime.FanartPathPreferThumb;
                        }
                        else
                        {
                            imageName = ep.AniDB_Anime.PosterPathWithRandoms;
                        }

                        ContinueWatching.Add(new ContinueWatchingTile()
                        {
                            EpisodeDetails    = ep.EpisodeNumberAndName, AnimeName = ep.AnimeSeries.SeriesName,
                            Picture           = imageName,
                            AnimeSeries       = ep.AnimeSeries,
                            UnwatchedEpisodes = ep.AnimeSeries.UnwatchedEpisodeCount,
                            TileSize          = "Large",
                            Height            = 100
                        });
                    }

                    ViewContinueWatching.Refresh();
                });

                OnFinishedProcess(new FinishedProcessEventArgs(DashboardMetroProcessType.ContinueWatching));
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
            finally
            {
            }
        }