示例#1
0
        private void Login(object sender, RoutedEventArgs e)
        {
            if (enterCount <= 3)
            {
                if (table.Auth(login.Text, password.Password) == true)
                {
                    this.Close();
                }
                else
                {
                    enterCount++;
                    MessageBox.Show("Неправильный логин или пароль");
                    if (enterCount == 3)
                    {
                        Captcha();
                        captchaStack.Visibility = Visibility.Visible;
                    }
                }
            }

            else
            {
                captchaStack.Visibility = Visibility.Visible;
                if (captchaText.Text == captchaInput.Text)
                {
                    if (table.Auth(login.Text, password.Password) == true)
                    {
                        this.Close();
                    }
                    else
                    {
                        enterCount++;
                        MessageBox.Show("Неправильный логин или пароль");
                    }
                }
                else
                {
                    MessageBox.Show("Капча введена неверно!");
                }
                Captcha();
            }
        }