public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> state)
        {
            var tvShowId = (int)parameter;
            var service  = new MovieBrowserService();

            //Don't borther the server if we dont have to
            if (TvShow == null)
            {
                TvShow = await service.GetTvShow(tvShowId);
            }
            //Load cast if empty
            if (CastList.Count == 0)
            {
                Credits credits = await service.GetTvShowCredits(tvShowId);

                for (int i = 0; i < credits.cast.Length; i++)
                {
                    CastList.Add(credits.cast[i]);
                }
            }
            //Load seasons if empty
            if (Seasons.Count == 0)
            {
                for (int i = 1; i <= TvShow.number_of_seasons; i++)
                {
                    Season season = await service.GetSeason(TvShow.id, i);

                    Seasons.Add(season);
                }
            }
            await base.OnNavigatedToAsync(parameter, mode, state);
        }
Ejemplo n.º 2
0
        protected override void OnAppearing()
        {
            base.OnAppearing();

            InputEvents.GetEventHandlers(CastList).Add(new RemoteKeyHandler(async(evt) =>
            {
                if (evt.KeyName == RemoteControlKeyNames.Up && ButtonArea.Children.Count > 0)
                {
                    var btn = ButtonArea.Children[0];
                    await ScrollView.ScrollToAsync(btn, ScrollToPosition.Center, true);
                    btn.Focus();
                }
                else if (evt.KeyName == RemoteControlKeyNames.Down)
                {
                    await ScrollView.ScrollToAsync(SimilarList, ScrollToPosition.Center, true);
                    SimilarList.Focus();
                }
            }, RemoteControlKeyTypes.KeyDown));

            InputEvents.GetEventHandlers(SimilarList).Add(new RemoteKeyHandler(async(evt) =>
            {
                if (evt.KeyName == RemoteControlKeyNames.Up)
                {
                    await ScrollView.ScrollToAsync(CastList, ScrollToPosition.Center, true);
                    CastList.Focus();
                }
            }, RemoteControlKeyTypes.KeyDown));
        }
Ejemplo n.º 3
0
        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    CastList?.Dispose();
                    LdsList?.Dispose();
                    StartLpList?.Dispose();
                    LpList?.Dispose();
                    HeadList?.Dispose();
                }

                disposedValue = true;
            }
        }