private void MoveValidationCalculation(int index)
{
_draggingItem.MinReorderIndex = 0;
_draggingItem.MaxReorderIndex = Items.Count;
if (Items[index] is Brick)
{
if (_draggingItem.IsGrouped == false)
{
if (Items[index] is BlockBeginBrick)
{
if (Items[index] is IfBrick)
{
_draggingItem.MinReorderIndex = CalcMinReorderIndex(index);
_draggingItem.MaxReorderIndex = Items.IndexOf((Items[index] as IfBrick).Else);
}
else if (Items[index] is ElseBrick)
{
_draggingItem.MinReorderIndex = Items.IndexOf((Items[index] as ElseBrick).Begin);
_draggingItem.MaxReorderIndex = Items.IndexOf((Items[index] as ElseBrick).End);
}
else
{
_draggingItem.MinReorderIndex = CalcMinReorderIndex(index);
_draggingItem.MaxReorderIndex = Items.IndexOf((Items[index] as BlockBeginBrick).End);
}
}
else if (Items[index] is BlockEndBrick)
{
if (Items[index] is EndIfBrick)
{
_draggingItem.MinReorderIndex = Items.IndexOf((Items[index] as EndIfBrick).Else);
}
else
{
_draggingItem.MinReorderIndex = Items.IndexOf((Items[index] as BlockEndBrick).Begin);
}
_draggingItem.MaxReorderIndex = CalcMaxReorderIndex(index);
}
}
_draggingItem.MinReorderIndex += 1;
_draggingItem.MaxReorderIndex -= 1;
}
CalcInvalidReorderIndexes();
}