little adjustment about load more logic
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user