view FrmSystem.cs @ 2:51e8cd3be231

Adjusted spacing of System form, General tab. Added Default Army Size to same tab.
author Tsudico
date Tue, 07 Dec 2010 21:11:45 -0600
parents 91b5550eff31
children 866d0093bb11
line wrap: on
line source

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using IBBoard.Lang;
using IBBoard.Windows.Forms;
using IBBoard.Windows.Forms.I18N;

namespace IBBoard.WarFoundry.Forge.WinForms
{
	public partial class FrmSystem : IBBoard.Windows.Forms.IBBForm
	{
		public FrmSystem()
		{
			InitializeComponent();
		}

		private void btnSystemClose_Click(object sender, EventArgs e)
		{
			this.Close();
		}

		private void btnGenerateSysId_Click(object sender, EventArgs e)
		{
			string newId = String.Empty;

			MatchCollection id_parts = Regex.Matches(this.txtSystemName.Text, @"[A-Z\d]");
			foreach(Match part in id_parts)
			{
				newId += part.ToString();
			}
			
			if(newId.Length < 3)
			{
				newId = this.txtSystemName.Text.ToLower().Replace(" ", "");
			}
			
			this.txtSystemId.Text = newId.ToLower();
		}
	}
}