Beispiel #1
0
        /// <summary>
        /// 初始化菜单
        /// </summary>
        void InitMenu(DevComponents.DotNetBar.ButtonItem item, INavigateGroup m_Group)
        {
            IList <INavigateGroup> m_GroupList = navigationProxy.GetGroupList(m_Group == null ? string.Empty : m_Group.ID);
            int mask = (int)GroupType.Windows;

            //1.处理下级组。
            foreach (INavigateGroup var in m_GroupList)
            {
                if ((var.Attributes & mask) == mask)
                {
                    DevComponents.DotNetBar.ButtonItem miMan = new DevComponents.DotNetBar.ButtonItem();
                    miMan.Text          = var.Name;
                    miMan.Image         = imageList1.Images[0];
                    miMan.ImagePosition = eImagePosition.Left;
                    miMan.ButtonStyle   = eButtonStyle.ImageAndText;
                    miMan.Tag           = var.Attributes;

                    if (item == null)
                    {
                        this.barMenu.Items.Add(miMan);
                    }
                    else
                    {
                        item.SubItems.Add(miMan);
                    }

                    this.InitMenu(miMan, var);
                }
            }

            //2.增加功能插件
            if (m_Group != null)  //功能节点
            {
                IList <INavigateModule> m_moduleList = navigationProxy.GetModuleList(m_Group.ID);
                foreach (INavigateModule module in m_moduleList)
                {
                    DevComponents.DotNetBar.ButtonItem miSub = new DevComponents.DotNetBar.ButtonItem();
                    miSub.Image  = imageList1.Images[1];
                    miSub.Text   = module.Name;
                    miSub.Tag    = module;
                    miSub.Click += new EventHandler(miSub_Click);
                    item.SubItems.Add(miSub);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// 普通用户导航初始化。
        /// </summary>
        private void InitializeNavigationPublic(TreeNode node, INavigateGroup Group)
        {
            int mask  = (int)GroupType.Windows;
            int mask2 = (int)GroupType.Expend;

            IList <INavigateGroup> groupList = navigationProxy.GetGroupList(Group == null ? Guid.Empty.ToString() : Group.ID);

            foreach (INavigateGroup var in groupList) //下级组
            {
                if ((var.Attributes & mask) == mask)
                {
                    TreeNode subNode = new TreeNode(var.Name, 0, 1);
                    this.InitializeNavigationPublic(subNode, var);
                    node.Nodes.Add(subNode);

                    if ((var.Attributes & mask2) == mask2)
                    {
                        node.Expand();
                    }
                }
            }

            if (Group != null)  //功能节点
            {
                TreeNode itemNode = null;

                IList <INavigateModule> moduleList = navigationProxy.GetModuleList(Group.ID);

                foreach (INavigateModule mv in moduleList)
                {
                    itemNode     = new TreeNode(mv.Name, 2, 2);
                    itemNode.Tag = mv;
                    node.Nodes.Add(itemNode);
                }
            }
        }