Esempio n. 1
0
        private static void ProcessMenuItems(XElement element, Control parent, ref Form form)
        {
            foreach (var node in element.Elements())
            {
                var xElement = node as XElement;
                var subMenuParent = (parent as SubMenu);
                var menuParent = (parent as Menu);
                if (xElement != null)
                {
                    ControlType controlType;
                    Enum.TryParse(xElement.Name.LocalName, true, out controlType);
                    if (controlType == ControlType.MenuItem)
                    {
                        if (subMenuParent != null)
                        {
                            //TODO work out if the below custom add call is needed/wanted, seems out of place
                            subMenuParent.Add(CreateMenuItemFromElement(xElement),null);
                        }
                        if (menuParent != null)
                        {
                            menuParent.Items.Add(CreateMenuItemFromElement(xElement));
                        }
                    }
                    if (controlType == ControlType.SubMenu)
                    {
                        if (subMenuParent != null)
                        {
                            var subMenu = CreateSubMenuFromElement(xElement, ref form);
                            subMenuParent.Add(CreateMenuItemFromElement(xElement),subMenu);
                            ProcessMenuItems(xElement, subMenu, ref form);
                        }
                        if (menuParent != null)
                        {
                            var subMenu = CreateSubMenuFromElement(xElement, ref form);
                            menuParent.Add(CreateMenuItemFromElement(xElement), subMenu);
                            ProcessMenuItems(xElement, subMenu, ref form);
                        }

                    }
                }
                else
                {
                    return;
                }

            }
        }
 public void Remove(Control control)
 {
     control.Dispose();
     controls.Remove(control);
 }
Esempio n. 3
0
 public void Remove(Control control)
 {
     controls.Remove(control);
 }
 public void Add(Control control)
 {
     control.Owner = Owner;
     control.FontName = Owner.FontName;
     controls.Add(control);
 }
Esempio n. 5
0
 public void Add(Control Cont)
 {
 }