Click here to Skip to main content
15,896,606 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.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Serialcoder.MagicWords.Forms
{
	public partial class OptionsForm : Form
	{
		public OptionsForm()
		{
			InitializeComponent();
		}

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

			dataGridView1.DataSource = Context.Current.Tools;
			propertyGrid1.SelectedObject = Properties.Settings.Default;
		}

		private void uxCancelButton_Click(object sender, EventArgs e)
		{			
			this.DialogResult = DialogResult.Cancel;
		}

		private void uxAcceptButton_Click(object sender, EventArgs e)
		{			
			this.DialogResult = DialogResult.OK;
		}

		private void OnWebsiteLinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
		{
			System.Diagnostics.Process.Start("http://code.google.com/p/magicwords/");
		}

		private void OnImportLinkLabelLinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
		{
			OpenFileDialog dialog = new OpenFileDialog();
			dialog.Title = "Import a SlickRun qrs file...";
			dialog.Filter = "SlickRun files (*.qrs)|*.qrs";
			dialog.CheckFileExists = true;
			dialog.CheckPathExists = true;
			dialog.Multiselect = false;
			
			if (dialog.ShowDialog() == DialogResult.OK)
			{
				try
				{
					Context.Current.MagicWords.AddRange(SlickRunHelper.ImportFile(dialog.FileName));
					MessageBox.Show(dialog.FileName + " imported successfully.");
				}
				catch (Exception exception)
				{
					MessageBox.Show("An error occured: " + exception.Message);
				}
				
			}
		}
	}
}

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