using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace TdoCodeGenerator{
public partial class frmNewTdoSolution : Form
{
private string fTdoSolutionName;
public frmNewTdoSolution()
{
InitializeComponent();
this.fTdoSolutionName = null;
}
public string TdoSolutionName
{
get
{
return this.fTdoSolutionName;
}
set
{
this.fTdoSolutionName = value;
if (this.fTdoSolutionName==null)
this.fTdoSolutionName="Tdo Solution 1";
this.txtTdoSolutionName.Text = this.fTdoSolutionName;
this.txtTdoSolutionName.SelectAll();
}
}
private void btnOk_Click(object sender, EventArgs e)
{
this.fTdoSolutionName = this.txtTdoSolutionName.Text;
this.DialogResult = DialogResult.OK;
this.Close();
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
this.Close();
}
private bool ValidateFileName(string filename)
{
return new System.Text.RegularExpressions.Regex(@"^[^\\\./:\*\?\""<>\|]{1}[^\\/:\*\?\""<>\|]{0,254}$").Match(filename).Success;
}
private void txtTdoSolutionName_TextChanged(object sender, EventArgs e)
{
this.errorProvider1.Clear();
if (String.IsNullOrEmpty(this.txtTdoSolutionName.Text) || !this.ValidateFileName(txtTdoSolutionName.Text))
{
this.errorProvider1.SetError(this.txtTdoSolutionName,"Invalid Tdo Solution name.");
this.btnOk.Enabled = false;
return;
}
this.btnOk.Enabled = true;
}
private void frmNewTdoSolution_Load(object sender, EventArgs e)
{
}
}
}
|