Removing books

* message box is too big when removing huge amounts of books. This scenario is typical when removing podcasts
* removing books should remove user defined entries. eg: tags and is-liberated
This commit is contained in:
Robert McRackan 2021-09-24 10:00:52 -04:00
parent 7c38e18435
commit d2eaf26117
3 changed files with 11 additions and 4 deletions

View file

@ -91,16 +91,22 @@ namespace LibationWinForms.Dialogs
{
var selectedBooks = SelectedEntries.ToList();
if (selectedBooks.Count == 0) return;
if (selectedBooks.Count == 0)
return;
string titles = string.Join("\r\n", selectedBooks.Select(rge => "-" + rge.Title));
var titles = selectedBooks.Select(rge => "- " + rge.Title).ToList();
var titlesAgg = titles.Take(5).Aggregate((a, b) => $"{a}\r\n{b}");
if (titles.Count == 6)
titlesAgg += $"\r\n\r\nand 1 other";
else if (titles.Count > 6)
titlesAgg += $"\r\n\r\nand {titles.Count - 5} others";
string thisThese = selectedBooks.Count > 1 ? "these" : "this";
string bookBooks = selectedBooks.Count > 1 ? "books" : "book";
var result = MessageBox.Show(
this,
$"Are you sure you want to remove {thisThese} {selectedBooks.Count} {bookBooks} from Libation's library?\r\n\r\n{titles}",
$"Are you sure you want to remove {thisThese} {selectedBooks.Count} {bookBooks} from Libation's library?\r\n\r\n{titlesAgg}",
"Remove books from Libation?",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question,