Example #1
0
        private void InitializeMenu()
        {
            using (AdministratorBLL adminBLL = new AdministratorBLL())
            {
                List <MenuAuthentication> menuList = adminBLL.GetMenuAuthentication(this.UserID);
                if (menuList == null)
                {
                    return;
                }

                string newGroup = "";

                NavBarGroup menuGroup = new NavBarGroup();
                NavBarItem  menuItem;
                Bitmap      img = null;

                this.navBarControl1.BeginUpdate();
                this.navBarControl1.Groups.Clear();


                foreach (MenuAuthentication menu in menuList)
                {
                    if (newGroup != menu.ProgramType)
                    {
                        menuGroup = this.navBarControl1.Groups.Add();
                        //Create Group
                        menuGroup.Name                 = menu.ProgramType;
                        menuGroup.Caption              = menu.ProgramTypeName;
                        menuGroup.Appearance.Font      = UiUtility.MenuGroupFont();
                        menuGroup.GroupCaptionUseImage = NavBarImage.Small;

                        img = base.Language.GetBitmap(menu.ProgramTypeImage);
                        if (img != null)
                        {
                            menuGroup.SmallImage = img;
                        }
                        //menuGroup.GroupStyle = NavBarGroupStyle.LargeIconsText;
                        menuGroup.GroupStyle = NavBarGroupStyle.SmallIconsText;

                        newGroup = menu.ProgramType;
                    }

                    menuItem         = new NavBarItem();
                    menuItem.Name    = menu.ProgramID + "_" + menu.ProgramKey;
                    menuItem.Hint    = menu.ProgramName;
                    menuItem.Caption = menu.ProgramName;
                    // menuItem.Appearance.Font = UiUtility.MenuItemFont();

                    img = base.Language.GetBitmap(menu.IconImage);
                    if (img != null)
                    {
                        menuItem.SmallImage = img;
                    }


                    menuItem.LinkClicked += new NavBarLinkEventHandler(this.MenuItem_LinkClicked);

                    menuGroup.ItemLinks.Add(menuItem);
                }


                menuGroup = this.navBarControl1.Groups.Add();
                //Create Group
                menuGroup.Name                 = "mnuLogOff";
                menuGroup.Caption              = "LOG OFF";
                menuGroup.Appearance.Font      = UiUtility.MenuGroupFont();
                menuGroup.GroupCaptionUseImage = NavBarImage.Small;

                img = base.Language.GetBitmap("LogOff");
                if (img != null)
                {
                    menuGroup.SmallImage = img;
                }

                menuGroup.GroupStyle = NavBarGroupStyle.Default;
                this.navBarControl1.EndUpdate();
            }
        }