/// <summary>
		/// Determines whether a PortDescriptor exists in the collection
		/// </summary>
		/// <param name="descriptor"></param>
		/// <returns></returns>
		public bool Contains(PortDescriptor descriptor)
		{
			foreach(PortDescriptor existingPortDescriptor in base.InnerList)
				if (existingPortDescriptor.Key == descriptor.Key)
					return true;
			return false;
		}
		/// <summary>
		/// Removes a PortDescriptor from the collection
		/// </summary>
		/// <param name="descriptor"></param>
		public void Remove(PortDescriptor descriptor)
		{
			foreach(PortDescriptor existingPortDescriptor in base.InnerList)
				if (existingPortDescriptor.Key == descriptor.Key)
				{
					descriptor.Changed -= new PortDescriptorEventHandler(this.OnPortDescriptorChanged);
					base.InnerList.Remove(existingPortDescriptor);
					break;
				}
		}
		/// <summary>
		/// Adds a PortDescriptor to the collection
		/// </summary>
		/// <param name="descriptor"></param>
		/// <returns></returns>
		public int Add(PortDescriptor descriptor)
		{
			if (descriptor == null)
				throw new NullReferenceException("A null port descriptor cannot be added.");

			if (!this.Contains(descriptor))
			{
				descriptor.Parent = _parent;
				descriptor.Changed += new PortDescriptorEventHandler(this.OnPortDescriptorChanged);
				return base.InnerList.Add(descriptor);
			}
			
			return -1;
		}
        /// <summary>
        /// Adds a PortDescriptor to the collection
        /// </summary>
        /// <param name="descriptor"></param>
        /// <returns></returns>
        public int Add(PortDescriptor descriptor)
        {
            if (descriptor == null)
            {
                throw new NullReferenceException("A null port descriptor cannot be added.");
            }

            if (!this.Contains(descriptor))
            {
                descriptor.Parent   = _parent;
                descriptor.Changed += new PortDescriptorEventHandler(this.OnPortDescriptorChanged);
                return(base.InnerList.Add(descriptor));
            }

            return(-1);
        }
Exemplo n.º 5
0
 public PortDescriptorEventArgs(PortDescriptor descriptor) : base()
 {
     _descriptor = descriptor;
 }
		public PortDescriptorEventArgs(PortDescriptor descriptor) : base()
		{
			_descriptor = descriptor;
		}