private void SetOwner(Topic owner) { if (_owner != owner) { if (_owner != null) { //TODO: something } _owner = owner; if (_owner != null) { for (int i = _decl._pins.Count - 1; i >= 0; i--) { var ts = new TopicSetter(Engine, this, _decl._pins[i]); if ((_decl._pins[i].flags & DeclInstance.Flags.input) == DeclInstance.Flags.input) { base.DefineProperty(_decl._pins[i].name, new PropertyDescriptor(ts, null, PropertyAttributes.IsAccessorProperty | PropertyAttributes.NonEnumerable), true); } else { base.DefineProperty(_decl._pins[i].name, new PropertyDescriptor(ts, ts, PropertyAttributes.IsAccessorProperty | PropertyAttributes.NonEnumerable | PropertyAttributes.Writable), true); } } if (_decl.InitFunc != null) { _decl.InitFunc.Call(this, owner.path); } _owner.children.changed += children_changed; if (_decl.CalcFunc != null) { _decl.CalcFunc.Call(this, _owner.name); } } } }
private void SetOwner(Topic owner) { if(_owner!=owner) { if(_owner!=null) { //TODO: something } _owner=owner; if(_owner!=null) { for(int i=_decl._pins.Count-1; i>=0; i--) { var ts=new TopicSetter(Engine, this, _decl._pins[i]); if((_decl._pins[i].flags & DeclInstance.Flags.input)==DeclInstance.Flags.input) { base.DefineProperty(_decl._pins[i].name, new PropertyDescriptor(ts, null, PropertyAttributes.IsAccessorProperty | PropertyAttributes.NonEnumerable), true); } else { base.DefineProperty(_decl._pins[i].name, new PropertyDescriptor(ts, ts, PropertyAttributes.IsAccessorProperty | PropertyAttributes.NonEnumerable | PropertyAttributes.Writable), true); } } if(_decl.InitFunc!=null) { _decl.InitFunc.Call(this, owner.path); } _owner.children.changed+=children_changed; if(_decl.CalcFunc!=null) { _decl.CalcFunc.Call(this, _owner.name); } } } }