private void updateMainMenus(NavItem navItem) { NavMenus.Clear(); udpateWidthAnimation(); if (navItem == null || navItem.Content == null) { CollapsedMsgPane(); updateIndicatorState(Visibility.Collapsed); } if (navItem != null) { //Show menu item description if (navItem.Content != null) { ShowMsgPane(navItem); } //Show subMenus and update indication state if (navItem.SubMenus != null) { NavMenus.Add(navItem.SubMenus); updateIndicatorState(Visibility.Visible); } else { updateIndicatorState(Visibility.Collapsed); } } }
private void updateSubMenus(NavItem navitem) { if (navitem == null) { return; } if (navitem.Command != null) { navitem.Command.Execute(null); } if (navitem.Content != null) { ShowMsgPane(navitem); } System.Diagnostics.Debug.WriteLine("Count " + NavMenus.Count + ", Index " + navitem.Index); //Clear old menus int rmIndex = 0, count = NavMenus.Count; rmIndex = navitem.SubMenus == null ? (navitem.Index) : (navitem.SubMenus[0].Index - 1); for (int i = rmIndex; i < count; ++i) { NavMenus.RemoveAt(rmIndex); } //Add new submenus int delayTime = 0; if (navitem.SubMenus != null) { NavMenus.Add(navitem.SubMenus); delayTime = 300; } if (count != NavMenus.Count) { udpateWidthAnimation(); } if (navitem.RunPath != null) { runProcess(navitem.RunPath, delayTime); } }