Esempio n. 1
0
        private void enterBtn_Click(object sender, EventArgs e)
        {
            var check = false;

            _service = new PlayerService();
            _attempts++;
            if (radioUserAuth.Checked)
            {
                var myCheckingValidateUser = _service.CheckingValidateUser(nameTextbox.Text, passwdTextbox.Text);
                if (myCheckingValidateUser != null)
                {
                    check = true;
                    MessageBox.Show("Ok!", "Message");
                    this.Hide();
                    DataForm form = new DataForm()
                    {
                        MdiParent = this.MdiParent as ContainerForm
                    };
                    form.Show();
                    this.Close();
                }
            }
            if (radioGuestAuth.Checked)
            {
                check = true;
                MessageBox.Show("Welcome Guest!");
                this.Hide();
                CombatForm form = new CombatForm()
                {
                    MdiParent = this.MdiParent as ContainerForm
                };
                form.Show();
                this.Close();
            }
            if (!check)
            {
                if (_attempts == MaxLoginAttempts)
                {
                    MessageBox.Show("Invalid login. You have reached the maximum number of invalid login attempts.",
                                    string.Format("Invalid Login (attempt {0} of {1})", _attempts, MaxLoginAttempts));
                    Application.Exit();
                }
                else
                {
                    MessageBox.Show("Invalid login. Try again.",
                                    string.Format("Invalid Login (attempt {0} of {1})", _attempts, MaxLoginAttempts));
                }
            }
        }
Esempio n. 2
0
        private void enterBtn_Click(object sender, EventArgs e)
        {
            var check = false;
            _service = new PlayerService();
            _attempts++;
            if (radioUserAuth.Checked)
            {
                var myCheckingValidateUser = _service.CheckingValidateUser(nameTextbox.Text, passwdTextbox.Text);
                if (myCheckingValidateUser != null)
                {
                    check = true;
                    MessageBox.Show("Ok!", "Message");
                    this.Hide();
                    DataForm form = new DataForm() { MdiParent = this.MdiParent as ContainerForm };
                    form.Show();
                    this.Close();
                }
            }
            if (radioGuestAuth.Checked)
            {
                check = true;
                MessageBox.Show("Welcome Guest!");
                this.Hide();
                CombatForm form = new CombatForm() { MdiParent = this.MdiParent as ContainerForm };
                form.Show();
                this.Close();
            }
            if (!check)
            {

                if (_attempts == MaxLoginAttempts)
                {
                    MessageBox.Show("Invalid login. You have reached the maximum number of invalid login attempts.",
                        string.Format("Invalid Login (attempt {0} of {1})", _attempts, MaxLoginAttempts));
                    Application.Exit();
                }
                else
                {
                    MessageBox.Show("Invalid login. Try again.",
                        string.Format("Invalid Login (attempt {0} of {1})", _attempts, MaxLoginAttempts));
                }
            }
        }