Пример #1
0
        public void RefreshRecommendationsWatch()
        {
            try
            {
                System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate {
                    RecommendationsWatch.Clear();
                });

                List <VM_Recommendation> contracts =
                    VM_ShokoServer.Instance.ShokoServices.GetRecommendations(VM_UserSettings.Instance.Dash_RecWatch_Items, VM_ShokoServer.Instance.CurrentUser.JMMUserID,
                                                                             (int)RecommendationType.Watch).CastList <VM_Recommendation>();

                System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate
                {
                    foreach (VM_Recommendation contract in contracts)
                    {
                        RecommendationsWatch.Add(contract);
                    }

                    // add a dummy object so that we can display a prompt
                    // for the user to sync thier votes
                    if (RecommendationsWatch.Count == 0)
                    {
                        RecommendationsWatch.Add(new SyncVotesDummy());
                    }

                    ViewRecommendationsWatch.Refresh();
                });
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }
Пример #2
0
        public void RefreshRecommendationsWatch()
        {
            try
            {
                System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate {
                    RecommendationsWatch.Clear();
                });

                List <VM_Recommendation> contracts =
                    VM_ShokoServer.Instance.ShokoServices.GetRecommendations(VM_UserSettings.Instance.Dash_RecWatch_Items, VM_ShokoServer.Instance.CurrentUser.JMMUserID,
                                                                             (int)RecommendationType.Watch).CastList <VM_Recommendation>();

                System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate
                {
                    foreach (VM_Recommendation contract in contracts)
                    {
                        RecommendationsWatch.Add(contract);
                    }

                    ViewRecommendationsWatch.Refresh();
                });
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }
Пример #3
0
        public void RefreshRecommendationsWatch()
        {
            try
            {
                System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate()
                {
                    RecommendationsWatch.Clear();
                });

                List <JMMServerBinary.Contract_Recommendation> contracts =
                    JMMServerVM.Instance.clientBinaryHTTP.GetRecommendations(UserSettingsVM.Instance.Dash_RecWatch_Items, JMMServerVM.Instance.CurrentUser.JMMUserID.Value,
                                                                             (int)RecommendationType.Watch);

                System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate()
                {
                    foreach (JMMServerBinary.Contract_Recommendation contract in contracts)
                    {
                        RecommendationVM rec = new RecommendationVM();
                        rec.Populate(contract);
                        RecommendationsWatch.Add(rec);
                    }

                    // add a dummy object so that we can display a prompt
                    // for the user to sync thier votes
                    if (RecommendationsWatch.Count == 0)
                    {
                        RecommendationsWatch.Add(new SyncVotesDummy());
                    }

                    ViewRecommendationsWatch.Refresh();
                });
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
            finally
            {
            }
        }
Пример #4
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
            {
            }
        }