Cache book and pdf statuses for faster sorting.
This commit is contained in:
parent
48ffc40abb
commit
d848c1a499
@ -32,6 +32,8 @@ namespace LibationWinForms
|
|||||||
|
|
||||||
#region Model properties exposed to the view
|
#region Model properties exposed to the view
|
||||||
private Image _cover;
|
private Image _cover;
|
||||||
|
private LiberatedStatus _bookStatus;
|
||||||
|
private LiberatedStatus? _pdfStatus;
|
||||||
public Image Cover
|
public Image Cover
|
||||||
{
|
{
|
||||||
get => _cover;
|
get => _cover;
|
||||||
@ -63,10 +65,12 @@ namespace LibationWinForms
|
|||||||
// these 2 values being in 1 field is the trick behind getting the liberated+pdf 'stoplight' icon to draw. See: LiberateDataGridViewImageButtonCell.Paint
|
// these 2 values being in 1 field is the trick behind getting the liberated+pdf 'stoplight' icon to draw. See: LiberateDataGridViewImageButtonCell.Paint
|
||||||
public (LiberatedStatus BookStatus, LiberatedStatus? PdfStatus) Liberate
|
public (LiberatedStatus BookStatus, LiberatedStatus? PdfStatus) Liberate
|
||||||
{
|
{
|
||||||
get => (LibraryCommands.Liberated_Status(LibraryBook.Book), LibraryCommands.Pdf_Status(LibraryBook.Book));
|
get => (_bookStatus, _pdfStatus);
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
_bookStatus = value.BookStatus;
|
||||||
|
_pdfStatus = value.PdfStatus;
|
||||||
LibraryBook.Book.UserDefinedItem.BookStatus = value.BookStatus;
|
LibraryBook.Book.UserDefinedItem.BookStatus = value.BookStatus;
|
||||||
LibraryBook.Book.UserDefinedItem.PdfStatus = value.PdfStatus;
|
LibraryBook.Book.UserDefinedItem.PdfStatus = value.PdfStatus;
|
||||||
}
|
}
|
||||||
@ -110,6 +114,10 @@ namespace LibationWinForms
|
|||||||
LibraryBook = libraryBook;
|
LibraryBook = libraryBook;
|
||||||
_memberValues = CreateMemberValueDictionary();
|
_memberValues = CreateMemberValueDictionary();
|
||||||
|
|
||||||
|
//Cache these statuses for faster sorting.
|
||||||
|
_bookStatus = LibraryCommands.Liberated_Status(LibraryBook.Book);
|
||||||
|
_pdfStatus = LibraryCommands.Pdf_Status(LibraryBook.Book);
|
||||||
|
|
||||||
// Get cover art. If it's default, subscribe to PictureCached
|
// Get cover art. If it's default, subscribe to PictureCached
|
||||||
{
|
{
|
||||||
(bool isDefault, byte[] picture) = PictureStorage.GetPicture(new PictureDefinition(Book.PictureId, PictureSize._80x80));
|
(bool isDefault, byte[] picture) = PictureStorage.GetPicture(new PictureDefinition(Book.PictureId, PictureSize._80x80));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user