diff --git a/AppScaffolding/AppScaffolding.csproj b/AppScaffolding/AppScaffolding.csproj
index afc57dae..c3e159dd 100644
--- a/AppScaffolding/AppScaffolding.csproj
+++ b/AppScaffolding/AppScaffolding.csproj
@@ -3,7 +3,7 @@
net5.0
- 6.2.1.0
+ 6.2.2.0
diff --git a/DataLayer/EfClasses/UserDefinedItem.cs b/DataLayer/EfClasses/UserDefinedItem.cs
index 52deb335..ea18e296 100644
--- a/DataLayer/EfClasses/UserDefinedItem.cs
+++ b/DataLayer/EfClasses/UserDefinedItem.cs
@@ -47,7 +47,7 @@ namespace DataLayer
if (_tags != newTags)
{
_tags = newTags;
- ItemChanged?.Invoke(this, nameof(Tags));
+ OnItemChanged(nameof(Tags));
}
}
}
@@ -112,6 +112,28 @@ namespace DataLayer
///
public static event EventHandler ItemChanged;
+ private void OnItemChanged(string e)
+ {
+ // HACK
+ // must not fire during initial import.
+ //
+ // these checks are necessary because current architecture attaches to this instead of attaching to an event *after* fully committed to db. the attached delegate/action sometimes calls commit:
+ //
+ // desired:
+ // - importing new book
+ // - update pdf status
+ // - initial book commit
+ //
+ // actual without these checks [BAD]:
+ // - importing new book
+ // - update pdf status
+ // - invoke event
+ // - commit UserDefinedItem
+ // - initial book commit
+ if (BookId > 0 && Book is not null && Book.BookId > 0)
+ ItemChanged?.Invoke(this, e);
+ }
+
private LiberatedStatus _bookStatus;
private LiberatedStatus? _pdfStatus;
public LiberatedStatus BookStatus
@@ -122,7 +144,7 @@ namespace DataLayer
if (_bookStatus != value)
{
_bookStatus = value;
- ItemChanged?.Invoke(this, nameof(BookStatus));
+ OnItemChanged(nameof(BookStatus));
}
}
}
@@ -134,7 +156,7 @@ namespace DataLayer
if (_pdfStatus != value)
{
_pdfStatus = value;
- ItemChanged?.Invoke(this, nameof(PdfStatus));
+ OnItemChanged(nameof(PdfStatus));
}
}
}
diff --git a/FileLiberator/ConvertToMp3.cs b/FileLiberator/ConvertToMp3.cs
index c30222ea..2d58b17f 100644
--- a/FileLiberator/ConvertToMp3.cs
+++ b/FileLiberator/ConvertToMp3.cs
@@ -17,7 +17,7 @@ namespace FileLiberator
private Mp4File m4bBook;
private long fileSize;
- private string Mp3FileName(string m4bPath) => m4bPath is null ? string.Empty : PathLib.ReplaceExtension(m4bPath, ".mp3");
+ private static string Mp3FileName(string m4bPath) => m4bPath is null ? string.Empty : PathLib.ReplaceExtension(m4bPath, ".mp3");
public override void Cancel() => m4bBook?.Cancel();