public static void FillResult(this IEnumerable <IOguObject> objs, List <IOguObject> queryResult, UserGraphControlObjectMask listMask, Func <IOguObject, bool> filter = null, Action <IOguObject, IOguObject> addedAction = null) { objs.ForEach(obj => { if (((int)obj.ObjectType & (int)listMask) != 0) { bool canAdd = true; if (filter != null) { canAdd = filter(obj); } if (canAdd) { IOguObject newObj = OguBase.CreateWrapperObject(obj); if (addedAction != null) { addedAction(obj, newObj); } queryResult.Add(newObj); } } } ); }
public static void FillChildNodes(this IEnumerable <IOguObject> children, List <UserGraphTreeNode> childNodes, UserGraphControlObjectMask listMask, Func <IOguObject, bool> filter = null, Action <IOguObject, UserGraphTreeNode> addedAction = null) { children.ForEach(child => { if (((int)child.ObjectType & (int)listMask) != 0) { bool canAdd = true; if (filter != null) { canAdd = filter(child); } if (canAdd) { UserGraphTreeNode treeNode = child.ToTreeNode(); if (addedAction != null) { addedAction(child, treeNode); } childNodes.Add(treeNode); } } } ); }