Example #1
0
        public bool RegisterDynamicProperty(IDynamicProperty prop)
        {
            lock (this)
            {
                if (FindProperty(prop.Name) != -1)
                {
                    throw new InvalidOperationException("Another property by this name already exists");
                }

                // Make a copy, do not interfere with threads running dynamic sinks
                ArrayList newProps = new ArrayList(_properties);

                DynamicPropertyReg reg = new DynamicPropertyReg();
                reg.Property = prop;
                IContributeDynamicSink contributor = prop as IContributeDynamicSink;
                if (contributor != null)
                {
                    reg.Sink = contributor.GetDynamicSink();
                }
                newProps.Add(reg);

                _properties = newProps;

                return(true);                   // When should be false?
            }
        }
Example #2
0
        public bool RegisterDynamicProperty(IDynamicProperty prop)
        {
            bool result;

            lock (this)
            {
                if (this.FindProperty(prop.Name) != -1)
                {
                    throw new InvalidOperationException("Another property by this name already exists");
                }
                ArrayList arrayList = new ArrayList(this._properties);
                DynamicPropertyCollection.DynamicPropertyReg dynamicPropertyReg = new DynamicPropertyCollection.DynamicPropertyReg();
                dynamicPropertyReg.Property = prop;
                IContributeDynamicSink contributeDynamicSink = prop as IContributeDynamicSink;
                if (contributeDynamicSink != null)
                {
                    dynamicPropertyReg.Sink = contributeDynamicSink.GetDynamicSink();
                }
                arrayList.Add(dynamicPropertyReg);
                this._properties = arrayList;
                result           = true;
            }
            return(result);
        }