Click here to Skip to main content
15,885,366 members
Articles / Web Development / ASP.NET

Template-Based Code Generation with SmartCode

Rate me:
Please Sign up or sign in to vote.
4.82/5 (35 votes)
25 Dec 20067 min read 100.8K   3.5K   121  
SmartCode is a template based code generator.This tutorial describes the process of building a templates to SmartCode
/*
 * Copyright � 2005-2006 Danilo Mendez <danilo.mendez@kontac.net>
 * Adolfo Socorro <ajs@esolutionspr.com>
 * www.kontac.net 
 * All rights reserved.
 * Released under both BSD license and Lesser GPL library license.
 * Whenever there is any discrepancy between the two licenses,
 * the BSD license will take precedence.
 */

using System;
using System.ComponentModel; 
using System.ComponentModel.Design.Serialization; 
using System.Windows.Forms; 
using System.Drawing; 
using System.Runtime.InteropServices; 
using System.Runtime.Serialization; 
//using mdobler.XPCommonControls.ListViewAPI; 

namespace SmartCode.Studio.Controls.UserControls.XPListView
{
	
	[TypeConverter(typeof(XPListViewItemConverter))] 
	public class XPListViewItem : System.Windows.Forms.ListViewItem { 
		private int _groupIndex; 

		public XPListViewItem() : base() { 
		} 

		public XPListViewItem(string text) : base(text) { 
			
		} 

		public XPListViewItem(string text, int imageIndex) : base(text, imageIndex) { 
		} 

		public XPListViewItem(string[] items) : base(items) { 
		} 

		public XPListViewItem(string[] items, int imageIndex) : base(items, imageIndex) { 
		} 

		public XPListViewItem(XPListViewItem.ListViewSubItem[] subItems, int imageIndex) : base(subItems, imageIndex) { 
		} 

		public XPListViewItem(string[] items, int imageIndex, Color foreColor, Color backColor, Font font) : base(items, imageIndex, foreColor, backColor, font) { 
		} 

		public XPListViewItem(string text, int imageIndex, int groupIndex) : base(text, imageIndex) { 
			_groupIndex = groupIndex; 
		} 

		public XPListViewItem(string[] items, int imageIndex, int groupIndex) : base(items, imageIndex){ 
			this.GroupIndex = groupIndex; 
		} 

		public XPListViewItem(XPListViewItem.ListViewSubItem[] subItems, int imageIndex, int groupIndex) : base(subItems, imageIndex) { 
			this.GroupIndex = groupIndex; 
		} 

		public XPListViewItem(string[] items, int imageIndex, Color foreColor, Color backColor, Font font, int groupIndex) : base(items, imageIndex, foreColor, backColor, font) { 
			this.GroupIndex = groupIndex; 
		} 

		[Browsable(true), Category("Info")] 
		public int GroupIndex { 
			get { 
				return _groupIndex; 
			} 
			set { 
				_groupIndex = value; 
				ListViewAPI.AddItemToGroup(((XPListView)base.ListView), base.Index, _groupIndex); 
			} 
		} 

		[Browsable(false)] 
		internal string[] SubItemsArray { 
			get { 
				if (this.SubItems.Count == 0) { 
					return null; 
				} 

				string[] a = new string[this.SubItems.Count - 1];

				for (int i = 0; i <= this.SubItems.Count - 1; i++) { 
					a[i] = this.SubItems[i].Text; 
				} 
				return a; 
			} 
		} 
	}
}

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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
Danilo is the creator of SmartRules, a Business Rules Engine. He is an industry consultant working primarily with companies interested in implementing dynamic rules programming concepts to add flexibility to their architectures on web, CE, and desktop platforms. He operates his own website, Kontac, where you will find more information.

To contact Danilo, email him at danilo.mendez@gmail.com.

Comments and Discussions