41 lines
994 B
C#
41 lines
994 B
C#
![]() |
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>();
|
|||
|
}
|
|||
|
}
|