improve grid 'visible'
This commit is contained in:
parent
c3871d3bca
commit
4138183352
@ -35,6 +35,7 @@ namespace LibationWinForms
|
|||||||
|
|
||||||
public partial class ProductsGrid : UserControl
|
public partial class ProductsGrid : UserControl
|
||||||
{
|
{
|
||||||
|
/// <summary>Visible rows have changed</summary>
|
||||||
public event EventHandler<int> VisibleCountChanged;
|
public event EventHandler<int> VisibleCountChanged;
|
||||||
|
|
||||||
// alias
|
// alias
|
||||||
@ -208,6 +209,8 @@ namespace LibationWinForms
|
|||||||
if (_dataGridView.Rows.Count == 0)
|
if (_dataGridView.Rows.Count == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
var initVisible = getVisible().Count();
|
||||||
|
|
||||||
var searchResults = SearchEngineCommands.Search(searchString);
|
var searchResults = SearchEngineCommands.Search(searchString);
|
||||||
var productIds = searchResults.Docs.Select(d => d.ProductId).ToList();
|
var productIds = searchResults.Docs.Select(d => d.ProductId).ToList();
|
||||||
|
|
||||||
@ -224,15 +227,21 @@ namespace LibationWinForms
|
|||||||
|
|
||||||
// Causes repainting of the DataGridView
|
// Causes repainting of the DataGridView
|
||||||
bindingContext.ResumeBinding();
|
bindingContext.ResumeBinding();
|
||||||
VisibleCountChanged?.Invoke(this, GetVisible().Count());
|
|
||||||
|
var endVisible = getVisible().Count();
|
||||||
|
if (initVisible != endVisible)
|
||||||
|
VisibleCountChanged?.Invoke(this, endVisible);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
internal IEnumerable<DataLayer.LibraryBook> GetVisible()
|
private IEnumerable<DataGridViewRow> getVisible()
|
||||||
=> _dataGridView
|
=> _dataGridView
|
||||||
.AsEnumerable()
|
.AsEnumerable()
|
||||||
.Where(row => row.Visible)
|
.Where(row => row.Visible);
|
||||||
|
|
||||||
|
internal List<DataLayer.LibraryBook> GetVisible()
|
||||||
|
=> getVisible()
|
||||||
.Select(row => ((GridEntry)row.DataBoundItem).LibraryBook)
|
.Select(row => ((GridEntry)row.DataBoundItem).LibraryBook)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user