Exemplo n.º 1
0
        /// <summary>
        /// This function swaps two controls. If the two controls are both children of the same parent, it returns true.
        /// </summary>
        /// <param name="oldControl"></param>
        /// <param name="newControl"></param>
        /// <returns></returns>
        public bool SwapChildControl(ICoatingScheduleControl oldControl, ICoatingScheduleControl newControl)
        {
            bool sameParent = false;

            try
            {
                Int32 oldIndex = ProductControls.IndexOf((ProductControlBase)oldControl);
                Int32 newIndex = ProductControls.IndexOf((ProductControlBase)newControl);

                if (oldIndex >= 0 && newIndex >= 0)
                {
                    sameParent = true;
                }

                if (oldIndex >= 0)
                {
                    ProductControls[oldIndex] = (ProductControlBase)newControl;
                }
                if (newIndex >= 0)
                {
                    ProductControls[newIndex] = (ProductControlBase)oldControl;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            return(sameParent);
        }
Exemplo n.º 2
0
        public ICoatingScheduleControl SwapControlWithTop(ICoatingScheduleControl newControl)
        {
            // TODO: Instead of swapping, create a new one with the old logic
            ICoatingScheduleControl returnControl = null;

            returnControl      = ProductControls.First();
            ProductControls[0] = (ProductControlBase)newControl;

            return(returnControl);
        }
Exemplo n.º 3
0
        public ICoatingScheduleControl SwapControlWithBottom(ICoatingScheduleControl newControl)
        {
            // TODO: Instead of swapping, create a new one with the old logic
            ICoatingScheduleControl returnControl = null;

            returnControl = ProductControls.Last();
            ProductControls[ProductControls.Count - 1] = (ProductControlBase)newControl;

            return(returnControl);
        }
Exemplo n.º 4
0
        public void SwapControls(ICoatingScheduleLogic other)
        {
            ICoatingScheduleControl otherControlParent   = other.ParentLogic.Control;
            ICoatingScheduleControl currentControlParent = ParentLogic.Control;

            ICoatingScheduleControl thisControl = Control;
            ICoatingScheduleControl thatControl = other.Control;

            bool sameParent = otherControlParent.SwapChildControl(thatControl, thisControl);

            if (!sameParent)
            {
                currentControlParent.SwapChildControl(thisControl, thatControl);
            }
        }
Exemplo n.º 5
0
        public bool SwapChildControl(ICoatingScheduleControl oldControl, ICoatingScheduleControl newControl)
        {
            bool replaced = false;

            try
            {
                Int32 index = LineControls.IndexOf((LineControl)oldControl);
                if (index >= 0)
                {
                    LineControls[index] = (LineControl)newControl;
                    replaced            = true;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            return(replaced);
        }
        public ICoatingScheduleControl SwapControlWithBottom(ICoatingScheduleControl newControl)
        {
            ICoatingScheduleControl returnControl = null;

            if (ShiftControls.Count == 0)
            {
                return(null);
            }

            if (newControl.GetType() == ShiftControls.Last().GetType())
            {
                returnControl = ShiftControls.Last();
                ShiftControls[ShiftControls.Count - 1] = (ShiftControl)newControl;
            }
            else
            {
                returnControl = ShiftControls.Last().SwapControlWithBottom(newControl);
            }
            return(returnControl);
        }
Exemplo n.º 7
0
        public ICoatingScheduleControl SwapControlWithTop(ICoatingScheduleControl newControl)
        {
            ICoatingScheduleControl returnControl = null;

            if (LineControls.Count == 0)
            {
                return(null);
            }

            if (newControl.GetType() == LineControls.Last().GetType())
            {
                returnControl   = LineControls.First();
                LineControls[0] = (LineControl)newControl;
            }
            else
            {
                returnControl = LineControls.First().SwapControlWithTop(newControl);
            }
            return(returnControl);
        }
 public abstract void RemoveControl(ICoatingScheduleControl child);
 public void Connect(ICoatingScheduleControl parent)
 {
     ParentControl = parent;
 }
 public bool SwapChildControl(ICoatingScheduleControl oldControl, ICoatingScheduleControl newControl)
 {
     throw new Exception("Cannot swap children.");
 }
 public abstract ICoatingScheduleControl SwapControlWithTop(ICoatingScheduleControl newControl);
 public bool SwapChildControl(ICoatingScheduleControl oldControl, ICoatingScheduleControl newControl)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 13
0
        public void RemoveControl(ICoatingScheduleControl child)
        {
            ProductControlBase removeControl = (ProductControlBase)child;

            ProductControls.Remove(removeControl);
        }
Exemplo n.º 14
0
 public void RemoveControl(ICoatingScheduleControl child)
 {
     LineControls.Remove((LineControl)child);
     child.DestroySelf();
 }
Exemplo n.º 15
0
 public override ICoatingScheduleControl SwapControlWithTop(ICoatingScheduleControl newControl)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 16
0
 public override void RemoveControl(ICoatingScheduleControl child)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 17
0
 public void Connect(ICoatingScheduleControl control)
 {
     Control = control;
     control.Connect(this);
     control.UpdateControlData();
 }
Exemplo n.º 18
0
 public void Connect(ICoatingScheduleControl parent)
 {
     ParentControl = parent as CoatingScheduleWindow;
 }
 public abstract void Connect(ICoatingScheduleControl parent);