Пример #1
0
        private async Task FetchComments()
        {
            IComments comments;

            if (_illust != null)
            {
                comments = await _queryCacheService.RunAsync(_pixivClient.IllustV1.CommentsAsync,
                                                             illust_id => _illust.Id,
                                                             offset => _offset);
            }
            else
            {
                comments = await _queryCacheService.RunAsync(_pixivClient.NovelV1.CommentsAsync,
                                                             novel_id => _novel.Id,
                                                             offset => _offset);
            }
            comments?.CommentList.ForEach(w => Comments.Add(w));
            if (string.IsNullOrWhiteSpace(comments?.NextUrl))
            {
                HasMoreItems = false;
            }
            else
            {
                _offset = UrlParameter.ParseQuery(comments.NextUrl)["offset"];
            }
        }
Пример #2
0
        private async Task QueryAsync()
        {
            IBookmarkTags tags;

            if (_searchType == SearchType.IllustsAndManga)
            {
                tags = await _queryCacheService.RunAsync(_pixivClient.User.BookmarkTags.IllustAsync,
                                                         restrict => _restrict.ToParamString(),
                                                         offset => _offset);
            }
            else if (_searchType == SearchType.Novels)
            {
                tags = await _queryCacheService.RunAsync(_pixivClient.User.BookmarkTags.NovelAsync,
                                                         restrict => _restrict.ToParamString(),
                                                         offset => _offset);
            }
            else
            {
                throw new NotSupportedException();
            }
            tags?.BookmarkTagList.ForEach(w => BookmarkTags.Add(w));
            if (string.IsNullOrWhiteSpace(tags?.NextUrl))
            {
                HasMoreItems = false;
            }
            else
            {
                _offset = UrlParameter.ParseQuery(tags.NextUrl)["offset"];
            }
        }
Пример #3
0
        private async Task SearchIllust()
        {
            var illusts = await _queryCacheService.RunAsync(_pixivClient.Search.IllustAsync,
                                                            duration => _optionParam.Duration.ToParamString(),
                                                            search_target => _optionParam.Target.ToParamString(),
                                                            sort => _optionParam.Sort.ToParamString(),
                                                            word => _query,
                                                            filter => "for_ios",
                                                            offset => _offset);

            illusts?.IllustList.Where(w => w.TotalBookmarks >= _optionParam.BookmarkCount)
            .Where(w => w.TotalView >= _optionParam.ViewCount)
            .Where(w => w.TotalComments >= _optionParam.CommentCount)
            .Where(w => w.PageCount >= _optionParam.CommentCount)
            .Where(w => (w.Height >= _optionParam.Height) && (w.Width >= _optionParam.Width))
            .Where(w => string.IsNullOrWhiteSpace(_optionParam.Tool) || w.Tools.Any(v => v == _optionParam.Tool))
            .ForEach(w => ResultIllusts.Add(w));
            if (string.IsNullOrWhiteSpace(illusts?.NextUrl))
            {
                HasMoreItems = false;
            }
            else
            {
                _offset = UrlParameter.ParseQuery(illusts.NextUrl)["offset"];
            }
        }
Пример #4
0
        private async Task FetchNovels(bool isClear)
        {
            if (isClear)
            {
                NewNovels.Clear();
            }

            INovels novels = null;

            if (_followType == FollowType.Following)
            {
                novels = await _queryCacheService.RunAsync(_pixivClient.NovelV1.FollowAsync,
                                                           restrict => "all",
                                                           offset => _offset);
            }
            else if (_followType == FollowType.Mypixiv)
            {
                novels = await _queryCacheService.RunAsync(_pixivClient.NovelV1.MypixivAsync, offset => _offset);
            }
            else if (_followType == FollowType.All)
            {
                novels = await _queryCacheService.RunAsync(_pixivClient.NovelV1.NewAsync, max_novel_id => _maxNovelId);
            }
            novels?.NovelList.ForEach(w => NewNovels.Add(w));
            if (string.IsNullOrWhiteSpace(novels?.NextUrl))
            {
                HasMoreItems = false;
            }
            else
            {
                _offset     = UrlParameter.ParseQuery(novels.NextUrl).TryGet("offset");
                _maxNovelId = UrlParameter.ParseQuery(novels.NextUrl).TryGet("max_novel_id");
            }
        }
Пример #5
0
        private async Task FetchIllusts(bool isClear)
        {
            if (isClear)
            {
                NewIllusts.Clear();
            }

            IIllusts illusts;

            if (_contentType == ContentType.Illust)
            {
                illusts = await FetchIllusts();
            }
            else
            {
                illusts = await FetchManga();
            }
            illusts?.IllustList.ForEach(w => NewIllusts.Add(w));
            if (string.IsNullOrWhiteSpace(illusts?.NextUrl))
            {
                HasMoreItems = false;
            }
            else
            {
                _offset      = UrlParameter.ParseQuery(illusts.NextUrl).TryGet("offset");
                _maxIllustId = UrlParameter.ParseQuery(illusts.NextUrl).TryGet("max_illust_id");
            }
        }
Пример #6
0
        private async Task Fetch()
        {
            var novels = await _queryCacheService.RunAsync(_pixivClient.NovelV1.MarkersAsync, offset => _offset);

            novels?.NovelList.ForEach(w => Novels.Add(w));
            if (string.IsNullOrWhiteSpace(novels?.NextUrl))
            {
                HasMoreItems = false;
            }
            else
            {
                _offset = UrlParameter.ParseQuery(novels.NextUrl)["offset"];
            }
        }
Пример #7
0
        private async Task FetchUsers()
        {
            var users = await _queryCacheService.RunAsync(_pixivClient.User.RecommendedAsync, offset => _offset);

            users?.UserPreviewList.ForEach(w => RecommendedUsers.Add(w));
            if (string.IsNullOrWhiteSpace(users?.NextUrl))
            {
                HasMoreItems = false;
            }
            else
            {
                _offset = UrlParameter.ParseQuery(users.NextUrl)["offset"];
            }
        }
Пример #8
0
        private async Task FetchIllusts()
        {
            var illusts = await _queryCacheService.RunAsync(_pixivClient.User.BrowsingHistory.IllustAsync, offset => _offset);

            illusts?.IllustList.ForEach(w => Illusts.Add(w));
            if (string.IsNullOrWhiteSpace(illusts?.NextUrl))
            {
                HasMoreItems = false;
            }
            else
            {
                _offset = UrlParameter.ParseQuery(illusts.NextUrl)["offset"];
            }
        }
Пример #9
0
        private async Task SearchUser()
        {
            var users = await _queryCacheService.RunAsync(_pixivClient.Search.UserAsync,
                                                          word => _query,
                                                          filter => "for_ios",
                                                          offset => _offset);

            users?.UserPreviewList.ForEach(w => ResultUsers.Add(w));
            if (string.IsNullOrWhiteSpace(users?.NextUrl))
            {
                HasMoreItems = false;
            }
            else
            {
                _offset = UrlParameter.ParseQuery(users.NextUrl)["offset"];
            }
        }
Пример #10
0
        private async Task FetchIllusts()
        {
            var illusts = await _queryCacheService.RunAsync(_pixivClient.IllustV1.RankingAsync,
                                                            mode => _rankingMode.ToParamString(_rankingType),
                                                            filter => "for_ios",
                                                            offset => _offset);

            illusts?.IllustList.ForEach(w => Illusts.Add(w));
            if (string.IsNullOrWhiteSpace(illusts?.NextUrl))
            {
                HasMoreItems = false;
            }
            else
            {
                _offset = UrlParameter.ParseQuery(illusts.NextUrl)["offset"];
            }
        }
Пример #11
0
        private async Task FetchRelatedItems()
        {
            var illusts = await _queryCacheService.RunAsync(_pixivClient.IllustV1.RelatedAsync,
                                                            illust_id => _illust.Id,
                                                            filter => "for_ios",
                                                            seed_illust_ids => _seedIds);

            illusts?.IllustList.ForEach(w => RelatedIllusts.Add(w));
            if (string.IsNullOrWhiteSpace(illusts?.NextUrl))
            {
                HasMoreItems = false;
            }
            else
            {
                _seedIds = UrlParameter.ParseQuery(illusts.NextUrl)["v1_seed_illust_ids"].Replace("%2C", ",");
            }
        }
Пример #12
0
        private async Task Fetch()
        {
            var users = await _queryCacheService.RunAsync(_pixivClient.User.FollowerAsync,
                                                          user_id => _userId,
                                                          restrict => _restrict.ToParamString(),
                                                          offset => _offset);

            users?.UserPreviewList.ForEach(w => Users.Add(w));
            if (string.IsNullOrWhiteSpace(users?.NextUrl))
            {
                HasMoreItems = false;
            }
            else
            {
                _offset = UrlParameter.ParseQuery(users.NextUrl)["offset"];
            }
        }
Пример #13
0
        private async Task FetchIllusts(string contentType)
        {
            var illusts = await _queryCacheService.RunAsync(_pixivClient.User.IllustsAsync,
                                                            user_id => _id,
                                                            filter => "for_ios",
                                                            type => contentType,
                                                            offset => _offset);

            illusts?.IllustList.ForEach(w => Illusts.Add(w));
            if (string.IsNullOrWhiteSpace(illusts?.NextUrl))
            {
                HasMoreItems = false;
            }
            else
            {
                _offset = UrlParameter.ParseQuery(illusts.NextUrl)["offset"];
            }
        }
Пример #14
0
        private async Task QueryNovel()
        {
            var bookmarksApi = _pixivClient.User.Bookmarks;
            var novels       = await _queryCacheService.RunAsync(bookmarksApi.NovelAsync,
                                                                 user_id => _optionParam.UserId,
                                                                 restrict => _optionParam.Restrict.ToParamString(),
                                                                 max_bookmark_id => _maxBookmarkId,
                                                                 tag => _optionParam.Tag ?? "");

            novels?.NovelList.ForEach(w => ResultNovels.Add(w));
            if (string.IsNullOrWhiteSpace(novels?.NextUrl))
            {
                HasMoreItems = false;
            }
            else
            {
                _maxBookmarkId = UrlParameter.ParseQuery(novels.NextUrl)["max_bookmark_id"];
            }
        }
Пример #15
0
        private async Task QueryIllust()
        {
            var bookmarksApi = _pixivClient.User.Bookmarks;
            var illusts      = await _queryCacheService.RunAsync(bookmarksApi.IllustAsync,
                                                                 user_id => _optionParam.UserId,
                                                                 filter => "for_ios",
                                                                 restrict => _optionParam.Restrict.ToParamString(),
                                                                 max_bookmark_id => _maxBookmarkId,
                                                                 tag => _optionParam.Tag ?? "");

            illusts?.IllustList.ForEach(w => ResultIllusts.Add(w));
            if (string.IsNullOrWhiteSpace(illusts?.NextUrl))
            {
                HasMoreItems = false;
            }
            else
            {
                _maxBookmarkId = UrlParameter.ParseQuery(illusts.NextUrl)["max_bookmark_id"];
            }
        }
Пример #16
0
        private async Task FetchNovels()
        {
            IRecommendedNovels novels;

            if (_accountService.IsLoggedIn)
            {
                novels = await _queryCacheService.RunAsync(_pixivClient.NovelV1.RecommendedAsync, offset => _offset);
            }
            else
            {
                novels = await _queryCacheService.RunAsync(_pixivClient.NovelV1.RecommendedNologinAsync, offset => _offset);
            }
            novels?.Novels.ForEach(w => RecommendedNovels.Add(w));
            if (string.IsNullOrWhiteSpace(novels?.NextUrl))
            {
                HasMoreItems = false;
            }
            else
            {
                _offset = UrlParameter.ParseQuery(novels.NextUrl)["offset"];
            }
        }
Пример #17
0
        private async Task FetchIllusts()
        {
            IRecommendedIllusts illusts = null;

            if (_contentType == ContentType.Illust)
            {
                illusts = await RecommendedAsync("illust");
            }
            else if (_contentType == ContentType.Manga)
            {
                illusts = await RecommendedAsync("manga");
            }
            illusts?.Illusts.ForEach(w => RecommendedImages.Add(w));
            if (string.IsNullOrWhiteSpace(illusts?.NextUrl))
            {
                HasMoreItems = false;
            }
            else
            {
                _offset = UrlParameter.ParseQuery(illusts.NextUrl)["offset"];
            }
        }
Пример #18
0
        public static void Activate(Uri uri, INavigationService navigationService)
        {
            var host = uri.Host;
            var activateParams = UrlParameter.ParseQuery(uri.ToString());
            var param = new DetailByIdParameter {
                Id = activateParams["id"]
            }.ToJson();

            switch (host)
            {
            case "illusts":
                navigationService.Navigate("Detail.IllustDetail", param);
                break;

            case "novels":
                navigationService.Navigate("Detail.NovelDetail", param);
                break;

            case "users":
                navigationService.Navigate("Detail.UserDetail", param);
                break;
            }
        }
Пример #19
0
        private async Task SearchNovel()
        {
            var novels = await _queryCacheService.RunAsync(_pixivClient.Search.NovelAsync,
                                                           duration => _optionParam.Duration.ToParamString(),
                                                           search_target => _optionParam.Target.ToParamString(),
                                                           sort => _optionParam.Sort.ToParamString(),
                                                           word => _query,
                                                           offset => _offset);

            novels?.NovelList.Where(w => w.TotalBookmarks >= _optionParam.BookmarkCount)
            .Where(w => w.TotalView >= _optionParam.ViewCount)
            .Where(w => w.TotalComments >= _optionParam.CommentCount)
            .Where(w => w.PageCount >= _optionParam.CommentCount)
            .Where(w => w.TextLength >= _optionParam.TextLength)
            .ForEach(w => ResultNovels.Add(w));
            if (string.IsNullOrWhiteSpace(novels?.NextUrl))
            {
                HasMoreItems = false;
            }
            else
            {
                _offset = UrlParameter.ParseQuery(novels.NextUrl)["offset"];
            }
        }