static public List <MenuBase> MenuUp() { if (currentMenuLeaf != null) { var menuList = (currentMenuLeaf as MenuLeaf).GetChildLeafs(); currentMenuLeaf = (currentMenuLeaf as MenuLeaf).GetparentLeaf() as MenuLeaf; return(menuList); } else { return(RootMenus); } }
static public List <MenuBase> MenuSelected(object menuItem) { if (menuItem is MenuNode) { (menuItem as MenuNode).DoMyOwnFuncution(); return(null); } if (menuItem is MenuLeaf) { currentMenuLeaf = (menuItem as MenuBase).GetparentLeaf() as MenuLeaf; return((menuItem as MenuLeaf).GetChildLeafs()); } return(null); }
static private MenuBase GenerateMenuLeaf(XmlNode menuLeaf, MenuBase parentNode) { if (menuLeaf == null || !menuLeaf.HasChildNodes) { return(null); } string Name = menuLeaf.SelectSingleNode("Name").InnerText; MenuLeaf thisLeaf = new MenuLeaf(parentNode, null, Name); List <MenuBase> ChildNodes = new List <MenuBase>(); foreach (XmlNode node in menuLeaf.ChildNodes) { if (node.Name == "MenuLeaf" && node.HasChildNodes) { ChildNodes.Add(GenerateMenuLeaf(node, thisLeaf)); } else if (node.Name == "MenuNode") { ChildNodes.Add(GenerateMenuNode(node, thisLeaf)); } } thisLeaf.SetChildLeafs(ChildNodes); return(thisLeaf); }
static public List <MenuBase> GetStarted(string xmlPath) { currentMenuLeaf = null; RootMenus = GenerateMenu(xmlPath); return(RootMenus); }
static public List <MenuBase> GoToRootMenu() { currentMenuLeaf = null; return(RootMenus); }