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