Refactored keydown/up/press events to use event vs. Action<T>

This commit is contained in:
Charlie Kindel
2020-05-18 22:42:04 -06:00
committed by BDisp
parent 0c2872979d
commit ab72865b2c
3 changed files with 33 additions and 26 deletions

View File

@@ -90,8 +90,8 @@ static class Demo {
Width = Dim.Fill (),
Height = Dim.Fill ()
};
container.OnKeyUp += (KeyEvent ke) => {
if (ke.Key == Key.Esc)
container.KeyUp += (sender, e) => {
if (e.KeyEvent.Key == Key.Esc)
container.Running = false;
};
@@ -469,9 +469,9 @@ static class Demo {
}
container.OnKeyDown += (KeyEvent keyEvent) => KeyDownPressUp (keyEvent, "Down");
container.OnKeyPress += (KeyEvent keyEvent) => KeyDownPressUp (keyEvent, "Press");
container.OnKeyUp += (KeyEvent keyEvent) => KeyDownPressUp (keyEvent, "Up");
container.KeyDown += (o, e) => KeyDownPressUp (e.KeyEvent, "Down");
container.KeyPress += (o, e) => KeyDownPressUp (e.KeyEvent, "Press");
container.KeyUp += (o, e) => KeyDownPressUp (e.KeyEvent, "Up");
Application.Run (container);
}
#endregion