Exemple #1
0
 private void GameOnField_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (close_without_ask)
     {
         UserFindGame u = new UserFindGame(login);
         u.Show();
     }
     else
     {
         DialogResult result = MessageBox.Show("Точно хотите выйти? Для сохранения игры нажмите Отмена и Сохранить", "Уведомление", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
         if (result == DialogResult.Cancel)
         {
             e.Cancel = true;
         }
         else
         {
             UserFindGame u = new UserFindGame(login);
             u.Show();
         }
     }
 }
Exemple #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     //войти
     if (!label3.Visible)
     {
         if ((textBox1.Text == "admin") && (textBox2.Text == "admin"))
         {
             this.Hide();
             CreateGame creategame = new CreateGame();
             creategame.Show();
         }
         else
         {
             string        login = textBox1.Text;
             string        pass  = textBox2.Text;
             List <string> user  = new List <string>();
             user = bd.selectLoginAndPasswordFromUser(login, pass);
             if (user.Count != 0)
             {
                 this.Hide();
                 UserFindGame usergame = new UserFindGame(login);
                 usergame.Show();
             }
             else if (!textBox3.Visible)
             {
                 MessageBox.Show("Нет такой комбинации логина и пароля в базе данных, проверьте правильность введенных данных или зарегистрируйте нового пользователя.");
             }
         }
     }
     //<Вход
     else
     {
         label3.Visible   = false;
         textBox3.Visible = false;
         button1.Text     = "Войти";
         button2.Text     = "Регистрация >";
     }
 }