private void CreateVertMenuItem(NaviMenuBar naviMenuBar) { NaviMenuRelationship naviMenuRelationship = new NaviMenuRelationship(); // Load Root Menu VMAVertMenuItem rootVertMenuItem = new VMAVertMenuItem(); NaviMenuItem rootMenuItem = naviMenuBar.RootMenuItem; rootVertMenuItem.ItemMenuSource = rootMenuItem; this._flowVertNaviBar.Controls.Add(rootVertMenuItem); naviMenuRelationship.rootNode = rootVertMenuItem; rootVertMenuItem.Click += new EventHandler(rootMenuItem_Click); foreach (NaviMenuItem subMenuItem in naviMenuBar.SubMenuItems) { VMAVertMenuItem subVertMenItem = new VMAVertMenuItem(); subVertMenItem.ItemMenuSource = subMenuItem; this._flowVertNaviBar.Controls.Add(subVertMenItem); naviMenuRelationship.subNode.Add(subVertMenItem); if (rootMenuItem.CurrentExpandState == true) { subVertMenItem.Visible = true; } else { subVertMenItem.Visible = false; } subVertMenItem.Click += new EventHandler(subMenuItem_Click); } naviMenuRelationships.Add(naviMenuRelationship); }
private void UpdateSubMenuItemVisible(VMAVertMenuItem rootVMAMenuItem) { var vmaVertMenuItems = naviMenuRelationships.Where(ship => ship.rootNode == rootVMAMenuItem).Select(ship => new { ship.subNode }); foreach (var vmaVertMenuItem in vmaVertMenuItems) { foreach (VMAVertMenuItem subVertMenuItem in vmaVertMenuItem.subNode) { subVertMenuItem.Visible = !subVertMenuItem.Visible; } } }
private void subMenuItem_Click(object sender, EventArgs e) { Control homeContainer = _itemDisplayPage as Control; VMAVertMenuItem subVMAMenuItem = sender as VMAVertMenuItem; NaviMenuItem naviMenuItem = subVMAMenuItem.ItemMenuSource as NaviMenuItem; string pageName = naviMenuItem.MenuComponent; Assembly assembly = Assembly.GetExecutingAssembly(); object assemblyobj = assembly.CreateInstance(string.Format("mtsToolsConsole.Pages.{0}", pageName)); Control userPage = assemblyobj as Control; userPage.Dock = DockStyle.Fill; homeContainer.Controls.Clear(); homeContainer.Controls.Add(userPage); }
private void rootMenuItem_Click(object sender, EventArgs e) { VMAVertMenuItem rootVMAMenuItem = sender as VMAVertMenuItem; NaviMenuItem naviMenuItem = rootVMAMenuItem.ItemMenuSource as NaviMenuItem; if (naviMenuItem.CurrentExpandState == true) { naviMenuItem.CurrentExpandState = false; rootVMAMenuItem.ItemMenuSource = naviMenuItem; UpdateSubMenuItemVisible(rootVMAMenuItem); } else { naviMenuItem.CurrentExpandState = true; rootVMAMenuItem.ItemMenuSource = naviMenuItem; UpdateSubMenuItemVisible(rootVMAMenuItem); } }