Add exception handling to products display
This commit is contained in:
parent
15b6a66d98
commit
845af854bd
@ -84,18 +84,25 @@ namespace LibationWinForms.GridView
|
|||||||
|
|
||||||
public void Display()
|
public void Display()
|
||||||
{
|
{
|
||||||
// don't return early if lib size == 0. this will not update correctly if all books are removed
|
try
|
||||||
var lib = DbContexts.GetLibrary_Flat_NoTracking();
|
|
||||||
|
|
||||||
if (!hasBeenDisplayed)
|
|
||||||
{
|
{
|
||||||
// bind
|
// don't return early if lib size == 0. this will not update correctly if all books are removed
|
||||||
productsGrid.BindToGrid(lib);
|
var lib = DbContexts.GetLibrary_Flat_NoTracking();
|
||||||
hasBeenDisplayed = true;
|
|
||||||
InitialLoaded?.Invoke(this, new());
|
if (!hasBeenDisplayed)
|
||||||
|
{
|
||||||
|
// bind
|
||||||
|
productsGrid.BindToGrid(lib);
|
||||||
|
hasBeenDisplayed = true;
|
||||||
|
InitialLoaded?.Invoke(this, new());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
productsGrid.UpdateGrid(lib);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Serilog.Log.Error(ex, "Error displaying library in {0}", nameof(ProductsDisplay));
|
||||||
}
|
}
|
||||||
else
|
|
||||||
productsGrid.UpdateGrid(lib);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user