Formatting

This commit is contained in:
Michael Bucari-Tovo 2022-06-08 09:46:11 -06:00
parent a476d5986d
commit 859a8e933c
2 changed files with 17 additions and 17 deletions

View File

@ -11,7 +11,6 @@ namespace LibationWinForms.GridView
/// <summary>The View Model for a LibraryBook that is ContentType.Product or ContentType.Episode</summary> /// <summary>The View Model for a LibraryBook that is ContentType.Product or ContentType.Episode</summary>
public class LibraryBookEntry : GridEntry public class LibraryBookEntry : GridEntry
{ {
[Browsable(false)] public override DateTime DateAdded => LibraryBook.DateAdded; [Browsable(false)] public override DateTime DateAdded => LibraryBook.DateAdded;
[Browsable(false)] public SeriesEntry Parent { get; init; } [Browsable(false)] public SeriesEntry Parent { get; init; }
@ -60,22 +59,19 @@ namespace LibationWinForms.GridView
{ {
LibraryBook = libraryBook; LibraryBook = libraryBook;
// Immutable properties Title = Book.Title;
{ Series = Book.SeriesNames();
Title = Book.Title; Length = Book.LengthInMinutes == 0 ? "" : $"{Book.LengthInMinutes / 60} hr {Book.LengthInMinutes % 60} min";
Series = Book.SeriesNames(); MyRating = Book.UserDefinedItem.Rating?.ToStarString()?.DefaultIfNullOrWhiteSpace("");
Length = Book.LengthInMinutes == 0 ? "" : $"{Book.LengthInMinutes / 60} hr {Book.LengthInMinutes % 60} min"; PurchaseDate = libraryBook.DateAdded.ToString("d");
MyRating = Book.UserDefinedItem.Rating?.ToStarString()?.DefaultIfNullOrWhiteSpace(""); ProductRating = Book.Rating?.ToStarString()?.DefaultIfNullOrWhiteSpace("");
PurchaseDate = libraryBook.DateAdded.ToString("d"); Authors = Book.AuthorNames();
ProductRating = Book.Rating?.ToStarString()?.DefaultIfNullOrWhiteSpace(""); Narrators = Book.NarratorNames();
Authors = Book.AuthorNames(); Category = string.Join(" > ", Book.CategoriesNames());
Narrators = Book.NarratorNames(); Misc = GetMiscDisplay(libraryBook);
Category = string.Join(" > ", Book.CategoriesNames()); LongDescription = GetDescriptionDisplay(Book);
Misc = GetMiscDisplay(libraryBook); Description = TrimTextToWord(LongDescription, 62);
LongDescription = GetDescriptionDisplay(Book); SeriesIndex = Book.SeriesLink.FirstOrDefault()?.Index ?? 0;
Description = TrimTextToWord(LongDescription, 62);
SeriesIndex = Book.SeriesLink.FirstOrDefault()?.Index ?? 0;
}
UserDefinedItem.ItemChanged += UserDefinedItem_ItemChanged; UserDefinedItem.ItemChanged += UserDefinedItem_ItemChanged;
} }

View File

@ -65,6 +65,8 @@ namespace LibationWinForms.GridView
NotifyPropertyChanged(); NotifyPropertyChanged();
} }
#region Data Sorting
/// <summary>Create getters for all member object values by name</summary> /// <summary>Create getters for all member object values by name</summary>
protected override Dictionary<string, Func<object>> CreateMemberValueDictionary() => new() protected override Dictionary<string, Func<object>> CreateMemberValueDictionary() => new()
{ {
@ -83,5 +85,7 @@ namespace LibationWinForms.GridView
{ nameof(Liberate), () => Liberate }, { nameof(Liberate), () => Liberate },
{ nameof(DateAdded), () => DateAdded }, { nameof(DateAdded), () => DateAdded },
}; };
#endregion
} }
} }