private bool validateControls() { this.txtUsername.Text = this.txtUsername.Text.Trim(); this.txtPort.Text = this.txtPort.Text.Trim(); this.cmbServer.Text = this.cmbServer.Text.Trim(); if (this.txtUsername.Text == "") { MessageBox.Show("You must supply a username."); return false; } if (this.txtPassword.Text == "") { MessageBox.Show("You must supply a password."); return false; } if (this.cmbServer.Text == "") { MessageBox.Show("You must specify the server to connect to."); return false; } this.options = new emailOptions(); int.TryParse(this.txtPort.Text, out this.options.portNum); if (this.options.portNum == 0) { MessageBox.Show("You must specify the port to connect to numerically (normally 443, or 993 if using SSL)."); return false; } this.options.username = this.txtUsername.Text; this.options.password = this.txtPassword.Text; this.options.serverName = this.cmbServer.Text; this.options.useSSL = this.chkSSL.Checked; return true; }
public frmCheckEmailOptions(IFormOptions newOptions) { this.InitializeComponent(); this.CenterToParent(); this.options = (emailOptions)newOptions; }