Merge branch 'master' of https://github.com/rmcrackan/Libation
This commit is contained in:
commit
1b101106e7
@ -30,6 +30,9 @@ namespace LibationWinForms.GridView
|
|||||||
public bool SupportsFiltering => true;
|
public bool SupportsFiltering => true;
|
||||||
public string Filter { get => FilterString; set => ApplyFilter(value); }
|
public string Filter { get => FilterString; set => ApplyFilter(value); }
|
||||||
|
|
||||||
|
/// <summary>When true, itms will not be checked filtered by search criteria on item changed<summary>
|
||||||
|
public bool SuspendFilteringOnUpdate { get; set; }
|
||||||
|
|
||||||
protected MemberComparer<GridEntry> Comparer { get; } = new();
|
protected MemberComparer<GridEntry> Comparer { get; } = new();
|
||||||
protected override bool SupportsSortingCore => true;
|
protected override bool SupportsSortingCore => true;
|
||||||
protected override bool SupportsSearchingCore => true;
|
protected override bool SupportsSearchingCore => true;
|
||||||
@ -195,7 +198,7 @@ namespace LibationWinForms.GridView
|
|||||||
{
|
{
|
||||||
if (e.ListChangedType == ListChangedType.ItemChanged)
|
if (e.ListChangedType == ListChangedType.ItemChanged)
|
||||||
{
|
{
|
||||||
if (Items[e.NewIndex] is LibraryBookEntry lbItem)
|
if (FilterString is not null && !SuspendFilteringOnUpdate && Items[e.NewIndex] is LibraryBookEntry lbItem)
|
||||||
{
|
{
|
||||||
SearchResults = SearchEngineCommands.Search(FilterString);
|
SearchResults = SearchEngineCommands.Search(FilterString);
|
||||||
if (!SearchResults.Docs.Any(d => d.ProductId == lbItem.AudibleProductId))
|
if (!SearchResults.Docs.Any(d => d.ProductId == lbItem.AudibleProductId))
|
||||||
|
|||||||
@ -63,7 +63,11 @@ namespace LibationWinForms.GridView
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public LibraryBookEntry(LibraryBook libraryBook) => setLibraryBook(libraryBook);
|
public LibraryBookEntry(LibraryBook libraryBook)
|
||||||
|
{
|
||||||
|
setLibraryBook(libraryBook);
|
||||||
|
LoadCover();
|
||||||
|
}
|
||||||
|
|
||||||
public SeriesEntry Parent { get; init; }
|
public SeriesEntry Parent { get; init; }
|
||||||
public void UpdateLibraryBook(LibraryBook libraryBook)
|
public void UpdateLibraryBook(LibraryBook libraryBook)
|
||||||
@ -78,9 +82,9 @@ namespace LibationWinForms.GridView
|
|||||||
|
|
||||||
private void setLibraryBook(LibraryBook libraryBook)
|
private void setLibraryBook(LibraryBook libraryBook)
|
||||||
{
|
{
|
||||||
LibraryBook = libraryBook;
|
LibraryBook = libraryBook;
|
||||||
|
|
||||||
LoadCover();
|
UserDefinedItem.ItemChanged -= UserDefinedItem_ItemChanged;
|
||||||
|
|
||||||
// Immutable properties
|
// Immutable properties
|
||||||
{
|
{
|
||||||
|
|||||||
@ -105,6 +105,8 @@ namespace LibationWinForms.GridView
|
|||||||
string existingFilter = syncBindingSource.Filter;
|
string existingFilter = syncBindingSource.Filter;
|
||||||
Filter(null);
|
Filter(null);
|
||||||
|
|
||||||
|
bindingList.SuspendFilteringOnUpdate = true;
|
||||||
|
|
||||||
//Add absent books to grid, or update current books
|
//Add absent books to grid, or update current books
|
||||||
|
|
||||||
var allItmes = bindingList.AllItems().LibraryBooks();
|
var allItmes = bindingList.AllItems().LibraryBooks();
|
||||||
@ -157,6 +159,8 @@ namespace LibationWinForms.GridView
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bindingList.SuspendFilteringOnUpdate = false;
|
||||||
|
|
||||||
//Re-filter after updating existing / adding new books to capture any changes
|
//Re-filter after updating existing / adding new books to capture any changes
|
||||||
Filter(existingFilter);
|
Filter(existingFilter);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user