示例#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 RefreshMiniCalendar()
        {
            try
            {
                System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate()
                {
                    MiniCalendar.Clear();
                });

                List <JMMServerBinary.Contract_AniDBAnime> contracts =
                    JMMServerVM.Instance.clientBinaryHTTP.GetMiniCalendar(JMMServerVM.Instance.CurrentUser.JMMUserID.Value, UserSettingsVM.Instance.Dash_MiniCalendarDays);

                System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate()
                {
                    foreach (JMMServerBinary.Contract_AniDBAnime contract in contracts)
                    {
                        AniDB_AnimeVM anime = new AniDB_AnimeVM(contract);
                        if (JMMServerVM.Instance.CurrentUser.EvaluateAnime(anime))
                        {
                            MiniCalendar.Add(anime);
                        }
                    }
                    ViewEpsWatchNext_Recent.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 <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);
            }
        }
示例#4
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
            {
            }
        }
示例#5
0
        public void RefreshData(bool refreshContinueWatching, bool refreshRecentAdditions, bool refreshOtherWidgets, RecentAdditionsType addType)
        {
            try
            {
                IsLoadingData = true;

                // clear all displayed data
                System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate()
                {
                    if (refreshContinueWatching)
                    {
                        EpsWatchNext_Recent.Clear();
                    }
                    if (refreshRecentAdditions)
                    {
                        RecentAdditions.Clear();
                    }

                    if (refreshOtherWidgets)
                    {
                        SeriesMissingEps.Clear();
                        EpsWatchedRecently.Clear();
                        MiniCalendar.Clear();
                        RecommendationsWatch.Clear();
                        RecommendationsDownload.Clear();
                    }

                    if (refreshOtherWidgets)
                    {
                        ViewEpsWatchedRecently.Refresh();
                        ViewSeriesMissingEps.Refresh();
                        ViewMiniCalendar.Refresh();
                        ViewRecommendationsWatch.Refresh();
                        ViewRecommendationsDownload.Refresh();
                        ViewRecentAdditions.Refresh();
                    }

                    if (refreshContinueWatching)
                    {
                        ViewEpsWatchNext_Recent.Refresh();
                    }
                    if (refreshRecentAdditions)
                    {
                        ViewRecentAdditions.Refresh();
                    }
                });

                DateTime start = DateTime.Now;
                MainListHelperVM.Instance.RefreshGroupsSeriesData();
                TimeSpan ts = DateTime.Now - start;

                logger.Trace("Dashboard Time: RefreshGroupsSeriesData: {0}", ts.TotalMilliseconds);

                if (refreshContinueWatching && UserSettingsVM.Instance.DashWatchNextEpExpanded)
                {
                    RefreshEpsWatchNext_Recent();
                }

                if (refreshRecentAdditions && UserSettingsVM.Instance.DashRecentAdditionsExpanded)
                {
                    RefreshRecentAdditions(addType);
                }

                if (refreshOtherWidgets)
                {
                    if (UserSettingsVM.Instance.DashRecentlyWatchEpsExpanded)
                    {
                        RefreshRecentlyWatchedEps();
                    }

                    if (UserSettingsVM.Instance.DashSeriesMissingEpisodesExpanded)
                    {
                        RefreshSeriesMissingEps();
                    }

                    if (UserSettingsVM.Instance.DashMiniCalendarExpanded)
                    {
                        RefreshMiniCalendar();
                    }

                    if (UserSettingsVM.Instance.DashRecommendationsWatchExpanded)
                    {
                        RefreshRecommendationsWatch();
                    }

                    if (UserSettingsVM.Instance.DashRecommendationsDownloadExpanded)
                    {
                        RefreshRecommendationsDownload();
                    }
                }

                IsLoadingData = false;
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
            finally
            {
            }
        }