/// <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); }
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); }
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); }
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); } }
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); }
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(); }
public void RemoveControl(ICoatingScheduleControl child) { ProductControlBase removeControl = (ProductControlBase)child; ProductControls.Remove(removeControl); }
public void RemoveControl(ICoatingScheduleControl child) { LineControls.Remove((LineControl)child); child.DestroySelf(); }
public override ICoatingScheduleControl SwapControlWithTop(ICoatingScheduleControl newControl) { throw new NotImplementedException(); }
public override void RemoveControl(ICoatingScheduleControl child) { throw new NotImplementedException(); }
public void Connect(ICoatingScheduleControl control) { Control = control; control.Connect(this); control.UpdateControlData(); }
public void Connect(ICoatingScheduleControl parent) { ParentControl = parent as CoatingScheduleWindow; }
public abstract void Connect(ICoatingScheduleControl parent);