Пример #1
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
            {
            }
        }
Пример #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 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
            {
            }
        }
Пример #4
0
        public void RefreshEpisodes()
        {
            allEpisodes = new List <AnimeEpisodeVM>();

            try
            {
                DateTime start = DateTime.Now;
                List <JMMServerBinary.Contract_AnimeEpisode> eps = JMMServerVM.Instance.clientBinaryHTTP.GetEpisodesForSeries(AnimeSeriesID.Value,
                                                                                                                              JMMServerVM.Instance.CurrentUser.JMMUserID.Value);
                TimeSpan ts = DateTime.Now - start;
                logger.Info("Got episode data from service: {0} in {1} ms", AniDB_Anime.FormattedTitle, ts.TotalMilliseconds);

                start = DateTime.Now;

                TvDBSummary tvSummary = AniDB_Anime.TvSummary;
                // Normal episodes
                List <AnimeEpisodeVM> specials = new List <AnimeEpisodeVM>();
                foreach (JMMServerBinary.Contract_AnimeEpisode ep in eps)
                {
                    AnimeEpisodeVM epvm = new AnimeEpisodeVM(ep);
                    epvm.SetTvDBInfo(tvSummary);
                    allEpisodes.Add(epvm);
                }

                ts = DateTime.Now - start;
                logger.Info("Got episode contracts: {0} in {1} ms", AniDB_Anime.FormattedTitle, ts.TotalMilliseconds);

                start = DateTime.Now;
                allEpisodes.Sort();
                ts = DateTime.Now - start;
                logger.Info("Sorted episode contracts: {0} in {1} ms", AniDB_Anime.FormattedTitle, ts.TotalMilliseconds);
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }