KeyTriggerTests PressEscapeToCloseWindow Method Delta Engine Documentation

Namespace: DeltaEngine.Input.Tests
Assembly: DeltaEngine.Input.Tests (in DeltaEngine.Input.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public void PressEscapeToCloseWindow()
Examples

[Test]
public void PressEscapeToCloseWindow()
{
    new FontText(Font.Default, "Press ESC to close the window", Rectangle.One);
    new Command(() => Resolve<Window>().CloseAfterFrame()).Add(new KeyTrigger(Key.Escape,
        State.Pressed));
}
[Test]
public void PressEscapeToCloseWindowViaRegisteredCommands()
{
    new FontText(Font.Default, "Press ESC to close the window", Rectangle.One);
    Command.Register("Exit", new KeyTrigger(Key.Escape, State.Pressed));
    new Command("Exit", () => Resolve<Window>().CloseAfterFrame());
}
See Also