public MenuMenuItem(IModelMenu info, SingleChoiceAction menuItemsAction) { this.Model = info; base.Id = info.Caption; base.Caption = info.MenuCaption; base.ImageName = info.ImageName; this.MenuItemsAction = menuItemsAction; }
public static ICollection<IModelGroup> Get_Groups(IModelMenu modelExtender) { CalculatedModelNodeList<IModelGroup> calculatedModelNodeList = new CalculatedModelNodeList<IModelGroup>(); calculatedModelNodeList.AddRange( from a in modelExtender.Application.Aurum().AurumLists().Groups select a); return calculatedModelNodeList; }
public static ICollection<IModelMenuItem> Get_AllItems(IModelMenu modelExtender) { CalculatedModelNodeList<IModelMenuItem> calculatedModelNodeList = new CalculatedModelNodeList<IModelMenuItem>(); IList<IModelMenuItem> collection = RecursiveHelper.ToList<IModelMenuItem>(modelExtender, delegate(IModelMenuItem a) { if (a is IModelMenu) { return a as IModelMenu; } if (a is IModelMenuTemplateLink) { return (a as IModelMenuTemplateLink).Template; } if (a is IModelMenuFolder) { return a as IModelMenuFolder; } return null; }, (IModelMenuItem a) => a is IModelMenuViewItem || a is IModelMenuActionItem); calculatedModelNodeList.AddRange(collection); return calculatedModelNodeList; }
public void InitializeItems(SingleChoiceAction action, IModelMenu startupMenuItem) { if (action == null || action.Items.Count <= 0) { return; } this.action = action; this.createMenus(startupMenuItem); }
private void createMenus(IModelMenu startupMenuItem) { this.BeginUpdate(); try { TreeListHelper.TreeListMenusItemsAdd(this.action, this.treeList1, this.imageList1); if (this.treeList1.FocusedNode == null) { if (startupMenuItem != null && startupMenuItem.StartupItem != null) { ChoiceActionItem choiceActionItem = this.action.Items.RecursiveFind((ChoiceActionItem a) => a.Items, delegate(ChoiceActionItem a) { ViewMenuItem viewMenuItem = a as ViewMenuItem; return viewMenuItem != null && viewMenuItem.Model == startupMenuItem.StartupItem; }); if (choiceActionItem != null && (!choiceActionItem.Active || !choiceActionItem.Enabled)) { choiceActionItem = this.action.Items.RecursiveFind((ChoiceActionItem a) => a.Items, (ChoiceActionItem a) => a.Active && a.Enabled && a is ViewMenuItem); } if (choiceActionItem != null) { string itemPath = choiceActionItem.GetItemPath(); TreeListNode treeListNode = this.treeList1.FindNodeByFieldValue("ItemPath", itemPath); if (treeListNode != null) { this.treeList1.SetFocusedNode(treeListNode); } } else { this.treeList1.SetFocusedNode(this.treeList1.Nodes.FirstNode); } } else { this.treeList1.SetFocusedNode(this.treeList1.Nodes.FirstNode); } } } finally { this.EndUpdate(); } }
private static bool CheckMenuGroup(IModelMenu menuNode) { if (menuNode.Group == null) { return true; } if (HasGroup != null) { return HasGroup(menuNode.Group.Id); } return false; }