示例#1
0
            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);
            }
示例#2
0
            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();
                }
            }