Exemple #1
0
        protected override void InitBindings()
        {
            Bindings.Add(
                this.SetBinding(() => ViewModel.RecommendationAnimeItems).WhenSourceChanges(() =>
            {
                if (ViewModel.RecommendationAnimeItems?.Any() ?? false)
                {
                    RecommendationsPagePivot.Adapter = new RecommandtionsPagerAdapter(FragmentManager,
                                                                                      ViewModel.RecommendationAnimeItems.Select(
                                                                                          item => item.Content as RecommendationItemViewModel));
                    RecommendationsPageTabStrip.SetViewPager(RecommendationsPagePivot);
                    RecommendationsPagePivot.SetCurrentItem(ViewModel.PivotItemIndex, false);
                }
            }));
            Bindings.Add(
                this.SetBinding(() => ViewModel.RecommendationAnimeItems).WhenSourceChanges(() =>
            {
                if (ViewModel.RecommendationMangaItems?.Any() ?? false)
                {
                    RecommendationsPagePivot.Adapter = new RecommandtionsPagerAdapter(FragmentManager,
                                                                                      ViewModel.RecommendationMangaItems.Select(item => item.Content as RecommendationItemViewModel));
                    RecommendationsPageTabStrip.SetViewPager(RecommendationsPagePivot);
                    RecommendationsPagePivot.SetCurrentItem(ViewModel.PivotItemIndex, false);
                }
            }));



            Bindings.Add(
                this.SetBinding(() => ViewModel.Loading,
                                () => RecommendationsPageLoading.Visibility).ConvertSourceToTarget(Converters.BoolToVisibility));

            RecommendationsPageTypeChangeButton.SetCommand("Click", new RelayCommand(OnTypeChangeButtonClick));
        }
 private void BindMangaItems()
 {
     if (ViewModel.RecommendationMangaItems?.Any() ?? false)
     {
         RecommendationsPagePivot.Adapter = new RecommandtionsPagerAdapter(ChildFragmentManager,
                                                                           ViewModel.RecommendationMangaItems.Select(item => item.Content as RecommendationItemViewModel));
         RecommendationsPageTabStrip.SetViewPager(RecommendationsPagePivot);
         RecommendationsPagePivot.SetCurrentItem(ViewModel.PivotItemIndex, false);
     }
 }