diff --git a/Source/LibationAvalonia/Walkthrough.cs b/Source/LibationAvalonia/Walkthrough.cs index a170d139..0c0b831a 100644 --- a/Source/LibationAvalonia/Walkthrough.cs +++ b/Source/LibationAvalonia/Walkthrough.cs @@ -5,6 +5,7 @@ using Avalonia.Controls.Presenters; using Avalonia.Controls.Primitives; using Avalonia.Media; using Avalonia.Styling; +using Dinah.Core; using Dinah.Core.StepRunner; using LibationAvalonia.Dialogs; using LibationAvalonia.Views; @@ -164,8 +165,9 @@ namespace LibationAvalonia { //if we imported new books, wait for the grid to update before proceeding. if (newCount > 0) - MainForm.ViewModel.ProductsDisplay.VisibleCountChanged += productsDisplay_VisibleCountChanged; - else + Avalonia.Threading.Dispatcher.UIThread.Invoke(() => + MainForm.ViewModel.ProductsDisplay.VisibleCountChanged += productsDisplay_VisibleCountChanged); + else tcs.SetResult(); } void productsDisplay_VisibleCountChanged(object sender, int e) => tcs.SetResult(); @@ -176,7 +178,7 @@ namespace LibationAvalonia var books = DbContexts.GetLibrary_Flat_NoTracking(); if (books.Count == 0) return true; - var firstAuthor = getFirstAuthor(); + var firstAuthor = getFirstAuthor()?.SurroundWithQuotes(); if (firstAuthor == null) return true; if (!await ProceedMessageBox("You can filter the grid entries by searching", "Searching")) @@ -193,7 +195,7 @@ namespace LibationAvalonia await displayControlAsync(MainForm.filterBtn); - MainForm.filterBtn.Command.Execute(null); + MainForm.filterBtn.Command.Execute(firstAuthor); await Task.Delay(1000); @@ -209,8 +211,7 @@ namespace LibationAvalonia private async Task ShowQuickFilters() { - var firstAuthor = getFirstAuthor(); - + var firstAuthor = getFirstAuthor()?.SurroundWithQuotes(); if (firstAuthor == null) return true; if (!await ProceedMessageBox("Queries that you perform regularly can be added to 'Quick Filters'", "Quick Filters")) @@ -222,7 +223,7 @@ namespace LibationAvalonia await Task.Delay(750); await displayControlAsync(MainForm.addQuickFilterBtn); - MainForm.addQuickFilterBtn.Command.Execute(null); + MainForm.addQuickFilterBtn.Command.Execute(firstAuthor); await displayControlAsync(MainForm.quickFiltersToolStripMenuItem); await displayControlAsync(editQuickFiltersToolStripMenuItem); diff --git a/Source/LibationWinForms/Walkthrough.cs b/Source/LibationWinForms/Walkthrough.cs index 79343bd9..56083f75 100644 --- a/Source/LibationWinForms/Walkthrough.cs +++ b/Source/LibationWinForms/Walkthrough.cs @@ -1,5 +1,6 @@ using ApplicationServices; using AudibleUtilities; +using Dinah.Core; using Dinah.Core.StepRunner; using LibationFileManager; using LibationWinForms.Dialogs; @@ -163,7 +164,7 @@ namespace LibationWinForms var books = DbContexts.GetLibrary_Flat_NoTracking(); if (books.Count == 0) return true; - var firstAuthor = getFirstAuthor(); + var firstAuthor = getFirstAuthor()?.SurroundWithQuotes(); if (firstAuthor == null) return true; if (!ProceedMessageBox("You can filter the grid entries by searching", "Searching")) @@ -196,7 +197,7 @@ namespace LibationWinForms private async Task ShowQuickFilters() { - var firstAuthor = getFirstAuthor(); + var firstAuthor = getFirstAuthor()?.SurroundWithQuotes(); if (firstAuthor == null) return true; if (!ProceedMessageBox("Queries that you perform regularly can be added to 'Quick Filters'", "Quick Filters"))