public override void SwapChildUp(ICoatingScheduleLogic upChild, ICoatingScheduleLogic lastLogic) { ICoatingScheduleLogic childProduct = upChild; Int32 currentIndex = ChildrenLogic.IndexOf(childProduct); if (currentIndex == 0) { ChildrenLogic.Remove(childProduct); Control.RemoveControl(childProduct.Control); ParentLogic.SwapChildUp(upChild, this); } else { ICoatingScheduleLogic swapProduct = ChildrenLogic[currentIndex - 1]; ChildrenLogic[currentIndex - 1] = childProduct; ChildrenLogic[currentIndex] = swapProduct; childProduct.SwapControls(swapProduct); } }
public override void SwapChildDown(ICoatingScheduleLogic downChild, ICoatingScheduleLogic lastParent) { ICoatingScheduleLogic childProduct = downChild; Int32 currentIndex = ChildrenLogic.IndexOf(childProduct); if (currentIndex == ChildrenLogic.Count - 1) // is at bottom { ChildrenLogic.Remove(childProduct); Control.RemoveControl(childProduct.Control); ParentLogic.SwapChildDown(downChild, this); } else { ICoatingScheduleLogic swapProduct = ChildrenLogic[currentIndex + 1]; ChildrenLogic[currentIndex + 1] = childProduct; ChildrenLogic[currentIndex] = swapProduct; childProduct.SwapControls(swapProduct); } }