Scanning no longer blocks UI

This commit is contained in:
Robert McRackan 2022-05-04 17:15:28 -04:00
parent ded175f2d2
commit ecaa3b9aab
10 changed files with 109 additions and 218 deletions

View file

@ -72,6 +72,8 @@ namespace ApplicationServices
}
}
public static event EventHandler<int> ScanBegin;
public static event EventHandler ScanEnd;
#region FULL LIBRARY scan and import
public static async Task<(int totalCount, int newCount)> ImportAccountAsync(Func<Account, Task<ApiExtended>> apiExtendedfunc, params Account[] accounts)
{
@ -82,6 +84,8 @@ namespace ApplicationServices
try
{
ScanBegin?.Invoke(null, accounts.Length);
logTime($"pre {nameof(scanAccountsAsync)} all");
var importItems = await scanAccountsAsync(apiExtendedfunc, accounts, LibraryOptions.ResponseGroupOptions.ALL_OPTIONS);
logTime($"post {nameof(scanAccountsAsync)} all");
@ -127,6 +131,7 @@ namespace ApplicationServices
{
stop();
var putBreakPointHere = logOutput;
ScanEnd?.Invoke(null, null);
}
}