private int? GetNextCuePosition()
{
if (this.cues.Count <= 0)
// Nothing to do
return null;
int newPos = this.currentCuePos + direction;
if (newPos < 0)
{
if (this.cues.Count == 1)
// Nothing to go to
return null;
if (!this.iterationsLeft.HasValue || this.iterationsLeft.GetValueOrDefault() > 0)
{
// Start new
newPos = 1;
}
else
return null;
}
if (newPos >= this.cues.Count)
{
if (this.cues.Count == 1)
// Nothing to go to
return null;
// Check for bounce/iteration/loop
if (this.bounce)
{
newPos = this.cues.Count - 2;
}
else
{
if (this.iterationsLeft.HasValue)
{
if (this.iterationsLeft.GetValueOrDefault() <= 1)
return null;
}
newPos = 0;
}
}
return newPos;
}