Click here to Skip to main content
15,886,806 members
Articles / Programming Languages / C#

The Razor Framework :: Part 1 :: Plugins/Extensibility

Rate me:
Please Sign up or sign in to vote.
4.93/5 (127 votes)
11 Mar 2005CPOL36 min read 350.8K   1.4K   446  
An extensible dependency based plugin framework for .NET Applications.
using System;
using System.Diagnostics;
using System.Collections;
using Razor.Networking.Http;

namespace Razor.Networking.Addressing
{
	/// <summary>
	/// Summary description for AddressBookItemConnectionManagerList.
	/// </summary>
	public class AddressBookItemConnectionManagerList : CollectionBase
	{
		/// <summary>
		/// Initializes a new instance of the AddressBookItemConnectionManagerList class
		/// </summary>
		public AddressBookItemConnectionManagerList()
		{
			
		}

		/// <summary>
		/// Adds a connection manager to the list
		/// </summary>
		/// <param name="manager"></param>
		public void Add(AddressBookItemConnectionManager manager)
		{
			if (!this.Contains(manager))
				base.InnerList.Add(manager);
		}

		/// <summary>
		/// Removes a connection manager from the list
		/// </summary>
		/// <param name="manager"></param>
		public void Remove(AddressBookItemConnectionManager manager)
		{
			if (this.Contains(manager))
				base.InnerList.Remove(manager);			
		}

		/// <summary>
		/// Removes the connection manager at the specified index from the list
		/// </summary>
		/// <param name="index"></param>
		public new void RemoveAt(int index)
		{
			base.InnerList.RemoveAt(index);
		}

		/// <summary>
		/// Returns a flag that indicates whether the sesion manager exists in the list
		/// </summary>
		/// <param name="manager"></param>
		/// <returns></returns>
		public bool Contains(AddressBookItemConnectionManager manager)
		{
			return base.InnerList.Contains(manager);
		}

		/// <summary>
		/// Returns the connection manager at the specified index
		/// </summary>
		public AddressBookItemConnectionManager this[int index]
		{
			get
			{
				return (AddressBookItemConnectionManager)base.InnerList[index];
			}
		}

		/// <summary>
		/// Returns the connection manager responsible for the address book item
		/// </summary>
		public AddressBookItemConnectionManager this[AddressBookItem item]
		{
			get
			{
				foreach(AddressBookItemConnectionManager manager in base.InnerList)
					if (manager.AddressBookItem == item)
						return manager;
				return null;
			}
		}

		public AddressBookItemConnectionManager this[HttpConnection connection]
		{
			get
			{
				foreach(AddressBookItemConnectionManager manager in base.InnerList)
					if (manager.Connection.Id == connection.Id)
						return manager;
				return null;
			}
		}

		/// <summary>
		/// Returns an object that can be used to synchronize access to the list
		/// </summary>
		public object SyncRoot
		{
			get
			{
				return base.InnerList.SyncRoot;
			}
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United States United States
Senior Application Developer specializing in Windows desktop and network development.

Professional Experience
- B.S. of Computer Science (Graduated 2001 - PSU)
- Senior Application Developer (8+ yrs)
- Microsoft Certified Professional

Primary Interests
- C#, C++, HTML, Javascript
- XML, ASP.NET, Web Services, SOAP, UDDI
- Socket programming and anything network related
- Reflection, Serialization, and Plugin Frameworks
- Owner-drawn controls and GDI+ goodness

Comments and Discussions