public static SideMenuInfo CreateFrom(SideMenu sm) { return(new SideMenuInfo { Inframe = sm.Inframe, DropSwitch = sm.DropSwitch, Area = sm.Area, Code = sm.Code, Icon = sm.Icon, Action = sm.Action, Controller = sm.Controller, FullScreen = sm.FullScreen, ChildNodes = new Collection <SideMenuInfo>() }); }
private static Collection <SideMenu> ReadAllNodes(XElement root) { Collection <SideMenu> childNodes = new Collection <SideMenu>(); foreach (var p in root.Elements("Menu")) { SideMenu menu = new SideMenu { Code = p.Attribute("Code")?.Value, ParentCode = p.Attribute("ParentCode")?.Value, Icon = p.Attribute("Icon")?.Value, Action = p.Attribute("Action")?.Value, Controller = p.Attribute("Controller")?.Value, Area = p.Attribute("Area")?.Value, DropSwitch = bool.Parse(p.Attribute("DropSwitch")?.Value ?? "false"), Inframe = bool.Parse(p.Attribute("Inframe")?.Value ?? "false"), FullScreen = bool.Parse(p.Attribute("FullScreen")?.Value ?? "false") }; childNodes.Add(menu); } return(childNodes); }