public void RefreshRecommendationsDownload()
        {
            try
            {
                System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate {
                    RecommendationsDownload.Clear();
                });

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

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

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

                    ViewRecommendationsDownload.Refresh();
                });
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }
Exemple #2
0
        public void RefreshRecommendationsDownload()
        {
            try
            {
                System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate {
                    RecommendationsDownload.Clear();
                });

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

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

                    ViewRecommendationsDownload.Refresh();
                });
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }
Exemple #3
0
        public void RefreshRecommendationsDownload()
        {
            try
            {
                System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate()
                {
                    RecommendationsDownload.Clear();
                });

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

                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);
                        RecommendationsDownload.Add(rec);
                    }

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

                    ViewRecommendationsDownload.Refresh();
                });
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
            finally
            {
            }
        }