private void ClickItem(Point p, bool h, bool r, bool s, UIElement element) { if (r) { element.Parent.Children.ForEach(e => { HideElement(e); if (element.Id.StartsWith(e.Id)) { ShowElement(e, true); } else if (e.Id.StartsWith(element.Id) && e.Z == element.Z + 1) { ShowElement(e); } else if (e.Z <= element.Z && element.Id.Split('.') is string[] elm && e.Id.Split('.') is string[] el) { if (el.Length == 2 && el[0] == elm[0]) { ShowElement(e); } if (el.Length == 3 && el[1] == elm[1]) { ShowElement(e); } if (el.Length == 4 && el[2] == elm[2]) { ShowElement(e); } if (el.Length == 5 && el[3] == elm[3]) { ShowElement(e); } } }); if (FindMenuItem(menuItems, element.Id) is MenuItem item && item.Screen is UIElement screen) { InfoMenu.Clear(); InfoMenu.Add(InfoBack); InfoMenu.Add(screen); InfoMenu.UpdateBounds(); } } }