Beispiel #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?
            }
        }
Beispiel #2
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?
			}
		}