Пример #1
0
        private void signButton_Click_1(object sender, RoutedEventArgs e)
        {
            string text = textBox.Text;
            string pass = passwordBox.Password;
            // MainWindow obj = new MainWindow();
            try {
            StudentRegistrationForm form = new StudentRegistrationForm(mockStudentList);

                if (string.IsNullOrEmpty(text) || string.IsNullOrWhiteSpace(text))
                {
                    // obj.Show();
                    MessageBox.Show("Invalid username or password");
                }
                else if (string.Compare(text, "demouser") == 0 && string.Compare(pass, "demouser") == 0)
                {
                    form.Show();
                }
                else
                {
                    form.Show();
                }
            }
            catch
            {
                MessageBox.Show("Exception");
            }
        }
Пример #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     loadData();
     StudentRegistrationForm form = new StudentRegistrationForm(mockStudentList);
     form.Show();
     this.Close();
 }
Пример #3
0
 private void signButton_Click(object sender, EventArgs e)
 {
     //string text = textBox.Text;
     //string pass = passwordBox.Password;
     //MainWindow obj = new MainWindow();
     StudentRegistrationForm form = new StudentRegistrationForm(mockStudentList);
     //if (string.IsNullOrEmpty(text) || string.IsNullOrWhiteSpace(text))
     //{
     //    obj.Show();
     //}
     //else if (string.Compare(text, "demouser") == 0 && string.Compare(pass, "demouser") == 0)
     //{
     //    form.Show();
     //}
     //else
     //{
     form.Show();
     //}
 }
Пример #4
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            if ((this.username.Text.Trim() == user.UserName) && (this.password.Text.Trim() == user.PassWord))
            {
                user.resetTotal();

                StudentRegistrationForm win = new StudentRegistrationForm();

                this.Hide();
                win.Show();
            }
            else
            {
                int result = user.addTotal();
                if (result == 1)
                {
                    MessageBox.Show("Username or Password ERROR!");
                }
                else
                {
                    MessageBox.Show("Sorry,You have tried three times!");
                }
            }
        }