Automatic refiltering now works on chardonnay
This commit is contained in:
parent
28802c8279
commit
613cfdd903
@ -27,14 +27,22 @@ namespace LibationAvalonia.Controls
|
||||
IsEnabled = false
|
||||
};
|
||||
|
||||
if (ToolTip.GetTip(cell) is null)
|
||||
ToolTip.SetTip(cell, "Click to change ratings");
|
||||
//Create a panel that fills the cell to host the rating tool tip
|
||||
var panel = new Panel
|
||||
{
|
||||
Background = Avalonia.Media.Brushes.Transparent,
|
||||
HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Stretch,
|
||||
VerticalAlignment = Avalonia.Layout.VerticalAlignment.Stretch,
|
||||
};
|
||||
panel.Children.Add(myRatingElement);
|
||||
|
||||
ToolTip.SetTip(panel, "Click to change ratings");
|
||||
|
||||
if (Binding != null)
|
||||
{
|
||||
myRatingElement.Bind(BindingTarget, Binding);
|
||||
}
|
||||
return myRatingElement;
|
||||
return panel;
|
||||
}
|
||||
|
||||
protected override IControl GenerateEditingElementDirect(DataGridCell cell, object dataItem)
|
||||
@ -48,8 +56,6 @@ namespace LibationAvalonia.Controls
|
||||
Margin = new Thickness(3)
|
||||
};
|
||||
|
||||
ToolTip.SetTip(cell, null);
|
||||
|
||||
return myRatingElement;
|
||||
}
|
||||
|
||||
|
||||
@ -10,6 +10,8 @@ using ApplicationServices;
|
||||
using AudibleUtilities;
|
||||
using LibationAvalonia.Dialogs.Login;
|
||||
using Avalonia.Collections;
|
||||
using LibationSearchEngine;
|
||||
using Octokit.Internal;
|
||||
|
||||
namespace LibationAvalonia.ViewModels
|
||||
{
|
||||
@ -157,12 +159,12 @@ namespace LibationAvalonia.ViewModels
|
||||
{
|
||||
if (string.IsNullOrEmpty(searchString)) return null;
|
||||
|
||||
var SearchResults = SearchEngineCommands.Search(searchString);
|
||||
var searchResultSet = SearchEngineCommands.Search(searchString);
|
||||
|
||||
var booksFilteredIn = entries.BookEntries().Join(SearchResults.Docs, lbe => lbe.AudibleProductId, d => d.ProductId, (lbe, d) => (GridEntry)lbe);
|
||||
var booksFilteredIn = entries.BookEntries().Join(searchResultSet.Docs, lbe => lbe.AudibleProductId, d => d.ProductId, (lbe, d) => (GridEntry)lbe);
|
||||
|
||||
//Find all series containing children that match the search criteria
|
||||
var seriesFilteredIn = entries.SeriesEntries().Where(s => s.Children.Join(SearchResults.Docs, lbe => lbe.AudibleProductId, d => d.ProductId, (lbe, d) => lbe).Any());
|
||||
var seriesFilteredIn = entries.SeriesEntries().Where(s => s.Children.Join(searchResultSet.Docs, lbe => lbe.AudibleProductId, d => d.ProductId, (lbe, d) => lbe).Any());
|
||||
|
||||
return booksFilteredIn.Concat(seriesFilteredIn).ToList();
|
||||
}
|
||||
@ -171,10 +173,13 @@ namespace LibationAvalonia.ViewModels
|
||||
{
|
||||
var filterResults = QueryResults(SOURCE, FilterString);
|
||||
|
||||
if (filterResults.Except(FilteredInGridEntries).Any())
|
||||
if (filterResults is not null && FilteredInGridEntries.Intersect(filterResults).Count() != FilteredInGridEntries.Count)
|
||||
{
|
||||
FilteredInGridEntries = filterResults;
|
||||
|
||||
if (GridEntries.IsEditingItem)
|
||||
GridEntries.CommitEdit();
|
||||
|
||||
await Dispatcher.UIThread.InvokeAsync(GridEntries.Refresh);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user