コード例 #1
0
        private void LoadMenu()
        {
            ArrayList NavItems = new ArrayList();

            //string path = ConfigurationManager.AppSettings["MenuConfiguration"];
            string path = Application.StartupPath + @"\Menu.xml";
            XElement menus = XElement.Load(path);
            foreach (var menu in menus.Elements("SalesManMenu"))
            {
                string menuItem = menu.Attribute("name").Value;
                string eventCode = menu.Attribute("eventCode").Value;
                NavBar.NavItem nv = new NavBar.NavItem(menuItem, eventCode);
                if (menuItem == "信息管理")
                {
                    nv.Selected = true;
                }
                ArrayList childNavItems = new ArrayList();
                foreach (var childMenu in menu.Elements())
                {
                    childNavItems.Add(new NavBar.childNavItems(childMenu.Value, childMenu.Attribute("eventCode").Value));
                }
                nv.childNavItems = childNavItems;

                NavItems.Add(nv);
            }
            navBarForSalesMan.MenuItems = NavItems;
            navBarForSalesMan.RenderMenu();
            navBarForSalesMan.OnMenuSelection += new EventHandler(childbtnbtn_Click);
        }
コード例 #2
0
 private void LoadMenu()
 {
     ArrayList NavItems = new ArrayList();
     string path = Application.StartupPath + @"\Menu.xml";
     XElement menus = XElement.Load(path);
     foreach (var menu in menus.Elements("DesignerManagerMenu"))
     {
         string menuItem = menu.Attribute("name").Value;
         string eventCode = menu.Attribute("eventCode").Value;
         NavBar.NavItem nv = new NavBar.NavItem(menuItem, eventCode);
         if (eventCode == "CustomerChat")
         {
             nv.Selected = true;
         }
         ArrayList childNavItems = new ArrayList();
         foreach (var childMenu in menu.Elements())
         {
             childNavItems.Add(new NavBar.childNavItems(childMenu.Value, childMenu.Attribute("eventCode").Value));
         }
         nv.childNavItems = childNavItems;
         NavItems.Add(nv);
     }
     navBarForDesignerManager.MenuItems = NavItems;
     navBarForDesignerManager.RenderMenu();
     navBarForDesignerManager.OnMenuSelection += new EventHandler(childbtnbtn_Click);
 }