当前位置: 首页>>代码示例>>C#>>正文


C# Role.IsMenuAllowed方法代码示例

本文整理汇总了C#中Role.IsMenuAllowed方法的典型用法代码示例。如果您正苦于以下问题:C# Role.IsMenuAllowed方法的具体用法?C# Role.IsMenuAllowed怎么用?C# Role.IsMenuAllowed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Role的用法示例。


在下文中一共展示了Role.IsMenuAllowed方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InitializeMenuChildren

        private void InitializeMenuChildren(ToolStripMenuItem pMenuItem, Role pRole)
        {
            if (!pMenuItem.HasDropDownItems)
            {
                return;
            }
            foreach (Object tsmi in pMenuItem.DropDownItems)
            {
                if (!(tsmi is ToolStripMenuItem))
                    continue;

                ToolStripMenuItem tsmiMenu = (ToolStripMenuItem)tsmi;

                MenuObject foundMO = GetMenuObject(tsmiMenu.Name);
                bool isAllowed = foundMO == null || pRole.IsMenuAllowed(foundMO);
                tsmiMenu.Enabled = isAllowed;
                tsmiMenu.Tag = foundMO;

                InitializeMenuChildren(tsmiMenu, pRole);
            }
        }
开发者ID:BillTheBest,项目名称:opencbs,代码行数:21,代码来源:LotrasmicMainWindowForm.cs

示例2: InitActionTree

        private void InitActionTree(Role pRole)
        {
            trvMenuItems.Nodes.Clear();

            TreeNode root = new TreeNode(MultiLanguageStrings.GetString(Ressource.FrmRoles, "menu_item.Text"));
            trvMenuItems.Nodes.Add(root);

            foreach (ToolStripMenuItem mi in (_mdiParent).MainMenuStrip.Items)
            {
                if (string.IsNullOrEmpty(mi.Text) || mi.Tag == null) continue;

                TreeNode mainNode = new TreeNode(mi.Text) {Tag = mi.Tag};
                mainNode.Checked = pRole.IsMenuAllowed(mainNode.Tag as MenuObject);
                mainNode.Expand();
                root.Nodes.Add(FillChildNodes(mainNode, mi, pRole));
            }
            root.Expand();
            Invalidate();
        }
开发者ID:evgeniyabdukarimov,项目名称:opencbs,代码行数:19,代码来源:FrmRoles.cs

示例3: FillChildNodes

        private TreeNode FillChildNodes(TreeNode pParent, ToolStripMenuItem pMenuItem, Role pRole)
        {
            if (!pMenuItem.HasDropDownItems)
            {
                MenuObject menuObject;
                var lastChildNode = AddMenuItemFromMenu(pMenuItem, out menuObject);
                if (menuObject != null)
                    lastChildNode.Checked = pRole.IsMenuAllowed(menuObject);
                return lastChildNode;
            }

            foreach (Object tsmi in pMenuItem.DropDownItems)
            {
                if (!(tsmi is ToolStripMenuItem))
                    continue;
                ToolStripMenuItem tsmiMenu = (ToolStripMenuItem)tsmi;
                MenuObject menuObject;

                var childNode = AddMenuItemFromMenu(tsmiMenu, out menuObject);
                if (menuObject == null) continue;

                childNode.Checked = pRole.IsMenuAllowed(menuObject);
                childNode.Collapse(true);
                FillChildNodes(childNode, tsmiMenu, pRole);
                pParent.Nodes.Add(childNode);
                pParent.Collapse(true);
            }
            return pParent;
        }
开发者ID:evgeniyabdukarimov,项目名称:opencbs,代码行数:29,代码来源:FrmRoles.cs

示例4: _InitializeMenuChildren

        private void _InitializeMenuChildren(ToolStripMenuItem pMenuItem, Role pRole)
        {
            if (!pMenuItem.HasDropDownItems)
            {
                return;
            }
            foreach (Object tsmi in pMenuItem.DropDownItems)
            {
                if (! (tsmi is ToolStripMenuItem))
                    continue;

                ToolStripMenuItem tsmi_menu = (ToolStripMenuItem)tsmi;
                MenuObject foundMO = GetMenuObject(tsmi_menu.Text);
                tsmi_menu.Enabled = pRole.IsMenuAllowed(foundMO);
                tsmi_menu.Tag = foundMO;
                _InitializeMenuChildren(tsmi_menu, pRole);
            }
            return;
        }
开发者ID:Ramazanov,项目名称:FomsNet,代码行数:19,代码来源:LotrasmicMainWindowForm.cs

示例5: _FillChildNodes

        private TreeNode _FillChildNodes(TreeNode pParent, ToolStripMenuItem pMenuItem, Role pRole)
        {
            if (!pMenuItem.HasDropDownItems)
            {
                TreeNode lastChildNode = new TreeNode(pMenuItem.Text);
                lastChildNode.Tag = GetMenuObject(pMenuItem.Text);
                lastChildNode.Checked = pRole.IsMenuAllowed(lastChildNode.Tag as MenuObject);
                return lastChildNode;
            }

            foreach (Object tsmi in pMenuItem.DropDownItems)
            {
                if (!(tsmi is ToolStripMenuItem))
                    continue;
                ToolStripMenuItem tsmiMenu = (ToolStripMenuItem)tsmi;
                TreeNode childNode = new TreeNode(tsmiMenu.Text);
                childNode.Tag = GetMenuObject(tsmiMenu.Text);
                childNode.Checked = pRole.IsMenuAllowed(childNode.Tag as MenuObject);
                childNode.Collapse(true);
                _FillChildNodes(childNode, tsmiMenu, pRole);
                pParent.Nodes.Add(childNode);
                pParent.Collapse(true);
            }
            return pParent;
        }
开发者ID:Ramazanov,项目名称:FomsNet,代码行数:25,代码来源:FrmRoles.cs

示例6: InitActionTree

        private void InitActionTree(Role pRole)
        {
            trvMenuItems.Nodes.Clear();

            TreeNode root = new TreeNode("Пункты меню");
            trvMenuItems.Nodes.Add(root);

            foreach (ToolStripMenuItem mi in (_mdiParent).MainMenuStrip.Items)
            {
                if (mi is ToolStripSeparator)
                    continue;

                if (!string.IsNullOrEmpty(mi.Text) && mi.Tag!=null)
                {
                    TreeNode mainNode = new TreeNode(mi.Text);
                    mainNode.Tag = mi.Tag;
                    mainNode.Checked = pRole.IsMenuAllowed(mainNode.Tag as MenuObject);
                    mainNode.Expand();
                    root.Nodes.Add(_FillChildNodes(mainNode, mi, pRole));
                }
            }
            root.Expand();
            Invalidate();
        }
开发者ID:Ramazanov,项目名称:FomsNet,代码行数:24,代码来源:FrmRoles.cs


注:本文中的Role.IsMenuAllowed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。