make auto-scan more fault-tolerant

This commit is contained in:
Robert McRackan 2022-06-21 22:44:25 -04:00
parent ba722487d8
commit f802d1524f

View File

@ -33,7 +33,18 @@ namespace LibationWinForms
.ToArray(); .ToArray();
// in autoScan, new books SHALL NOT show dialog // in autoScan, new books SHALL NOT show dialog
await Invoke(async () => await LibraryCommands.ImportAccountAsync(Login.WinformLoginChoiceEager.ApiExtendedFunc, accounts)); try
{
Task importAsync() => LibraryCommands.ImportAccountAsync(Login.WinformLoginChoiceEager.ApiExtendedFunc, accounts);
if (InvokeRequired)
await Invoke(importAsync);
else
await importAsync();
}
catch (Exception ex)
{
Serilog.Log.Logger.Error(ex, "Error invoking auto-scan");
}
}; };
// load init state to menu checkbox // load init state to menu checkbox