Automatic refiltering now works on chardonnay
This commit is contained in:
parent
28802c8279
commit
613cfdd903
@ -27,14 +27,22 @@ namespace LibationAvalonia.Controls
|
|||||||
IsEnabled = false
|
IsEnabled = false
|
||||||
};
|
};
|
||||||
|
|
||||||
if (ToolTip.GetTip(cell) is null)
|
//Create a panel that fills the cell to host the rating tool tip
|
||||||
ToolTip.SetTip(cell, "Click to change ratings");
|
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)
|
if (Binding != null)
|
||||||
{
|
{
|
||||||
myRatingElement.Bind(BindingTarget, Binding);
|
myRatingElement.Bind(BindingTarget, Binding);
|
||||||
}
|
}
|
||||||
return myRatingElement;
|
return panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IControl GenerateEditingElementDirect(DataGridCell cell, object dataItem)
|
protected override IControl GenerateEditingElementDirect(DataGridCell cell, object dataItem)
|
||||||
@ -48,8 +56,6 @@ namespace LibationAvalonia.Controls
|
|||||||
Margin = new Thickness(3)
|
Margin = new Thickness(3)
|
||||||
};
|
};
|
||||||
|
|
||||||
ToolTip.SetTip(cell, null);
|
|
||||||
|
|
||||||
return myRatingElement;
|
return myRatingElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,6 +10,8 @@ using ApplicationServices;
|
|||||||
using AudibleUtilities;
|
using AudibleUtilities;
|
||||||
using LibationAvalonia.Dialogs.Login;
|
using LibationAvalonia.Dialogs.Login;
|
||||||
using Avalonia.Collections;
|
using Avalonia.Collections;
|
||||||
|
using LibationSearchEngine;
|
||||||
|
using Octokit.Internal;
|
||||||
|
|
||||||
namespace LibationAvalonia.ViewModels
|
namespace LibationAvalonia.ViewModels
|
||||||
{
|
{
|
||||||
@ -157,12 +159,12 @@ namespace LibationAvalonia.ViewModels
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(searchString)) return null;
|
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
|
//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();
|
return booksFilteredIn.Concat(seriesFilteredIn).ToList();
|
||||||
}
|
}
|
||||||
@ -171,10 +173,13 @@ namespace LibationAvalonia.ViewModels
|
|||||||
{
|
{
|
||||||
var filterResults = QueryResults(SOURCE, FilterString);
|
var filterResults = QueryResults(SOURCE, FilterString);
|
||||||
|
|
||||||
if (filterResults.Except(FilteredInGridEntries).Any())
|
if (filterResults is not null && FilteredInGridEntries.Intersect(filterResults).Count() != FilteredInGridEntries.Count)
|
||||||
{
|
{
|
||||||
FilteredInGridEntries = filterResults;
|
FilteredInGridEntries = filterResults;
|
||||||
|
|
||||||
|
if (GridEntries.IsEditingItem)
|
||||||
GridEntries.CommitEdit();
|
GridEntries.CommitEdit();
|
||||||
|
|
||||||
await Dispatcher.UIThread.InvokeAsync(GridEntries.Refresh);
|
await Dispatcher.UIThread.InvokeAsync(GridEntries.Refresh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user