Exemplo n.º 1
0
        // Change elements

        public void SwapControl(int line, int controlNum, Control newControl)
        {
            LayoutElement lElement = elementList?[line].GetElement(controlNum);

            if (lElement == null)
            {
                throw new ArgumentException("The element doesn't exist");
            }

            GridElement gElem = lElement as GridElement;

            if (gElem != null)
            {
                gElem.control = newControl;
            }
            else if (lElement is BlankElement)
            {
                throw new NotSupportedException("Feature is not yet working");
            }
            else
            {
                throw new InvalidOperationException($"Unknown element type in List: {lElement.GetType().Name}");
            }
        }