private void btnLogin_Click(object sender, RoutedEventArgs e) { if (!Data.User.Vaild(comboxUserName.Text, textPassword.Password)) { labMessage.Content = Data.User.GetLastErr; textPassword.Focus(); textPassword.Background = new SolidColorBrush(Colors.Red); return; } WindowMain objMain = new WindowMain(); objMain.Show(); this.Close(); }