本文整理汇总了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);
}
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}