mirror of
https://github.com/gwdevhub/Daybreak.git
synced 2026-07-22 18:49:44 +00:00
ab1b604aec
* Resolve warnings and move shared props to Directory.Build.props and Directory.Packages.props * Cleanup more messages * Fix more messages * Fix build issues
43 lines
999 B
C#
43 lines
999 B
C#
using System.Collections.ObjectModel;
|
|
using System.Collections.Specialized;
|
|
|
|
namespace Daybreak.Shared.Models;
|
|
|
|
public class BatchedObservableCollection<T> : ObservableCollection<T>
|
|
{
|
|
public void RemoveBatch(IEnumerable<T> values)
|
|
{
|
|
this.CheckReentrancy();
|
|
var changed = false;
|
|
foreach (var value in values)
|
|
{
|
|
this.Items.Remove(value);
|
|
changed = true;
|
|
}
|
|
|
|
if (!changed)
|
|
{
|
|
return;
|
|
}
|
|
|
|
this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
|
|
}
|
|
|
|
public void AddBatch(IEnumerable<T> values)
|
|
{
|
|
this.CheckReentrancy();
|
|
var changed = false;
|
|
foreach (var value in values)
|
|
{
|
|
this.Items.Add(value);
|
|
}
|
|
|
|
if (!changed)
|
|
{
|
|
return;
|
|
}
|
|
|
|
this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
|
|
}
|
|
}
|