コード例 #1
0
        public void RefreshMiniCalendar()
        {
            try
            {
                System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate()
                {
                    MiniCalendar.Clear();
                    ViewMiniCalendar.SortDescriptions.Clear();
                    if (UserSettingsVM.Instance.Dash_MiniCalendarUpcomingOnly)
                    {
                        ViewMiniCalendar.SortDescriptions.Add(new SortDescription("AirDate", ListSortDirection.Ascending));
                    }
                    else
                    {
                        ViewMiniCalendar.SortDescriptions.Add(new SortDescription("AirDate", ListSortDirection.Descending));
                    }
                });

                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()
                {
                    DateTime yesterday = DateTime.Now.AddDays(-1);
                    foreach (JMMServerBinary.Contract_AniDBAnime contract in contracts)
                    {
                        bool useAnime = true;
                        if (UserSettingsVM.Instance.Dash_MiniCalendarUpcomingOnly && contract.AirDate < yesterday)
                        {
                            useAnime = false;
                        }

                        if (useAnime)
                        {
                            AniDB_AnimeVM anime = new AniDB_AnimeVM(contract);
                            if (JMMServerVM.Instance.CurrentUser.EvaluateAnime(anime))
                            {
                                MiniCalendar.Add(anime);
                            }
                        }
                    }

                    ViewMiniCalendar.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();
                    ViewMiniCalendar.SortDescriptions.Clear();
                    ViewMiniCalendar.SortDescriptions.Add(VM_UserSettings.Instance.Dash_MiniCalendarUpcomingOnly ? new SortDescription("AirDate", ListSortDirection.Ascending) : new SortDescription("AirDate", ListSortDirection.Descending));
                });

                List <VM_AniDB_Anime> contracts = VM_ShokoServer.Instance.ShokoServices.GetMiniCalendar(VM_ShokoServer.Instance.CurrentUser.JMMUserID, VM_UserSettings.Instance.Dash_MiniCalendarDays).CastList <VM_AniDB_Anime>();

                System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate
                {
                    DateTime yesterday = DateTime.Now.AddDays(-1);
                    foreach (VM_AniDB_Anime contract in contracts)
                    {
                        bool useAnime = !(VM_UserSettings.Instance.Dash_MiniCalendarUpcomingOnly && contract.AirDate < yesterday);

                        if (useAnime)
                        {
                            if (VM_ShokoServer.Instance.CurrentUser.EvaluateAnime(contract))
                            {
                                MiniCalendar.Add(contract);
                            }
                        }
                    }

                    ViewMiniCalendar.Refresh();
                });
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }
コード例 #3
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
            {
            }
        }