Page 150 - DCAP408_WEB_PROGRAMMING
P. 150
Windows Programming
Notes if ((txtUserId.Text == null) || (txtPassword.Password ==
null))
{
MessageBox.Show(“WP7: Username & Password must be filled
in before logging on.”);
//this.DialogResult = false;
}
if ((txtUserId.Text.Trim() == string.Empty) ||
(txtPassword.Password.Trim() == string.Empty))
{
MessageBox.Show(“WP7: Username & Password must be filled
in before logging on.”);
//this.DialogResult = false;
}
else if (txtUserId.Text.Trim().Length < 2)
{
MessageBox.Show(“WP7: Invalid username or password. Be
sure to use the WAZUp website login, not the Windows
Azure login.”);
//this.DialogResult = false;
}
else
{
// values are good so close this childwindow
this.Login = this.txtUserId.Text.Trim();
this.Password = this.txtPassword.Password.Trim();
this.DialogResult = true;
}
}
//private void btnCancel_Click(object sender, RoutedEventArgse)
//{
// this.DialogResult = false;
//}
private void txtUserId_KeyUp(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
if (txtPassword.Password.Length == 0)
{
txtPassword.Focus();
}
else
{
144 LOVELY PROFESSIONAL UNIVERSITY