Exemplo n.º 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
            {
            }
        }
Exemplo n.º 2
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 <VM_AnimeEpisode_User> epContracts =
                    VM_ShokoServer.Instance.ShokoServices.GetContinueWatchingFilter(VM_ShokoServer.Instance.CurrentUser.JMMUserID, VM_UserSettings.Instance.Dash_WatchNext_Items).CastList <VM_AnimeEpisode_User>();

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

                start = DateTime.Now;
                List <VM_AnimeEpisode_User> epList = new List <VM_AnimeEpisode_User>();
                foreach (VM_AnimeEpisode_User ep in epContracts)
                {
                    if (ep.AniDB_Anime == null)
                    {
                        ep.RefreshAnime(true); // this might be a new series
                    }
                    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 (VM_AnimeEpisode_User ep in epList)
                    {
                        EpsWatchNext_Recent.Add(ep);
                    }

                    ViewEpsWatchNext_Recent.Refresh();
                });
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }
Exemplo n.º 3
0
        public void RefreshEpsWatchNext_Recent_Old()
        {
            try
            {
                System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate()
                {
                    EpsWatchNext_Recent.Clear();
                });

                List <JMMServerBinary.Contract_AnimeEpisode> epContracts =
                    JMMServerVM.Instance.clientBinaryHTTP.GetEpisodesToWatch_RecentlyWatched(UserSettingsVM.Instance.Dash_WatchNext_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();
                            EpsWatchNext_Recent.Add(ep);
                        }
                    }
                    ViewEpsWatchNext_Recent.Refresh();
                });
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
            finally
            {
            }
        }