bug fix: db persistence shouldn't be a side effect. the client should say when to persist in some fairly explicit way

This commit is contained in:
Robert McRackan 2022-05-10 16:48:52 -04:00
parent c6ce814e1c
commit e368e4669b
6 changed files with 20 additions and 17 deletions

View file

@ -257,6 +257,8 @@ $@" Title: {libraryBook.Book.Title}
if (dialogResult == SkipResult)
{
libraryBook.Book.UserDefinedItem.BookStatus = LiberatedStatus.Error;
ApplicationServices.LibraryCommands.UpdateUserDefinedItem(libraryBook.Book);
LogMe.Info($"Error. Skip: [{libraryBook.Book.AudibleProductId}] {libraryBook.Book.Title}");
}

View file

@ -86,18 +86,18 @@ namespace LibationWinForms
public async Task DownloadBook()
{
if (!DownloadInProgress)
if (DownloadInProgress)
return;
try
{
try
{
DownloadInProgress = true;
await BookLiberation.ProcessorAutomationController.BackupSingleBookAsync(LibraryBook);
UpdateLiberatedStatus();
}
finally
{
DownloadInProgress = false;
}
DownloadInProgress = true;
await BookLiberation.ProcessorAutomationController.BackupSingleBookAsync(LibraryBook);
UpdateLiberatedStatus();
}
finally
{
DownloadInProgress = false;
}
}
@ -195,16 +195,14 @@ namespace LibationWinForms
Liberate.PdfStatus == pdfStatus)
return;
// set
Book.UserDefinedItem.Tags = newTags;
// update cache
_bookStatus = bookStatus;
_pdfStatus = pdfStatus;
// set + save
Book.UserDefinedItem.Tags = newTags;
Book.UserDefinedItem.BookStatus = bookStatus;
Book.UserDefinedItem.PdfStatus = pdfStatus;
// save
LibraryCommands.UpdateUserDefinedItem(Book);
// notify