private void InitProperties()
        {
            // restore list type if returning to window
            // loading parameter will be lost if loaded list items
            // or comments for a selected list
            TraktListType LastListType = ListType;

            // check if skin is using hyperlinkParameter
            if (!string.IsNullOrEmpty(_loadParameter))
            {
                if (_loadParameter.ToLowerInvariant() == "trending")
                {
                    ListType = TraktListType.Trending;
                }
                if (_loadParameter.ToLowerInvariant() == "popular")
                {
                    ListType = TraktListType.Popular;
                }
                if (_loadParameter.ToLowerInvariant() == "liked")
                {
                    ListType = TraktListType.Liked;
                }
            }
            else if (!ReturningFromListItemsOrComments)
            {
                // default to user lists
                ListType = TraktListType.User;
            }

            // if we're in a different list view since last time
            // then reset last selected index
            if (LastListType != ListType)
            {
                PreviousSelectedIndex = 0;
            }

            // set current user to logged in user if not set
            if (string.IsNullOrEmpty(CurrentUser))
            {
                CurrentUser = TraktSettings.Username;
            }

            if (ListType == TraktListType.Trending)
            {
                GUIUtils.SetProperty("#Trakt.List.LikesThisWeek", string.Empty);
                GUIUtils.SetProperty("#Trakt.List.CommentsThisWeek", string.Empty);
            }

            GUICommon.SetProperty("#Trakt.Lists.ListType", ListType.ToString());
            GUICommon.SetProperty("#Trakt.Lists.CurrentUser", CurrentUser);
        }
        /// <summary>
        /// Gets all <see cref="ITraktList" />s containing the given <see cref="ITraktSeason" /> in a show with the given Trakt-Show-Id or -Slug.
        /// <para>OAuth authorization not required.</para>
        /// <para>
        /// See <a href="http://docs.trakt.apiary.io/#reference/seasons/lists/get-lists-containing-this-season">"Trakt API Doc - Seasons: Lists"</a> for more information.
        /// </para>
        /// </summary>
        /// <param name="showIdOrSlug">The show's Trakt-Id or -Slug. See also <seealso cref="ITraktShowIds" />.</param>
        /// <param name="seasonNumber">The number of the season, for which the lists should be queried.</param>
        /// <param name="listType">The type of lists, that should be queried. Defaults to personal lists.</param>
        /// <param name="listSortOrder">The list sort order. See also <seealso cref="TraktListSortOrder" />. Defaults to sorted by popularity.</param>
        /// <param name="pagedParameters"></param>
        /// <param name="cancellationToken"></param>
        /// <returns>
        /// An <see cref="TraktPagedResponse{ITraktList}"/> instance containing the queried season lists and which also
        /// contains the queried page number, the page's item count, maximum page count and maximum item count.
        /// <para>
        /// See also <seealso cref="TraktPagedResponse{ListItem}" /> and <seealso cref="ITraktList" />.
        /// </para>
        /// </returns>
        /// <exception cref="TraktException">Thrown, if the request fails.</exception>
        /// <exception cref="ArgumentException">Thrown, if the given showIdOrSlug is null, empty or contains spaces.</exception>
        /// <exception cref="ArgumentOutOfRangeException">Thrown, if the given season number is below zero.</exception>
        public Task <TraktPagedResponse <ITraktList> > GetSeasonListsAsync(string showIdOrSlug, uint seasonNumber,
                                                                           TraktListType listType = null, TraktListSortOrder listSortOrder = null,
                                                                           TraktPagedParameters pagedParameters = null,
                                                                           CancellationToken cancellationToken  = default)
        {
            var requestHandler = new RequestHandler(Client);

            return(requestHandler.ExecutePagedRequestAsync(new SeasonListsRequest
            {
                Id = showIdOrSlug,
                SeasonNumber = seasonNumber,
                Type = listType,
                SortOrder = listSortOrder,
                Page = pagedParameters?.Page,
                Limit = pagedParameters?.Limit
            },
                                                           cancellationToken));
        }
Exemple #3
0
        public async Task <TraktPaginationListResult <TraktList> > GetShowListsAsync([NotNull] string showIdOrSlug, TraktListType listType = null,
                                                                                     TraktListSortOrder listSortOrder = null,
                                                                                     int?page = null, int?limitPerPage = null)
        {
            Validate(showIdOrSlug);

            return(await QueryAsync(new TraktShowListsRequest(Client)
            {
                Id = showIdOrSlug,
                Type = listType,
                Sorting = listSortOrder,
                PaginationOptions = new TraktPaginationOptions(page, limitPerPage)
            }));
        }
        public async Task <TraktPaginationListResult <TraktList> > GetEpisodeListsAsync([NotNull] string showIdOrSlug, int seasonNumber, int episodeNumber,
                                                                                        TraktListType listType = null, TraktListSortOrder listSortOrder = null,
                                                                                        int?page = null, int?limitPerPage = null)
        {
            Validate(showIdOrSlug, seasonNumber, episodeNumber);

            return(await QueryAsync(new TraktEpisodeListsRequest(Client)
            {
                Id = showIdOrSlug,
                Season = seasonNumber,
                Episode = episodeNumber,
                Type = listType,
                Sorting = listSortOrder,
                PaginationOptions = new TraktPaginationOptions(page, limitPerPage)
            }));
        }
Exemple #5
0
        public void TestTraktListTypeIsTraktEnumeration()
        {
            var enumeration = new TraktListType();

            enumeration.Should().BeAssignableTo <TraktEnumeration>();
        }