Click here to Skip to main content
15,885,985 members
Articles / Desktop Programming / Windows Forms

CX Part II

Rate me:
Please Sign up or sign in to vote.
4.97/5 (33 votes)
5 Aug 2009CPOL47 min read 53.7K   354   48  
Build a Metadata Designer for the CX Dynamic Composition Framework.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Cx.Attributes
{
	/// <summary>
	/// Designate events with this attribute for auto-discovery.
	/// Also see CxExplicitEventAttribute.
	/// </summary>
	[AttributeUsage(AttributeTargets.Event)]
	public class CxEventAttribute : Attribute
	{
	}

	/// <summary>
	/// Designate transformed events and events from a control that
	/// you intend to expose for auto-discovery.  Also see CxEventAttribute.
	/// </summary>
	[AttributeUsage(AttributeTargets.Class, AllowMultiple=true)]
	public class CxExplicitEventAttribute : Attribute
	{
		public string EventName { get; private set; }

		public CxExplicitEventAttribute(string eventName)
		{
			EventName = eventName;
		}
	}

	/// <summary>
	/// Designate event handler methods with this attribute for auto-discovery.
	/// </summary>		 
	[AttributeUsage(AttributeTargets.Method)]
	public class CxConsumerAttribute : Attribute
	{
	}

	/// <summary>
	/// Use this attribute on any Cx component class to give it a friendly name used by the designer
	/// to select a component from an assembly.
	/// </summary>
	[AttributeUsage(AttributeTargets.Class)]
	public class CxComponentNameAttribute : Attribute
	{
		public string ComponentName { get; private set; }

		/// <summary>
		/// The friendly name of the component, used to initialize an instance of this component.
		/// </summary>
		/// <param name="componentName">The component name.</param>
		public CxComponentNameAttribute(string componentName)
		{
			ComponentName = componentName;
		}
	}

	[AttributeUsage(AttributeTargets.Property)]
	public class CxComponentPropertyAttribute : Attribute
	{
	}
}

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
Architect Interacx
United States United States
Blog: https://marcclifton.wordpress.com/
Home Page: http://www.marcclifton.com
Research: http://www.higherorderprogramming.com/
GitHub: https://github.com/cliftonm

All my life I have been passionate about architecture / software design, as this is the cornerstone to a maintainable and extensible application. As such, I have enjoyed exploring some crazy ideas and discovering that they are not so crazy after all. I also love writing about my ideas and seeing the community response. As a consultant, I've enjoyed working in a wide range of industries such as aerospace, boatyard management, remote sensing, emergency services / data management, and casino operations. I've done a variety of pro-bono work non-profit organizations related to nature conservancy, drug recovery and women's health.

Comments and Discussions