|
@@ -30,6 +30,7 @@ using SolidColorBrush = System.Windows.Media.SolidColorBrush;
|
|
|
using String = System.String;
|
|
|
using VerticalAlignment = System.Windows.VerticalAlignment;
|
|
|
using VirtualizingCellsControl = Syncfusion.UI.Xaml.Grid.VirtualizingCellsControl;
|
|
|
+using System.Threading;
|
|
|
|
|
|
namespace InABox.DynamicGrid;
|
|
|
|
|
@@ -487,9 +488,12 @@ public abstract class DynamicGrid<T> : DynamicGrid, IDynamicGridUIComponentParen
|
|
|
|
|
|
void IDynamicGridUIComponentParent<T>.UpdateRecordCount(int count)
|
|
|
{
|
|
|
- Count.Content = string.Format("{0} Records", count);
|
|
|
+ Count.Content = string.Format(FormatRecordCount(), count);
|
|
|
}
|
|
|
|
|
|
+ protected virtual string FormatRecordCount() => "{0} Records";
|
|
|
+
|
|
|
+
|
|
|
void IDynamicGridUIComponentParent<T>.LoadColumnsMenu(ContextMenu menu)
|
|
|
{
|
|
|
menu.AddItem("Select Columns", null, SelectColumnsClick);
|
|
@@ -1243,6 +1247,8 @@ public abstract class DynamicGrid<T> : DynamicGrid, IDynamicGridUIComponentParen
|
|
|
}
|
|
|
return newRows;
|
|
|
}
|
|
|
+
|
|
|
+ private readonly SemaphoreSlim semaphore = new(1,1);
|
|
|
|
|
|
private void LoadData(RowRange? range)
|
|
|
{
|
|
@@ -1261,8 +1267,18 @@ public abstract class DynamicGrid<T> : DynamicGrid, IDynamicGridUIComponentParen
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- var newRows = FilterRows(Enumerable.Range(range.RowIdx, range.Size).Select(i => MasterData.Rows[i]), Data, _recordmap);
|
|
|
- UIComponent.AddPage(newRows);
|
|
|
+ semaphore.Wait();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ // This throws errors when overalpping refreshes cause a mismatch between MasterData and range
|
|
|
+ // Using try/finally and a Semaphore as a temporary measure until we can isolate the issue
|
|
|
+ var _newRows = FilterRows(Enumerable.Range(range.RowIdx, range.Size).Select(i => MasterData.Rows[i]), Data, _recordmap);
|
|
|
+ UIComponent.AddPage(_newRows);
|
|
|
+ }
|
|
|
+ finally
|
|
|
+ {
|
|
|
+ semaphore.Release();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|