51 lines
1.1 KiB
C#
51 lines
1.1 KiB
C#
namespace InspectionUI.ViewModels
|
|
{
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
|
|
public abstract class ItemsGridVM : VM, IEnumerable<ItemsGridRowVM>
|
|
{
|
|
private readonly List<ItemsGridRowVM> rows;
|
|
|
|
protected ItemsGridVM() : base()
|
|
{
|
|
this.rows = new List<ItemsGridRowVM>();
|
|
}
|
|
|
|
public IEnumerator<ItemsGridRowVM> GetEnumerator()
|
|
{
|
|
return this.rows.GetEnumerator();
|
|
}
|
|
|
|
IEnumerator IEnumerable.GetEnumerator()
|
|
{
|
|
return this.GetEnumerator();
|
|
}
|
|
|
|
protected void Add(ItemsGridRowVM item)
|
|
{
|
|
this.rows.Add(item);
|
|
}
|
|
|
|
protected void Clear()
|
|
{
|
|
foreach (var item in this.rows)
|
|
{
|
|
item.Dispose();
|
|
}
|
|
|
|
this.rows.Clear();
|
|
}
|
|
|
|
protected int IndexOf(ItemsGridRowVM item)
|
|
{
|
|
return this.rows.IndexOf(item);
|
|
}
|
|
|
|
protected void Insert(int index, ItemsGridRowVM item)
|
|
{
|
|
this.rows.Insert(index, item);
|
|
}
|
|
}
|
|
}
|