CPF/CPF.ReoGrid/AutoFillSection.cs

41 lines
994 B
C#
Raw Permalink Normal View History

2024-06-24 10:15:59 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
namespace CPF.ReoGrid
{
public class AutoFillSection
{
public AutoFillSection(IAutoFillSectionEntry entry)
{
this.entries.Add(entry);
}
public bool TryAdd(IAutoFillSectionEntry entry)
{
bool flag = this.entries.First<IAutoFillSectionEntry>().IsSequenceOf(entry);
bool result;
if (flag)
{
this.entries.Add(entry);
result = true;
}
else
{
result = false;
}
return result;
}
public object[] GetValues(int iteration)
{
object baseValue = this.entries.First<IAutoFillSectionEntry>().Value;
object incrementPerIteration = this.entries.Last<IAutoFillSectionEntry>().GetIncrementPerIteration(baseValue, this.entries.Count);
return (from entry in this.entries
select entry.GetIterationValue(baseValue, incrementPerIteration, iteration)).ToArray<object>();
}
private readonly List<IAutoFillSectionEntry> entries = new List<IAutoFillSectionEntry>();
}
}