コード例 #1
0
ファイル: BrowsePage.cs プロジェクト: Xandroid4Net/CEI
        public override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            viewModel = Locator.Get <BrowseViewModel>();
            if (viewModel == null)
            {
                viewModel = Locator.GetNewInstance <BrowseViewModel>();
                viewModel.PropertyChanged += ViewModel_PropertyChanged;
                Task.Run(async() =>
                {
                    await viewModel.GetTopRated().ConfigureAwait(false);
                    await viewModel.GetPopular().ConfigureAwait(false);
                    await viewModel.GetNowPlaying().ConfigureAwait(false);
                });
            }

            Activity.InvalidateOptionsMenu();
        }
コード例 #2
0
ファイル: BrowsePage.cs プロジェクト: Xandroid4Net/CEI
        private void InitNowPlayingRecyclerView()
        {
            nowPlayingManager = new LinearLayoutManager(Activity, LinearLayoutManager.Horizontal, false);
            nowPlaying.SetLayoutManager(nowPlayingManager);
            nowPlayingAdapter = new ItemAdapter(viewModel.GetCachedNowPlaying());
            nowPlaying.SetAdapter(nowPlayingAdapter);
            var nowPlayingScrollListener = new ItemAdapterScollListener(nowPlayingManager);

            nowPlayingScrollListener.LoadMore += async delegate()
            {
                if (!viewModel.CanLoadMoreNowPlaying())
                {
                    return;
                }
                await viewModel.GetNowPlaying().ConfigureAwait(false);
            };
            nowPlaying.AddOnScrollListener(nowPlayingScrollListener);
        }