Ejemplo n.º 1
0
        public override void SwapChildUp(ICoatingScheduleLogic upChild, ICoatingScheduleLogic lastParent)
        {
            if (lastParent.GetType() == typeof(CoatingScheduleLine))
            {
                Int32 indexOfParent = ChildrenLogic.IndexOf((CoatingScheduleLine)lastParent);

                if (indexOfParent > 0) // if not at the top
                {
                    lastParent.RemoveLogic(upChild);
                    ChildrenLogic[indexOfParent - 1].AddControlToBottom(upChild);
                }
                else if (indexOfParent == 0)
                {
                    ParentLogic.SwapChildUp(upChild, this);
                }
                else
                {
                    throw new Exception("Invoking object not a member of current object");
                }
            }
            else
            {
                throw new Exception("Call received by a non-child control.");
            }
        }
Ejemplo n.º 2
0
 public override void PushUpChildren(ICoatingScheduleLogic upChild)
 {
     if (ChildrenLogic.Count > 0 && !ParentLogic.ChildIsTop(this))
     {
         ChildrenLogic.First().SwapUp();
     }
 }
Ejemplo n.º 3
0
 public override void DestroySelf()
 {
     for (Int32 index = 0; index < ChildrenLogic.Count; index++)
     {
         ChildrenLogic[index].Disconnect();
     }
     ParentLogic.RemoveLogic(this);
     ChildrenLogic.Clear();
     Disconnect();
 }
Ejemplo n.º 4
0
        public override bool ChildIsTop(ICoatingScheduleLogic child)
        {
            bool isTop = false;

            if (ChildrenLogic.Count > 0)
            {
                isTop = ChildrenLogic.First() == child;
                if (isTop)
                {
                    isTop = ParentLogic.ChildIsTop(this);
                }
            }
            return(isTop);
        }
Ejemplo n.º 5
0
        public override bool ChildIsTop(ICoatingScheduleLogic child)
        {
            bool isTop = false;

            if (child.GetType() == typeof(CoatingScheduleLine) && ChildrenLogic.Count > 0)
            {
                isTop = ChildrenLogic.First() == (CoatingScheduleLine)child;
                if (isTop)
                {
                    isTop = ParentLogic.ChildIsTop(this);
                }
            }
            else
            {
                throw new Exception("Child is not contained in this class.");
            }
            return(isTop);
        }
Ejemplo n.º 6
0
        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);
            }
        }
Ejemplo n.º 7
0
        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);
            }
        }
Ejemplo n.º 8
0
 public override void PushChildUp(ICoatingScheduleLogic upChild, ICoatingScheduleLogic lastParent)
 {
     ParentLogic.PushChildUp(upChild, this);
 }
Ejemplo n.º 9
0
 public override void PushUp()
 {
     ParentLogic.PushChildUp(this, null);
 }
Ejemplo n.º 10
0
 public override void PushDown()
 {
     ParentLogic.PushChildDown(this, null);
 }
Ejemplo n.º 11
0
 public override void SwapDown()
 {
     ParentLogic.SwapChildDown(this, null);
 }
Ejemplo n.º 12
0
 public override bool ChildIsTop(ICoatingScheduleLogic child)
 {
     return(ParentLogic.ChildIsTop(this));
 }
Ejemplo n.º 13
0
 public override void PushDown()
 {
     ParentLogic.PushDownChildren(this);
 }
Ejemplo n.º 14
0
 public override void SwapChildDown(ICoatingScheduleLogic downChild, ICoatingScheduleLogic lastParent)
 {
     ParentLogic.SwapChildDown(downChild, this);
 }
Ejemplo n.º 15
0
 public override void SwapChildUp(ICoatingScheduleLogic upChild, ICoatingScheduleLogic lastLogic)
 {
     ParentLogic.SwapChildUp(upChild, this);
 }
Ejemplo n.º 16
0
 public override void SwapUp()
 {
     ParentLogic.SwapChildUp(this, this);
 }
Ejemplo n.º 17
0
 public override void DestroySelf()
 {
     ParentLogic.RemoveLogic(this);
     Disconnect();
 }