AStarTest.Window1.KeyToDir C# (CSharp) Méthode

KeyToDir() private méthode

private KeyToDir ( Key key ) : Direction
key Key
Résultat Direction
        Direction KeyToDir(Key key)
        {
            Direction dir;

            switch (key)
            {
                case Key.Up: dir = Direction.North; break;
                case Key.Down: dir = Direction.South; break;
                case Key.Left: dir = Direction.West; break;
                case Key.Right: dir = Direction.East; break;
                case Key.Home: dir = Direction.NorthWest; break;
                case Key.End: dir = Direction.SouthWest; break;
                case Key.PageUp: dir = Direction.NorthEast; break;
                case Key.PageDown: dir = Direction.SouthEast; break;
                default:
                    throw new Exception();
            }

            return dir;
        }