public IEnumerableMenu(string fileName, object controler)
 {
     xmlReaderMenu = new XmlReaderMenu(fileName);
     IEnumerable<XElement> xE = xmlReaderMenu.xDoc.Element("menu").Elements("menuItem");
     foreach (XElement xElement in xE)
     {
         consoleMenu.MenuItems.Add(new ConsoleMenu.ConsoleMenuItem()
         {
             Key = xElement.Attribute("Key").Value,
             Description = xElement.Attribute("Description").Value,
             Visible = Convert.ToBoolean(xElement.Attribute("Visible").Value),
             Action = (MenuFunctionHandler)Delegate.CreateDelegate(typeof(MenuFunctionHandler),
             controler, xElement.Attribute("Action").Value, false, true)
         }
         );
     }
 }
Exemple #2
0
        public IEnumerableMenu(string fileName, object controler)
        {
            xmlReaderMenu = new XmlReaderMenu(fileName);
            IEnumerable <XElement> xE = xmlReaderMenu.xDoc.Element("menu").Elements("menuItem");

            foreach (XElement xElement in xE)
            {
                consoleMenu.MenuItems.Add(new ConsoleMenu.ConsoleMenuItem()
                {
                    Key         = xElement.Attribute("Key").Value,
                    Description = xElement.Attribute("Description").Value,
                    Visible     = Convert.ToBoolean(xElement.Attribute("Visible").Value),
                    Action      = (MenuFunctionHandler)Delegate.CreateDelegate(typeof(MenuFunctionHandler),
                                                                               controler, xElement.Attribute("Action").Value, false, true)
                }
                                          );
            }
        }