CPF/CPF.ReoGrid/Chart/WorksheetChartDataSerialCollection.cs
2024-06-24 10:15:59 +08:00

100 lines
1.9 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
namespace CPF.ReoGrid.Chart
{
public class WorksheetChartDataSerialCollection : IList<WorksheetChartDataSerial>, ICollection<WorksheetChartDataSerial>, IEnumerable<WorksheetChartDataSerial>, IEnumerable
{
public WorksheetChartDataSource DataSource { get; private set; }
internal WorksheetChartDataSerialCollection(WorksheetChartDataSource dataSource)
{
this.DataSource = dataSource;
this.serials = dataSource.serials;
}
public WorksheetChartDataSerial this[int index]
{
get
{
return this.serials[index];
}
set
{
this.serials[index] = value;
this.DataSource.UpdateCategoryCount(value);
}
}
public int Count
{
get
{
return this.serials.Count;
}
}
public bool IsReadOnly
{
get
{
return false;
}
}
public void Add(WorksheetChartDataSerial serial)
{
this.DataSource.Add(serial);
}
public void Clear()
{
this.serials.Clear();
}
public bool Contains(WorksheetChartDataSerial item)
{
return this.serials.Contains(item);
}
public void CopyTo(WorksheetChartDataSerial[] array, int arrayIndex)
{
this.serials.CopyTo(array, arrayIndex);
}
public IEnumerator<WorksheetChartDataSerial> GetEnumerator()
{
return this.serials.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return this.serials.GetEnumerator();
}
public int IndexOf(WorksheetChartDataSerial item)
{
return this.serials.IndexOf(item);
}
public void Insert(int index, WorksheetChartDataSerial serial)
{
this.serials.Insert(index, serial);
this.DataSource.UpdateCategoryCount(serial);
}
public bool Remove(WorksheetChartDataSerial serial)
{
return this.serials.Remove(serial);
}
public void RemoveAt(int index)
{
this.serials.RemoveAt(index);
}
private List<WorksheetChartDataSerial> serials;
}
}