Beispiel #1
0
 /// <summary>
 /// Handles the Key Down Event For the game.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private async void Form1_KeyPressAsync(object sender, KeyPressEventArgs e)
 {
     if (_okToMove)
     {
         _okToMove = false;
         //Casting the 'V' into Keys makes it in F7
         if (e.KeyChar == 'v')
         {
             await _game.MovePieceAsync(Keys.V);
         }
         //Casting the 'c' into Keys makes it into numpad3
         else if (e.KeyChar == 'c')
         {
             await _game.MovePieceAsync(Keys.C);
         }
         else
         {
             await _game.MovePieceAsync((Keys)e.KeyChar);
         }
     }
 }