解决翻页时丢失搜索关键字的问题

This commit is contained in:
sin365 2025-01-06 00:22:30 +08:00
parent 90f23a1d3f
commit 7c2709f335

View File

@ -20,6 +20,7 @@ namespace AxibugEmuOnline.Client
private HttpAPI.GetRomListAPI m_romGetFunc;
private HttpAPI.SearchRomListAPI m_romSearchFunc;
private EnumSupportEmuPlatform m_platform;
private string lastSearchKey;
public RomLib(EnumSupportEmuPlatform platform)
{
@ -71,6 +72,7 @@ namespace AxibugEmuOnline.Client
/// <param name="callback"></param>
public void FetchRomCount(Action<RomFile[]> callback, string searchKey = null)
{
lastSearchKey = searchKey;
if (string.IsNullOrWhiteSpace(searchKey))
{
m_romGetFunc((romList) =>
@ -121,9 +123,16 @@ namespace AxibugEmuOnline.Client
if (FetchPageCmd.Count == 0) return;
foreach (var pageNo in FetchPageCmd)
{
if (!string.IsNullOrEmpty(lastSearchKey))
{
m_romSearchFunc(SaveRomInfoFromWeb, lastSearchKey, pageNo, PAGE_SIZE);
}
else
{
m_romGetFunc(SaveRomInfoFromWeb, pageNo, PAGE_SIZE);
}
}
FetchPageCmd.Clear();
}