using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using NotifyEventArgs = System.Collections.Specialized.NotifyCollectionChangedEventArgs;
using NotifyAction = System.Collections.Specialized.NotifyCollectionChangedAction;
public class DataCollection : INotifyCollectionChanged, IEnumerable
{
protected List<DataPoint> Data = new List<DataPoint>();
public event NotifyCollectionChangedEventHandler CollectionChanged;
protected void OnCollectionChanged(NotifyEventArgs e)
{
if (CollectionChanged != null)
{
CollectionChanged(this, e);
}
}
public IEnumerator GetEnumerator()
{
return this.Data.GetEnumerator();
}
public void Add(DataPoint dataPoint)
{
this.Data.Add(dataPoint);
NotifyEventArgs e = new NotifyEventArgs(NotifyAction.Add, dataPoint);
// 変更がひとつまたはふたつのポイントのみの時は、
// Reset イベント アクションの代わりに Add イベント アクションを使用します
//NotifyEventArgs e = new NotifyEventArgs(NotifyAction.Reset);
this.OnCollectionChanged(e);
}
}