Click here to Skip to main content
15,891,951 members
Articles / Programming Languages / C#

MagicWords: How to build a SlickRun clone in one hour

Rate me:
Please Sign up or sign in to vote.
4.76/5 (15 votes)
11 Feb 20076 min read 48K   892   44  
An improved command line utility inspired by SlickRun.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace Serialcoder.MagicWords.Controls
{
	public partial class ListMagicWords : UserControl
	{
		public ListMagicWords()
		{
			InitializeComponent();
			uxDataGridView.AutoGenerateColumns = false;
		}

		protected override void OnLoad(EventArgs e)
		{
			base.OnLoad(e);

			uxModesColumn.DataSource = Enum.GetValues(typeof (System.Diagnostics.ProcessWindowStyle));
			bindingSource1.DataSource = Context.Current.MagicWords;
		}

		private void OnDataGridViewCellParsing(object sender, DataGridViewCellParsingEventArgs e)
		{
			if (e.ColumnIndex == uxModesColumn.Index && e.Value is string)
			{
				e.Value = (Object)Enum.Parse(typeof(System.Diagnostics.ProcessWindowStyle), e.Value.ToString(), true);
				e.ParsingApplied = true;
			}
		}

		
		private void OnDataGridViewCellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
		{
			if (e.ColumnIndex == uxModesColumn.Index &&  e.Value is System.Diagnostics.ProcessWindowStyle)
			{
				e.Value = e.Value.ToString();
				e.FormattingApplied = true;
			}
		}

		private void OnDataGridViewDataError(object sender, DataGridViewDataErrorEventArgs e)
		{
			Console.WriteLine(e.Exception);
			Console.WriteLine(e.RowIndex);
		}
	}
}

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
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions