Fix filtering bug
This commit is contained in:
parent
718d21f6cb
commit
f29dff3386
@ -110,8 +110,8 @@ namespace LibationWinForms.grid
|
|||||||
|
|
||||||
internal void UpdateGrid(List<LibraryBook> dbBooks)
|
internal void UpdateGrid(List<LibraryBook> dbBooks)
|
||||||
{
|
{
|
||||||
int visibleCount = bindingList.Count;
|
|
||||||
string existingFilter = syncBindingSource.Filter;
|
string existingFilter = syncBindingSource.Filter;
|
||||||
|
Filter(null);
|
||||||
|
|
||||||
//Add absent books to grid, or update current books
|
//Add absent books to grid, or update current books
|
||||||
|
|
||||||
@ -150,6 +150,11 @@ namespace LibationWinForms.grid
|
|||||||
int seriesIndex = bindingList.IndexOf(series);
|
int seriesIndex = bindingList.IndexOf(series);
|
||||||
bindingList.Insert(seriesIndex + 1, lb);
|
bindingList.Insert(seriesIndex + 1, lb);
|
||||||
|
|
||||||
|
if (series.Liberate.Expanded)
|
||||||
|
bindingList.ExpandItem(series);
|
||||||
|
else
|
||||||
|
bindingList.CollapseItem(series);
|
||||||
|
|
||||||
series.NotifyPropertyChanged();
|
series.NotifyPropertyChanged();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -163,13 +168,6 @@ namespace LibationWinForms.grid
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bindingList.Count != visibleCount)
|
|
||||||
{
|
|
||||||
//re-filter for newly added items
|
|
||||||
Filter(null);
|
|
||||||
Filter(existingFilter);
|
|
||||||
}
|
|
||||||
|
|
||||||
// remove deleted from grid.
|
// remove deleted from grid.
|
||||||
// note: actual deletion from db must still occur via the RemoveBook feature. deleting from audible will not trigger this
|
// note: actual deletion from db must still occur via the RemoveBook feature. deleting from audible will not trigger this
|
||||||
var removedBooks =
|
var removedBooks =
|
||||||
@ -196,8 +194,9 @@ namespace LibationWinForms.grid
|
|||||||
//no need to re-filter for removed books
|
//no need to re-filter for removed books
|
||||||
bindingList.Remove(removed);
|
bindingList.Remove(removed);
|
||||||
|
|
||||||
if (bindingList.Count != visibleCount)
|
Filter(existingFilter);
|
||||||
VisibleCountChanged?.Invoke(this, bindingList.LibraryBooks().Count());
|
|
||||||
|
VisibleCountChanged?.Invoke(this, bindingList.LibraryBooks().Count());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user