Minor refactor

This commit is contained in:
Michael Bucari-Tovo 2022-06-07 15:38:11 -06:00
parent 5cbe728631
commit 0729e4ab09

View File

@ -9,19 +9,18 @@ namespace LibationWinForms.GridView
/// <summary>The View Model for a LibraryBook that is ContentType.Parent</summary> /// <summary>The View Model for a LibraryBook that is ContentType.Parent</summary>
public class SeriesEntry : GridEntry public class SeriesEntry : GridEntry
{ {
public List<LibraryBookEntry> Children { get; } = new(); public List<LibraryBookEntry> Children { get; }
public override DateTime DateAdded => Children.Max(c => c.DateAdded); public override DateTime DateAdded => Children.Max(c => c.DateAdded);
public override string DisplayTags { get; } = string.Empty; public override string DisplayTags { get; } = string.Empty;
public override LiberateButtonStatus Liberate { get; } public override LiberateButtonStatus Liberate { get; }
private SeriesEntry(LibraryBook parent) private SeriesEntry()
{ {
LibraryBook = parent;
Liberate = new LiberateButtonStatus { IsSeries = true }; Liberate = new LiberateButtonStatus { IsSeries = true };
SeriesIndex = -1; SeriesIndex = -1;
} }
public SeriesEntry(LibraryBook parent, IEnumerable<LibraryBook> children) : this(parent) public SeriesEntry(LibraryBook parent, IEnumerable<LibraryBook> children) : this()
{ {
Children = children Children = children
.Select(c => new LibraryBookEntry(c) { Parent = this }) .Select(c => new LibraryBookEntry(c) { Parent = this })
@ -32,7 +31,7 @@ namespace LibationWinForms.GridView
LoadCover(); LoadCover();
} }
public SeriesEntry(LibraryBook parent, LibraryBook child) : this(parent) public SeriesEntry(LibraryBook parent, LibraryBook child) : this()
{ {
Children = new() { new LibraryBookEntry(child) { Parent = this } }; Children = new() { new LibraryBookEntry(child) { Parent = this } };