Revert: only call notifyPropertyChanged if actually set to new value

This commit is contained in:
Robert McRackan 2022-05-14 12:34:01 -04:00
parent 9bdcaa5eaa
commit 28a8b2e685
2 changed files with 13 additions and 42 deletions

View File

@ -136,11 +136,8 @@ namespace LibationWinForms.Dialogs
}
set
{
if (_remove != value)
{
_remove = value;
NotifyPropertyChanged();
}
_remove = value;
NotifyPropertyChanged();
}
}

View File

@ -41,11 +41,8 @@ namespace LibationWinForms
get => _cover;
private set
{
if (_cover != value)
{
_cover = value;
NotifyPropertyChanged();
}
_cover = value;
NotifyPropertyChanged();
}
}
@ -175,25 +172,16 @@ namespace LibationWinForms
switch (itemName)
{
case nameof(udi.Tags):
if (Book.UserDefinedItem.Tags != udi.Tags)
{
Book.UserDefinedItem.Tags = udi.Tags;
NotifyPropertyChanged(nameof(DisplayTags));
}
Book.UserDefinedItem.Tags = udi.Tags;
NotifyPropertyChanged(nameof(DisplayTags));
break;
case nameof(udi.BookStatus):
if (Book.UserDefinedItem.BookStatus != udi.BookStatus)
{
Book.UserDefinedItem.BookStatus = udi.BookStatus;
NotifyPropertyChanged(nameof(Liberate));
}
Book.UserDefinedItem.BookStatus = udi.BookStatus;
NotifyPropertyChanged(nameof(Liberate));
break;
case nameof(udi.PdfStatus):
if (Book.UserDefinedItem.PdfStatus != udi.PdfStatus)
{
Book.UserDefinedItem.PdfStatus = udi.PdfStatus;
NotifyPropertyChanged(nameof(Liberate));
}
Book.UserDefinedItem.PdfStatus = udi.PdfStatus;
NotifyPropertyChanged(nameof(Liberate));
break;
}
}
@ -223,23 +211,9 @@ namespace LibationWinForms
private void UpdateLiberatedStatus(bool notify = true)
{
var changed = false;
var newBookStatus = LibraryCommands.Liberated_Status(LibraryBook.Book);
if (_bookStatus != newBookStatus)
{
_bookStatus = newBookStatus;
changed = true;
}
var newPdfStatus = LibraryCommands.Pdf_Status(LibraryBook.Book);
if (_pdfStatus != newPdfStatus)
{
_pdfStatus = newPdfStatus;
changed = true;
}
if (changed && notify)
_bookStatus = LibraryCommands.Liberated_Status(LibraryBook.Book);
_pdfStatus = LibraryCommands.Pdf_Status(LibraryBook.Book);
if (notify)
NotifyPropertyChanged(nameof(Liberate));
}