Пример #1
0
        private void Window_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Down)
            {
                vm.PlayerMoveDown();
            }

            else if (e.Key == Key.Up)
            {
                vm.PlayerMoveUp();
            }

            else if (e.Key == Key.Right)
            {
                vm.PlayerMoveRight();
            }

            else if (e.Key == Key.Left)
            {
                vm.PlayerMoveLeft();
            }

            if (vm.VM_PlayerPosition.Row == vm.VM_EndRow && vm.VM_PlayerPosition.Col == vm.VM_EndCol)
            {
                MessageBox.Show("You Win!");
                this.Close();
            }
        }