diff --git a/Source/LibationAvalonia/MessageBox.cs b/Source/LibationAvalonia/MessageBox.cs index 0c7aa958..dee03e8d 100644 --- a/Source/LibationAvalonia/MessageBox.cs +++ b/Source/LibationAvalonia/MessageBox.cs @@ -102,7 +102,10 @@ Libation. ".Trim(), "Verbose logging enabled", MessageBoxButtons.OK, MessageBoxIcon.Warning); } - public static async Task ShowConfirmationDialog(Window owner, IEnumerable libraryBooks, string format, string title, MessageBoxDefaultButton defaultButton = MessageBoxDefaultButton.Button1) + /// + /// Note: the format field should use {0} and NOT use the `$` string interpolation. Formatting is done inside this method. + /// + public static async Task ShowConfirmationDialog(Window owner, IEnumerable libraryBooks, string format, string title, MessageBoxDefaultButton defaultButton = MessageBoxDefaultButton.Button1) { if (libraryBooks is null || !libraryBooks.Any()) return DialogResult.Cancel; diff --git a/Source/LibationAvalonia/ViewModels/ProductsDisplayViewModel.cs b/Source/LibationAvalonia/ViewModels/ProductsDisplayViewModel.cs index 41dad536..8468ba55 100644 --- a/Source/LibationAvalonia/ViewModels/ProductsDisplayViewModel.cs +++ b/Source/LibationAvalonia/ViewModels/ProductsDisplayViewModel.cs @@ -247,7 +247,8 @@ namespace LibationAvalonia.ViewModels var result = await MessageBox.ShowConfirmationDialog( null, libraryBooks, - $"Are you sure you want to remove {selectedBooks.Count} books from Libation's library?", + // do not use `$` string interpolation. See impl. + "Are you sure you want to remove {0} from Libation's library?", "Remove books from Libation?"); if (result != DialogResult.Yes) diff --git a/Source/LibationAvalonia/Views/MainWindow/MainWindow.VisibleBooks.axaml.cs b/Source/LibationAvalonia/Views/MainWindow/MainWindow.VisibleBooks.axaml.cs index b0fce463..5a9d78d8 100644 --- a/Source/LibationAvalonia/Views/MainWindow/MainWindow.VisibleBooks.axaml.cs +++ b/Source/LibationAvalonia/Views/MainWindow/MainWindow.VisibleBooks.axaml.cs @@ -50,7 +50,8 @@ namespace LibationAvalonia.Views var confirmationResult = await MessageBox.ShowConfirmationDialog( this, visibleLibraryBooks, - "Are you sure you want to replace tags in {0}?", + // do not use `$` string interpolation. See impl. + "Are you sure you want to replace tags in {0}?", "Replace tags?"); if (confirmationResult != DialogResult.Yes) @@ -73,7 +74,8 @@ namespace LibationAvalonia.Views var confirmationResult = await MessageBox.ShowConfirmationDialog( this, visibleLibraryBooks, - "Are you sure you want to replace downloaded status in {0}?", + // do not use `$` string interpolation. See impl. + "Are you sure you want to replace downloaded status in {0}?", "Replace downloaded status?"); if (confirmationResult != DialogResult.Yes) @@ -91,7 +93,8 @@ namespace LibationAvalonia.Views var confirmationResult = await MessageBox.ShowConfirmationDialog( this, visibleLibraryBooks, - "Are you sure you want to remove {0} from Libation's library?", + // do not use `$` string interpolation. See impl. + "Are you sure you want to remove {0} from Libation's library?", "Remove books from Libation?", MessageBoxDefaultButton.Button2); diff --git a/Source/LibationWinForms/Form1.VisibleBooks.cs b/Source/LibationWinForms/Form1.VisibleBooks.cs index 664a2897..20e07607 100644 --- a/Source/LibationWinForms/Form1.VisibleBooks.cs +++ b/Source/LibationWinForms/Form1.VisibleBooks.cs @@ -80,6 +80,7 @@ namespace LibationWinForms var confirmationResult = MessageBoxLib.ShowConfirmationDialog( visibleLibraryBooks, + // do not use `$` string interpolation. See impl. "Are you sure you want to replace tags in {0}?", "Replace tags?"); @@ -102,7 +103,8 @@ namespace LibationWinForms var confirmationResult = MessageBoxLib.ShowConfirmationDialog( visibleLibraryBooks, - $"Are you sure you want to replace downloaded status in {0}?", + // do not use `$` string interpolation. See impl. + "Are you sure you want to replace downloaded status in {0}?", "Replace downloaded status?"); if (confirmationResult != DialogResult.Yes) @@ -119,7 +121,8 @@ namespace LibationWinForms var confirmationResult = MessageBoxLib.ShowConfirmationDialog( visibleLibraryBooks, - $"Are you sure you want to remove {0} from Libation's library?", + // do not use `$` string interpolation. See impl. + "Are you sure you want to remove {0} from Libation's library?", "Remove books from Libation?"); if (confirmationResult != DialogResult.Yes) diff --git a/Source/LibationWinForms/GridView/ProductsDisplay.cs b/Source/LibationWinForms/GridView/ProductsDisplay.cs index 0f30b8f5..56a710af 100644 --- a/Source/LibationWinForms/GridView/ProductsDisplay.cs +++ b/Source/LibationWinForms/GridView/ProductsDisplay.cs @@ -109,7 +109,8 @@ namespace LibationWinForms.GridView var libraryBooks = selectedBooks.Select(rge => rge.LibraryBook).ToList(); var result = MessageBoxLib.ShowConfirmationDialog( libraryBooks, - $"Are you sure you want to remove {selectedBooks.Count} books from Libation's library?", + // do not use `$` string interpolation. See impl. + "Are you sure you want to remove {0} from Libation's library?", "Remove books from Libation?"); if (result != DialogResult.Yes) diff --git a/Source/LibationWinForms/MessageBoxLib.cs b/Source/LibationWinForms/MessageBoxLib.cs index 040a9293..62a7f9f8 100644 --- a/Source/LibationWinForms/MessageBoxLib.cs +++ b/Source/LibationWinForms/MessageBoxLib.cs @@ -64,6 +64,9 @@ Libation. ".Trim(), "Verbose logging enabled", MessageBoxButtons.OK, MessageBoxIcon.Warning); } + /// + /// Note: the format field should use {0} and NOT use the `$` string interpolation. Formatting is done inside this method. + /// public static DialogResult ShowConfirmationDialog(IEnumerable libraryBooks, string format, string title) { if (libraryBooks is null || !libraryBooks.Any())