Skip to content

Commit 9139eb8

Browse files
Supports millions of row insert or remove.
Added ResetAsync on the VOC.
1 parent ba1729d commit 9139eb8

11 files changed

Lines changed: 37 additions & 12 deletions

AlphaChiTech.Virtualization/PaginationManager.cs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -869,10 +869,21 @@ public int IndexOf(T item)
869869
/// <param name="count">The count.</param>
870870
public void OnReset(int count)
871871
{
872+
if(count < 0)
873+
{
874+
_HasGotCount = false;
875+
return;
876+
}
877+
872878
CancelAllRequests();
873879

880+
lock (_PageLock)
881+
{
882+
DropAllDeltasAndPages();
883+
}
884+
874885
ClearOptimizations();
875-
_HasGotCount = false;
886+
_HasGotCount = true;
876887

877888
if (!IsAsync)
878889
{
@@ -883,14 +894,7 @@ public void OnReset(int count)
883894
this.ProviderAsync.OnReset(count);
884895
}
885896

886-
lock (_PageLock)
887-
{
888-
DropAllDeltasAndPages();
889-
}
890-
891897
RaiseCountChanged(true, count);
892-
893-
GetCount(true);
894898
}
895899

896900
/// <summary>

AlphaChiTech.Virtualization/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@
2626
// You can specify all the values or you can default the Build and Revision Numbers
2727
// by using the '*' as shown below:
2828
// [assembly: AssemblyVersion("1.0.*")]
29-
[assembly: AssemblyVersion("1.1.0.0")]
30-
[assembly: AssemblyFileVersion("1.1.0.0")]
29+
[assembly: AssemblyVersion("1.1.3.0")]
30+
[assembly: AssemblyFileVersion("1.1.3.0")]

AlphaChiTech.Virtualization/VirtualizingObservableCollection.cs

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -682,10 +682,31 @@ void InternalClear()
682682
{
683683
if(this.Provider != null)
684684
{
685-
this.Provider.OnReset(0);
685+
this.Provider.OnReset(this.Provider.GetCount(false));
686686
} else
687687
{
688-
this.ProviderAsync.OnReset(0);
688+
this.ProviderAsync.OnReset(Task.Run(() => this.ProviderAsync.Count).Result);
689+
}
690+
}
691+
692+
public async void ResetAsync()
693+
{
694+
if(this.Provider != null)
695+
{
696+
this.Provider.OnReset(-1);
697+
698+
Task.Run(() =>
699+
{
700+
int count = this.Provider.GetCount(false);
701+
VirtualizationManager.Instance.RunOnUI(() =>
702+
this.Provider.OnReset(count)
703+
);
704+
});
705+
706+
}
707+
else
708+
{
709+
this.ProviderAsync.OnReset(await this.ProviderAsync.Count);
689710
}
690711
}
691712

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)