diff --git a/Source/LibationWinForms/AvaloniaUI/Controls/FormattableMenuItem.axaml b/Source/LibationWinForms/AvaloniaUI/Controls/FormattableMenuItem.axaml
deleted file mode 100644
index 6607fa93..00000000
--- a/Source/LibationWinForms/AvaloniaUI/Controls/FormattableMenuItem.axaml
+++ /dev/null
@@ -1,5 +0,0 @@
-
diff --git a/Source/LibationWinForms/AvaloniaUI/Controls/FormattableMenuItem.axaml.cs b/Source/LibationWinForms/AvaloniaUI/Controls/FormattableMenuItem.axaml.cs
deleted file mode 100644
index 485f3a7b..00000000
--- a/Source/LibationWinForms/AvaloniaUI/Controls/FormattableMenuItem.axaml.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-using Avalonia.Controls;
-using Avalonia.Styling;
-using System;
-
-namespace LibationWinForms.AvaloniaUI.Controls
-{
- public partial class FormattableMenuItem : MenuItem, IStyleable
- {
- Type IStyleable.StyleKey => typeof(MenuItem);
-
- private string _formatText;
- public string FormatText
- {
- get => _formatText;
- set
- {
- _formatText = value;
- Header = value;
- }
- }
-
- public string Format(params object[] args)
- {
- var formatText = string.Format(FormatText, args);
- Header = formatText;
- return formatText;
- }
- }
-}
diff --git a/Source/LibationWinForms/AvaloniaUI/Controls/FormattableTextBlock.axaml b/Source/LibationWinForms/AvaloniaUI/Controls/FormattableTextBlock.axaml
deleted file mode 100644
index cffbf31e..00000000
--- a/Source/LibationWinForms/AvaloniaUI/Controls/FormattableTextBlock.axaml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
diff --git a/Source/LibationWinForms/AvaloniaUI/Controls/FormattableTextBlock.axaml.cs b/Source/LibationWinForms/AvaloniaUI/Controls/FormattableTextBlock.axaml.cs
deleted file mode 100644
index 38834f20..00000000
--- a/Source/LibationWinForms/AvaloniaUI/Controls/FormattableTextBlock.axaml.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using Avalonia.Controls;
-using Avalonia.Styling;
-using System;
-
-namespace LibationWinForms.AvaloniaUI.Controls
-{
- public partial class FormattableTextBlock : TextBlock, IStyleable
- {
- Type IStyleable.StyleKey => typeof(TextBlock);
-
- private string _formatText;
- public string FormatText
- {
- get => _formatText;
- set
- {
- _formatText = value;
- Text = value;
- }
- }
-
- public string Format(params object[] args)
- {
- return Text = string.Format(FormatText, args);
- }
- }
-}
diff --git a/Source/LibationWinForms/AvaloniaUI/MessageBox.cs b/Source/LibationWinForms/AvaloniaUI/MessageBox.cs
index be05e69c..52b50202 100644
--- a/Source/LibationWinForms/AvaloniaUI/MessageBox.cs
+++ b/Source/LibationWinForms/AvaloniaUI/MessageBox.cs
@@ -1,6 +1,7 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
+using DataLayer;
using LibationWinForms.AvaloniaUI.ViewModels.Dialogs;
using LibationWinForms.AvaloniaUI.Views.Dialogs;
using System;
@@ -200,13 +201,35 @@ namespace LibationWinForms.AvaloniaUI
return await ShowCore(owner, text, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
}
+ public static async Task ShowConfirmationDialog(Window owner, IEnumerable libraryBooks, string format, string title)
+ {
+ if (libraryBooks is null || !libraryBooks.Any())
+ return DialogResult.Cancel;
+
+ var count = libraryBooks.Count();
+
+ string thisThese = count > 1 ? "these" : "this";
+ string bookBooks = count > 1 ? "books" : "book";
+ string titlesAgg = libraryBooks.AggregateTitles();
+
+ var message
+ = string.Format(format, $"{thisThese} {count} {bookBooks}")
+ + $"\r\n\r\n{titlesAgg}";
+
+ return await ShowCore(owner,
+ message,
+ title,
+ MessageBoxButtons.YesNo,
+ MessageBoxIcon.Question,
+ MessageBoxDefaultButton.Button1);
+ }
+
private static async Task ShowCore(Window owner, string message, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
{
if (Avalonia.Threading.Dispatcher.UIThread.CheckAccess())
return await ShowCore2(owner, message, caption, buttons, icon, defaultButton);
else
return await Avalonia.Threading.Dispatcher.UIThread.InvokeAsync(() => ShowCore2(owner, message, caption, buttons, icon, defaultButton));
-
}
private static async Task ShowCore2(Window owner, string message, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
{
@@ -242,23 +265,6 @@ namespace LibationWinForms.AvaloniaUI
dialog.Height = dialog.MinHeight;
dialog.Width = dialog.MinWidth;
- dialog.Opened += (_, _) =>
- {
- switch (defaultButton)
- {
- case MessageBoxDefaultButton.Button1:
- dialog.FindControl