Show full book description when Description cell is clicked.

This commit is contained in:
Michael Bucari-Tovo 2022-05-09 16:44:44 -06:00
parent 1c9ea0a710
commit 201ecebda9
7 changed files with 353 additions and 166 deletions

View file

@ -26,6 +26,8 @@ namespace LibationWinForms
public string AudibleProductId => Book.AudibleProductId;
[Browsable(false)]
public LibraryBook LibraryBook { get; private set; }
[Browsable(false)]
public string LongDescription { get; private set; }
#endregion
#region Model properties exposed to the view
@ -131,7 +133,8 @@ namespace LibationWinForms
Narrators = Book.NarratorNames;
Category = string.Join(" > ", Book.CategoriesNames);
Misc = GetMiscDisplay(libraryBook);
Description = GetDescriptionDisplay(Book);
LongDescription = GetDescriptionDisplay(Book);
Description = TrimTextToWord(LongDescription, 62);
}
UserDefinedItem.ItemChanged += UserDefinedItem_ItemChanged;
@ -266,6 +269,14 @@ namespace LibationWinForms
return doc.DocumentNode.InnerText;
}
private static string TrimTextToWord(string text, int maxLength)
{
return
text.Length <= maxLength ?
text :
text.Substring(0, maxLength - 3) + "...";
}
/// <summary>
/// This information should not change during <see cref="GridEntry"/> lifetime, so call only once.
/// Maximum of 5 text rows will fit in 80-pixel row height.