Ejemplo n.º 1
0
 private void Fifteen_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyValue == 8)
     {
         Restore();        // клавиша Backspace отменяет ход
     }
     if (e.KeyValue == 32) // читы
     {
         timer1.Stop();
         Victory victory = new Victory(count, sec);
         victory.ShowDialog();
         GameStart();
     }
 }
Ejemplo n.º 2
0
        private void Button_Click(object sender, EventArgs e)
        {
            int position = Convert.ToInt32(((Button)sender).Tag);

            if (game.Shift(position))//перемещение
            {
                RefreshButtonField();
                count++;
                CountStatus.Text = count.ToString();
            }
            if (game.Check())//Завершение игры
            {
                Victory victory = new Victory(count, sec);
                victory.ShowDialog();
                GameStart();
            }
            this.ActiveControl = null;
        }