private void ButtonMoveRight_Click(object sender, RoutedEventArgs e) { MovementHelper.MoveRight(CurrentFigure, Board); }
private void Window_KeyDown(object sender, KeyEventArgs e) { if (CurrentState == (byte)States.Pause) { e.Handled = true; } if (e.KeyboardDevice.IsKeyDown(Key.LeftCtrl) || e.KeyboardDevice.IsKeyDown(Key.RightCtrl)) { switch (e.Key) { //handle G key case Key.G: SetStateFromCurrentState(); break; //handle R key case Key.R: ResetCurrentState(); Board.Children.Clear(); TimerValue = Properties.Settings.Default.TimerInitialValue; Score = Properties.Settings.Default.ScoreInitialValue; break; default: e.Handled = true; break; } } //handle F1 key if (e.Key == Key.F1) { MenuItemHelp_Click(sender, e); e.Handled = true; } if ((CurrentFigure == null) || (CurrentState == (byte)States.Continue)) { return; } //rotate current figur to left if (e.Key == Key.Down) { MovementHelper.RotateLeft(CurrentFigure, Board); } //rotate current figure to right if (e.Key == Key.Up) { MovementHelper.RotateRight(CurrentFigure, Board); } //move current figure to left if (e.Key == Key.Left) { MovementHelper.MoveLeft(CurrentFigure, Board); } //move current figure to right if (e.Key == Key.Right) { MovementHelper.MoveRight(CurrentFigure, Board); } //move current figure to bottom of the board if (e.Key == Key.Space) { SetMovementSpeed(0); } }