Exemplo n.º 1
0
 private void DataForm_Load(object sender, EventArgs e)
 {
     _service = new PlayerService();
     foreach (var item in _service.GetPlayers())
     {
         _playerSource.Add(item);
     }
     playersDataGridView.DataSource = _playerSource;
     playersDataGridView.AutoGenerateColumns = true;
     loginTextBox.DataBindings.Add("Text", _playerSource, "Login");
     loginTextBox.Enabled = false;
     passwdTextBox.Enabled = false;
     passwdTextBox.DataBindings.Add("Text", _playerSource, "Password");
 }
Exemplo 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));
                }
            }
        }
Exemplo n.º 3
0
 void _view_TopPlayersByLongestPassword(object sender, EventArgs e)
 {
     var service = new PlayerService();
     var players = service.TopPlayersByLongestPassword();
     _view.PlayersGrid = players;
 }
Exemplo n.º 4
0
 void _view_PlayersWithValidEmails(object sender, EventArgs e)
 {
     var service = new PlayerService();
     var players = service.PlayersWithValidEmails();
     _view.PlayersGrid = players;
 }
Exemplo n.º 5
0
 void _view_PlayersOrderByDate(object sender, EventArgs e)
 {
     var service = new PlayerService();
     var players = service.PlayersOrderByDate();
     _view.PlayersGrid = players;
 }