little adjustment about load more logic
This commit is contained in:
parent
507b4c59f2
commit
8cbca8f290
@ -9,6 +9,8 @@ namespace Pixiview.Illust
|
||||
{
|
||||
public partial class RelatedIllustsPage : IllustRecommendsCollectionPage
|
||||
{
|
||||
private const int STEP = 18;
|
||||
|
||||
private readonly IllustItem illustItem;
|
||||
private int startIndex;
|
||||
private int nextIndex;
|
||||
@ -53,15 +55,16 @@ namespace Pixiview.Illust
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var ids = illustIds.Skip(startIndex).Take(18).ToArray();
|
||||
nextIndex = startIndex + ids.Length;
|
||||
var ids = illustIds.Skip(startIndex).Take(STEP).ToArray();
|
||||
data = Stores.LoadIllustRecommendsListData(illustItem.Id, ids);
|
||||
nextIndex = startIndex + STEP;
|
||||
if (ids.Length == 0 || nextIndex >= illustIds.Length)
|
||||
{
|
||||
// done
|
||||
|
||||
App.DebugPrint($"download completed: {startIndex}");
|
||||
return null;
|
||||
startIndex = nextIndex;
|
||||
}
|
||||
data = Stores.LoadIllustRecommendsListData(illustItem.Id, ids);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
@ -96,6 +99,13 @@ namespace Pixiview.Illust
|
||||
{
|
||||
return;
|
||||
}
|
||||
// release
|
||||
var collection = IllustCollection;
|
||||
if (collection != null)
|
||||
{
|
||||
collection.Running = false;
|
||||
IllustCollection = null;
|
||||
}
|
||||
startIndex = -1;
|
||||
nextIndex = 0;
|
||||
illustIds = null;
|
||||
|
@ -266,6 +266,10 @@ namespace Pixiview.Utils
|
||||
|
||||
public static IllustRecommendsData LoadIllustRecommendsListData(string id, string[] ids)
|
||||
{
|
||||
if (ids == null || ids.Length == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var ps = string.Concat(ids.Select(i => $"illust_ids%5B%5D={i}&"));
|
||||
var result = HttpUtility.LoadObject<IllustRecommendsData>(
|
||||
null,
|
||||
@ -458,7 +462,7 @@ namespace Pixiview.Utils
|
||||
public static string UrlIllust => Prefix + "artworks/{0}";
|
||||
public static string UrlIllustRanking => Prefix + "ranking.php?{0}";
|
||||
public static string UrlIllustUserAll => Prefix + "ajax/user/{0}/profile/all?lang=zh";
|
||||
public static string UrlIllustUserArtworks => Prefix + "ajax/user/{0}/profile/illusts?{1}work_category=illustManga&is_first_page={2}&lang=zh";
|
||||
public static string UrlIllustUserArtworks => Prefix + "ajax/user/{0}/profile/illusts?{1}work_category=illust&is_first_page={2}&lang=zh";
|
||||
public static string UrlIllustPage => Prefix + "ajax/illust/{0}/pages?lang=zh";
|
||||
public static string UrlIllustUgoira => Prefix + "ajax/illust/{0}/ugoira_meta?lang=zh";
|
||||
public static string UrlIllustRecommendsInit => Prefix + "ajax/illust/{0}/recommend/init?limit=18&lang=zh";
|
||||
|
Loading…
x
Reference in New Issue
Block a user