コード例 #1
0
ファイル: MyShowsViewModel.cs プロジェクト: taurgis/WPTrakt
        public async void LoadSuggestData()
        {
            LoadingSuggestItems = true;
            TraktShow[] obj = await controller.getUserSuggestions();

            int counter = 1;

            this.SuggestItems = new ObservableCollection <ListItemViewModel>();

            foreach (TraktShow show in obj)
            {
                if (counter++ > 8)
                {
                    break;
                }

                this.SuggestItems.Add(new ListItemViewModel()
                {
                    Name = show.Title, ImageSource = show.Images.Poster, Imdb = show.imdb_id, Tvdb = show.tvdb_id, Type = "Show", InWatchList = show.InWatchlist
                });
            }

            LoadingSuggestItems = false;

            System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                if (this.Indicator != null)
                {
                    this.Indicator.IsVisible = false;
                }
                NotifyPropertyChanged("SuggestItems");
                NotifyPropertyChanged("LoadingStatus");
            });
        }