private StatusContainer EnsureTarget(object target, object parent) { var sItem = _statusList.FirstOrDefault((s, mTarget) => s.Object == mTarget, target); if (sItem != null) { return(sItem); } sItem = new StatusContainer { Object = target, Parent = parent }; _statusList.Add(sItem); var gFuncInstance = new StatusAttributesContainer(target); _statusAttributeContainer.Add(gFuncInstance); var baseFunc = gFuncInstance.GetFuncByAttribute(); if (baseFunc != null) { sItem.AddStatusItemDelegate(baseFunc); baseFunc(); } return(sItem); }
private void EnsureParent(object parent) { if (parent == null || _statusList.FirstOrDefault((s, mParent) => s.Object == mParent, parent) != null) { return; } var sParent = new StatusContainer { Object = parent }; _statusList.Add(sParent); var gFuncInstance = new StatusAttributesContainer(parent); _statusAttributeContainer.Add(gFuncInstance); var parentFunc = gFuncInstance.GetFuncByAttribute(); if (parentFunc != null) { sParent.AddStatusItemDelegate(parentFunc); parentFunc(); } }