diff --git a/Terminal.Gui/Core/View.cs b/Terminal.Gui/Core/View.cs index e0796bbe2..fa67b1c52 100644 --- a/Terminal.Gui/Core/View.cs +++ b/Terminal.Gui/Core/View.cs @@ -1713,7 +1713,7 @@ namespace Terminal.Gui { /// /// Invoked when a character key is pressed and occurs after the key up event. /// - public event Action KeyPress; + public event EventHandler KeyPress; /// public override bool ProcessKey (KeyEvent keyEvent) @@ -1723,11 +1723,11 @@ namespace Terminal.Gui { } var args = new KeyEventEventArgs (keyEvent); - KeyPress?.Invoke (args); + KeyPress?.Invoke (this, args); if (args.Handled) return true; if (Focused?.Enabled == true) { - Focused?.KeyPress?.Invoke (args); + Focused?.KeyPress?.Invoke (this, args); if (args.Handled) return true; } @@ -1899,7 +1899,7 @@ namespace Terminal.Gui { var args = new KeyEventEventArgs (keyEvent); if (MostFocused?.Enabled == true) { - MostFocused?.KeyPress?.Invoke (args); + MostFocused?.KeyPress?.Invoke (this, args); if (args.Handled) return true; } @@ -1922,11 +1922,11 @@ namespace Terminal.Gui { } var args = new KeyEventEventArgs (keyEvent); - KeyPress?.Invoke (args); + KeyPress?.Invoke (this, args); if (args.Handled) return true; if (MostFocused?.Enabled == true) { - MostFocused?.KeyPress?.Invoke (args); + MostFocused?.KeyPress?.Invoke (this, args); if (args.Handled) return true; } @@ -1944,7 +1944,7 @@ namespace Terminal.Gui { /// /// Invoked when a key is pressed. /// - public event Action KeyDown; + public event EventHandler KeyDown; /// public override bool OnKeyDown (KeyEvent keyEvent) @@ -1954,12 +1954,12 @@ namespace Terminal.Gui { } var args = new KeyEventEventArgs (keyEvent); - KeyDown?.Invoke (args); + KeyDown?.Invoke (this, args); if (args.Handled) { return true; } if (Focused?.Enabled == true) { - Focused.KeyDown?.Invoke (args); + Focused.KeyDown?.Invoke (this, args); if (args.Handled) { return true; } @@ -1974,7 +1974,7 @@ namespace Terminal.Gui { /// /// Invoked when a key is released. /// - public event Action KeyUp; + public event EventHandler KeyUp; /// public override bool OnKeyUp (KeyEvent keyEvent) @@ -1984,12 +1984,12 @@ namespace Terminal.Gui { } var args = new KeyEventEventArgs (keyEvent); - KeyUp?.Invoke (args); + KeyUp?.Invoke (this, args); if (args.Handled) { return true; } if (Focused?.Enabled == true) { - Focused.KeyUp?.Invoke (args); + Focused.KeyUp?.Invoke (this, args); if (args.Handled) { return true; } @@ -2295,14 +2295,14 @@ namespace Terminal.Gui { /// /// Subscribe to this event to perform tasks when the has been resized or the layout has otherwise changed. /// - public event Action LayoutStarted; + public event EventHandler LayoutStarted; /// /// Raises the event. Called from before any subviews have been laid out. /// internal virtual void OnLayoutStarted (LayoutEventArgs args) { - LayoutStarted?.Invoke (args); + LayoutStarted?.Invoke (this, args); } /// @@ -2311,7 +2311,7 @@ namespace Terminal.Gui { /// /// Subscribe to this event to perform tasks when the has been resized or the layout has otherwise changed. /// - public event Action LayoutComplete; + public event EventHandler LayoutComplete; /// /// Event called only once when the is being initialized for the first time. @@ -2325,7 +2325,7 @@ namespace Terminal.Gui { /// internal virtual void OnLayoutComplete (LayoutEventArgs args) { - LayoutComplete?.Invoke (args); + LayoutComplete?.Invoke (this, args); } internal void CollectPos (Pos pos, View from, ref HashSet nNodes, ref HashSet<(View, View)> nEdges) diff --git a/Terminal.Gui/Views/ComboBox.cs b/Terminal.Gui/Views/ComboBox.cs index 4f015c1f4..9bc6a80ec 100644 --- a/Terminal.Gui/Views/ComboBox.cs +++ b/Terminal.Gui/Views/ComboBox.cs @@ -299,7 +299,7 @@ namespace Terminal.Gui { this.Add (search, listview); // On resize - LayoutComplete += (LayoutEventArgs a) => { + LayoutComplete += (object sender, LayoutEventArgs a) => { if ((!autoHide && Bounds.Width > 0 && search.Frame.Width != Bounds.Width) || (autoHide && Bounds.Width > 0 && search.Frame.Width != Bounds.Width - 1)) { search.Width = listview.Width = autoHide ? Bounds.Width - 1 : Bounds.Width; diff --git a/Terminal.Gui/Windows/Dialog.cs b/Terminal.Gui/Windows/Dialog.cs index f1ff80a69..64205357e 100644 --- a/Terminal.Gui/Windows/Dialog.cs +++ b/Terminal.Gui/Windows/Dialog.cs @@ -88,7 +88,7 @@ namespace Terminal.Gui { } } - LayoutStarted += (args) => { + LayoutStarted += (s, args) => { LayoutStartedHandler (); }; } diff --git a/Terminal.Gui/Windows/FileDialog.cs b/Terminal.Gui/Windows/FileDialog.cs index c2d20f3f1..6eee497fb 100644 --- a/Terminal.Gui/Windows/FileDialog.cs +++ b/Terminal.Gui/Windows/FileDialog.cs @@ -745,7 +745,7 @@ namespace Terminal.Gui { // On success, we will set this to false. canceled = true; - KeyPress += (e) => { + KeyPress += (s, e) => { if (e.KeyEvent.Key == Key.Esc) { Cancel (); e.Handled = true; diff --git a/UICatalog/KeyBindingsDialog.cs b/UICatalog/KeyBindingsDialog.cs index ac46bbdb7..5bcb5611c 100644 --- a/UICatalog/KeyBindingsDialog.cs +++ b/UICatalog/KeyBindingsDialog.cs @@ -179,7 +179,7 @@ namespace UICatalog { // prompt user to hit a key var dlg = new Dialog ("Enter Key"); - dlg.KeyPress += (k) => { + dlg.KeyPress += (s, k) => { key = k.KeyEvent.Key; Application.RequestStop (); }; diff --git a/UICatalog/Scenarios/ASCIICustomButton.cs b/UICatalog/Scenarios/ASCIICustomButton.cs index d28acfec5..802709f63 100644 --- a/UICatalog/Scenarios/ASCIICustomButton.cs +++ b/UICatalog/Scenarios/ASCIICustomButton.cs @@ -230,7 +230,7 @@ namespace UICatalog.Scenarios { } } - private void Button_KeyPress (KeyEventEventArgs obj) + private void Button_KeyPress (object sender, KeyEventEventArgs obj) { switch (obj.KeyEvent.Key) { case Key.End: diff --git a/UICatalog/Scenarios/AllViewsTester.cs b/UICatalog/Scenarios/AllViewsTester.cs index ddfa05bb8..4387a8d9b 100644 --- a/UICatalog/Scenarios/AllViewsTester.cs +++ b/UICatalog/Scenarios/AllViewsTester.cs @@ -424,7 +424,7 @@ namespace UICatalog.Scenarios { return view; } - void LayoutCompleteHandler (View.LayoutEventArgs args) + void LayoutCompleteHandler (object sender, View.LayoutEventArgs args) { UpdateTitle (_curView); } diff --git a/UICatalog/Scenarios/AutoSizeAndDirectionText.cs b/UICatalog/Scenarios/AutoSizeAndDirectionText.cs index af43bcde9..e4737f70d 100644 --- a/UICatalog/Scenarios/AutoSizeAndDirectionText.cs +++ b/UICatalog/Scenarios/AutoSizeAndDirectionText.cs @@ -90,7 +90,7 @@ namespace UICatalog.Scenarios { }; Win.Add (ckbWideText); - Win.KeyUp += (_) => + Win.KeyUp += (s,e) => labelH.Text = labelV.Text = text = editText.Text.ToString (); } } diff --git a/UICatalog/Scenarios/BackgroundWorkerCollection.cs b/UICatalog/Scenarios/BackgroundWorkerCollection.cs index 201bb3b63..d2448e156 100644 --- a/UICatalog/Scenarios/BackgroundWorkerCollection.cs +++ b/UICatalog/Scenarios/BackgroundWorkerCollection.cs @@ -338,13 +338,13 @@ namespace UICatalog.Scenarios { close.Clicked += OnReportClosed; Add (close); - KeyPress += (e) => { + KeyPress += (s, e) => { if (e.KeyEvent.Key == Key.Esc) { OnReportClosed (); } }; - LayoutStarted += (_) => { + LayoutStarted += (s,e) => { var btnsWidth = start.Bounds.Width + close.Bounds.Width + 2 - 1; var shiftLeft = Math.Max ((Bounds.Width - btnsWidth) / 2 - 2, 0); diff --git a/UICatalog/Scenarios/CharacterMap.cs b/UICatalog/Scenarios/CharacterMap.cs index 88aa62cf8..0018d825f 100644 --- a/UICatalog/Scenarios/CharacterMap.cs +++ b/UICatalog/Scenarios/CharacterMap.cs @@ -157,7 +157,7 @@ namespace UICatalog.Scenarios { ContentSize = new Size (CharMap.RowWidth, (int)(MaxCodePointVal / 16 + 1)); ShowVerticalScrollIndicator = true; ShowHorizontalScrollIndicator = false; - LayoutComplete += (args) => { + LayoutComplete += (s, args) => { if (Bounds.Width < RowWidth) { ShowHorizontalScrollIndicator = true; } else { diff --git a/UICatalog/Scenarios/ComputedLayout.cs b/UICatalog/Scenarios/ComputedLayout.cs index c0954375f..9427cad84 100644 --- a/UICatalog/Scenarios/ComputedLayout.cs +++ b/UICatalog/Scenarios/ComputedLayout.cs @@ -49,7 +49,7 @@ namespace UICatalog.Scenarios { ColorScheme = Colors.Error }; - Application.Top.LayoutComplete += (a) => { + Application.Top.LayoutComplete += (s, a) => { horizontalRuler.Text = rule.Repeat ((int)Math.Ceiling ((double)(horizontalRuler.Bounds.Width) / (double)rule.Length)) [0..(horizontalRuler.Bounds.Width)]; verticalRuler.Text = vrule.Repeat ((int)Math.Ceiling ((double)(verticalRuler.Bounds.Height * 2) / (double)rule.Length)) [0..(verticalRuler.Bounds.Height*2)]; }; diff --git a/UICatalog/Scenarios/ContextMenus.cs b/UICatalog/Scenarios/ContextMenus.cs index 1e223034f..3026ba43e 100644 --- a/UICatalog/Scenarios/ContextMenus.cs +++ b/UICatalog/Scenarios/ContextMenus.cs @@ -58,7 +58,7 @@ namespace UICatalog.Scenarios { Point mousePos = default; - Win.KeyPress += (e) => { + Win.KeyPress += (s, e) => { if (e.KeyEvent.Key == (Key.Space | Key.CtrlMask)) { ShowContextMenu (mousePos.X, mousePos.Y); e.Handled = true; diff --git a/UICatalog/Scenarios/CsvEditor.cs b/UICatalog/Scenarios/CsvEditor.cs index 6bdb8554b..17eb9a873 100644 --- a/UICatalog/Scenarios/CsvEditor.cs +++ b/UICatalog/Scenarios/CsvEditor.cs @@ -472,7 +472,7 @@ namespace UICatalog.Scenarios { } - private void TableViewKeyPress (View.KeyEventEventArgs e) + private void TableViewKeyPress (object sender, View.KeyEventEventArgs e) { if (e.KeyEvent.Key == Key.DeleteChar) { diff --git a/UICatalog/Scenarios/DynamicMenuBar.cs b/UICatalog/Scenarios/DynamicMenuBar.cs index 6f96aee71..b03dd24f4 100644 --- a/UICatalog/Scenarios/DynamicMenuBar.cs +++ b/UICatalog/Scenarios/DynamicMenuBar.cs @@ -729,7 +729,7 @@ namespace UICatalog.Scenarios { Width = Dim.Fill (), ReadOnly = true }; - _txtShortcut.KeyDown += (e) => { + _txtShortcut.KeyDown += (s, e) => { if (!ProcessKey (e.KeyEvent)) { return; } @@ -772,7 +772,7 @@ namespace UICatalog.Scenarios { return true; } - _txtShortcut.KeyUp += (e) => { + _txtShortcut.KeyUp += (s, e) => { var k = ShortcutHelper.GetModifiersKey (e.KeyEvent); if (CheckShortcut (k, false)) { e.Handled = true; diff --git a/UICatalog/Scenarios/DynamicStatusBar.cs b/UICatalog/Scenarios/DynamicStatusBar.cs index d76a05b69..7da6352b7 100644 --- a/UICatalog/Scenarios/DynamicStatusBar.cs +++ b/UICatalog/Scenarios/DynamicStatusBar.cs @@ -401,7 +401,7 @@ namespace UICatalog.Scenarios { Width = Dim.Fill (), ReadOnly = true }; - _txtShortcut.KeyDown += (e) => { + _txtShortcut.KeyDown += (s, e) => { if (!ProcessKey (e.KeyEvent)) { return; } @@ -445,7 +445,7 @@ namespace UICatalog.Scenarios { return true; } - _txtShortcut.KeyUp += (e) => { + _txtShortcut.KeyUp += (s, e) => { var k = ShortcutHelper.GetModifiersKey (e.KeyEvent); if (CheckShortcut (k, false)) { e.Handled = true; diff --git a/UICatalog/Scenarios/Editor.cs b/UICatalog/Scenarios/Editor.cs index e4941f6b9..3cf2376e7 100644 --- a/UICatalog/Scenarios/Editor.cs +++ b/UICatalog/Scenarios/Editor.cs @@ -171,7 +171,7 @@ namespace UICatalog.Scenarios { _scrollBar.Refresh (); }; - Win.KeyPress += (e) => { + Win.KeyPress += (s, e) => { var keys = ShortcutHelper.GetModifiersKey (e.KeyEvent); if (_winDialog != null && (e.KeyEvent.Key == Key.Esc || e.KeyEvent.Key == (Key.Q | Key.CtrlMask))) { diff --git a/UICatalog/Scenarios/InteractiveTree.cs b/UICatalog/Scenarios/InteractiveTree.cs index f51f10238..a8da38ca2 100644 --- a/UICatalog/Scenarios/InteractiveTree.cs +++ b/UICatalog/Scenarios/InteractiveTree.cs @@ -49,7 +49,7 @@ namespace UICatalog.Scenarios { } - private void TreeView_KeyPress (View.KeyEventEventArgs obj) + private void TreeView_KeyPress (object sender, View.KeyEventEventArgs obj) { if (obj.KeyEvent.Key == Key.DeleteChar) { diff --git a/UICatalog/Scenarios/Keys.cs b/UICatalog/Scenarios/Keys.cs index 21b567f6d..3278b146d 100644 --- a/UICatalog/Scenarios/Keys.cs +++ b/UICatalog/Scenarios/Keys.cs @@ -92,7 +92,7 @@ namespace UICatalog.Scenarios { }; Win.Add (labelKeypress); - Win.KeyPress += (a) => labelKeypress.Text = a.KeyEvent.ToString (); + Win.KeyPress += (s,e) => labelKeypress.Text = e.KeyEvent.ToString (); // Key stroke log: var keyLogLabel = new Label ("Key stroke log:") { @@ -169,9 +169,9 @@ namespace UICatalog.Scenarios { Height = Dim.Fill (), }; - Win.KeyDown += (a) => KeyDownPressUp (a.KeyEvent, "Down"); - Win.KeyPress += (a) => KeyDownPressUp (a.KeyEvent, "Press"); - Win.KeyUp += (a) => KeyDownPressUp (a.KeyEvent, "Up"); + Win.KeyDown += (s,a) => KeyDownPressUp (a.KeyEvent, "Down"); + Win.KeyPress += (s, a) => KeyDownPressUp (a.KeyEvent, "Press"); + Win.KeyUp += (s, a) => KeyDownPressUp (a.KeyEvent, "Up"); void KeyDownPressUp (KeyEvent keyEvent, string updown) { diff --git a/UICatalog/Scenarios/Notepad.cs b/UICatalog/Scenarios/Notepad.cs index 46ed50916..5fc6edbed 100644 --- a/UICatalog/Scenarios/Notepad.cs +++ b/UICatalog/Scenarios/Notepad.cs @@ -352,7 +352,7 @@ namespace UICatalog.Scenarios { { var textView = (TextView)View; // when user makes changes rename tab to indicate unsaved - textView.KeyUp += (k) => { + textView.KeyUp += (s, k) => { // if current text doesn't match saved text var areDiff = this.UnsavedChanges; diff --git a/UICatalog/Scenarios/SendKeys.cs b/UICatalog/Scenarios/SendKeys.cs index b38076cc7..0359c7d17 100644 --- a/UICatalog/Scenarios/SendKeys.cs +++ b/UICatalog/Scenarios/SendKeys.cs @@ -57,7 +57,7 @@ namespace UICatalog.Scenarios { var IsAlt = false; var IsCtrl = false; - txtResult.KeyPress += (e) => { + txtResult.KeyPress += (s, e) => { rKeys += (char)e.KeyEvent.Key; if (!IsShift && e.KeyEvent.IsShift) { rControlKeys += " Shift "; @@ -116,7 +116,7 @@ namespace UICatalog.Scenarios { button.Clicked += () => ProcessInput (); - Win.KeyPress += (e) => { + Win.KeyPress += (s, e) => { if (e.KeyEvent.Key == Key.Enter) { ProcessInput (); e.Handled = true; diff --git a/UICatalog/Scenarios/SingleBackgroundWorker.cs b/UICatalog/Scenarios/SingleBackgroundWorker.cs index e0268ab41..352f608b4 100644 --- a/UICatalog/Scenarios/SingleBackgroundWorker.cs +++ b/UICatalog/Scenarios/SingleBackgroundWorker.cs @@ -133,7 +133,7 @@ namespace UICatalog.Scenarios { public StagingUIController (DateTime? start, List list) { top = new Toplevel (Application.Top.Frame); - top.KeyPress += (e) => { + top.KeyPress += (s,e) => { // Prevents Ctrl+Q from closing this. // Only Ctrl+C is allowed. if (e.KeyEvent.Key == (Key.Q | Key.CtrlMask)) { diff --git a/UICatalog/Scenarios/TableEditor.cs b/UICatalog/Scenarios/TableEditor.cs index c045eefef..b9b1e168b 100644 --- a/UICatalog/Scenarios/TableEditor.cs +++ b/UICatalog/Scenarios/TableEditor.cs @@ -345,7 +345,7 @@ namespace UICatalog.Scenarios { } - private void TableViewKeyPress (View.KeyEventEventArgs e) + private void TableViewKeyPress (object sender, View.KeyEventEventArgs e) { if (e.KeyEvent.Key == Key.DeleteChar) { diff --git a/UICatalog/Scenarios/TextAlignmentsAndDirection.cs b/UICatalog/Scenarios/TextAlignmentsAndDirection.cs index 2bf02d45e..a78a4e9b8 100644 --- a/UICatalog/Scenarios/TextAlignmentsAndDirection.cs +++ b/UICatalog/Scenarios/TextAlignmentsAndDirection.cs @@ -118,7 +118,7 @@ namespace UICatalog.Scenarios { } }; - Win.KeyUp += (m) => { + Win.KeyUp += (s, m) => { foreach (var v in txts) { v.Text = editText.Text; } diff --git a/UICatalog/Scenarios/TextViewAutocompletePopup.cs b/UICatalog/Scenarios/TextViewAutocompletePopup.cs index cf740e712..e37019cd9 100644 --- a/UICatalog/Scenarios/TextViewAutocompletePopup.cs +++ b/UICatalog/Scenarios/TextViewAutocompletePopup.cs @@ -94,7 +94,7 @@ namespace UICatalog.Scenarios { Win.LayoutStarted += Win_LayoutStarted; } - private void Win_LayoutStarted (View.LayoutEventArgs obj) + private void Win_LayoutStarted (object sender, View.LayoutEventArgs obj) { miMultiline.Checked = textViewTopLeft.Multiline; miWrap.Checked = textViewTopLeft.WordWrap; diff --git a/UICatalog/Scenarios/TreeViewFileSystem.cs b/UICatalog/Scenarios/TreeViewFileSystem.cs index 6d45e34d5..56fcc7d4d 100644 --- a/UICatalog/Scenarios/TreeViewFileSystem.cs +++ b/UICatalog/Scenarios/TreeViewFileSystem.cs @@ -106,7 +106,7 @@ namespace UICatalog.Scenarios { ShowPropertiesOf (e.NewValue); } - private void TreeViewFiles_KeyPress (View.KeyEventEventArgs obj) + private void TreeViewFiles_KeyPress (object sender, View.KeyEventEventArgs obj) { if (obj.KeyEvent.Key == (Key.R | Key.CtrlMask)) { diff --git a/UICatalog/Scenarios/VkeyPacketSimulator.cs b/UICatalog/Scenarios/VkeyPacketSimulator.cs index ff587e042..d9a8f3ffa 100644 --- a/UICatalog/Scenarios/VkeyPacketSimulator.cs +++ b/UICatalog/Scenarios/VkeyPacketSimulator.cs @@ -88,7 +88,7 @@ namespace UICatalog.Scenarios { ReadOnly = true }; - tvOutput.KeyDown += (e) => { + tvOutput.KeyDown += (s, e) => { //System.Diagnostics.Debug.WriteLine ($"Output - KeyDown: {e.KeyEvent.Key}"); e.Handled = true; if (e.KeyEvent.Key == Key.Unknown) { @@ -96,7 +96,7 @@ namespace UICatalog.Scenarios { } }; - tvOutput.KeyPress += (e) => { + tvOutput.KeyPress += (s, e) => { //System.Diagnostics.Debug.WriteLine ($"Output - KeyPress - _keyboardStrokes: {_keyboardStrokes.Count}"); if (_outputStarted && _keyboardStrokes.Count > 0) { var ev = ShortcutHelper.GetModifiersKey (e.KeyEvent); @@ -114,7 +114,7 @@ namespace UICatalog.Scenarios { Win.Add (tvOutput); - tvInput.KeyDown += (e) => { + tvInput.KeyDown += (s, e) => { //System.Diagnostics.Debug.WriteLine ($"Input - KeyDown: {e.KeyEvent.Key}"); e.Handled = true; if (e.KeyEvent.Key == Key.Unknown) { @@ -124,7 +124,7 @@ namespace UICatalog.Scenarios { View.KeyEventEventArgs unknownChar = null; - tvInput.KeyPress += (e) => { + tvInput.KeyPress += (s, e) => { if (e.KeyEvent.Key == (Key.Q | Key.CtrlMask)) { Application.RequestStop (); return; @@ -152,7 +152,7 @@ namespace UICatalog.Scenarios { //System.Diagnostics.Debug.WriteLine ($"Input - KeyPress - _keyboardStrokes: {_keyboardStrokes.Count}"); }; - tvInput.KeyUp += (e) => { + tvInput.KeyUp += (s, e) => { //System.Diagnostics.Debug.WriteLine ($"Input - KeyUp: {e.KeyEvent.Key}"); //var ke = e.KeyEvent; var ke = ShortcutHelper.GetModifiersKey (e.KeyEvent); @@ -221,7 +221,7 @@ namespace UICatalog.Scenarios { tvInput.SetFocus (); - Win.LayoutComplete += (_) => { + Win.LayoutComplete += (s, e) => { inputHorizontalRuler.Text = outputHorizontalRuler.Text = ruler.Repeat ((int)Math.Ceiling ((double)(inputHorizontalRuler.Bounds.Width) / (double)ruler.Length)) [0..(inputHorizontalRuler.Bounds.Width)]; inputVerticalRuler.Height = tvInput.Frame.Height + 1; inputVerticalRuler.Text = ruler.Repeat ((int)Math.Ceiling ((double)(inputVerticalRuler.Bounds.Height) / (double)ruler.Length)) [0..(inputVerticalRuler.Bounds.Height)]; diff --git a/UICatalog/UICatalog.cs b/UICatalog/UICatalog.cs index 52e152147..b4977eab6 100644 --- a/UICatalog/UICatalog.cs +++ b/UICatalog/UICatalog.cs @@ -651,7 +651,7 @@ namespace UICatalog { Application.Top.SetNeedsDisplay (); } - void KeyDownHandler (View.KeyEventEventArgs a) + void KeyDownHandler (object sender, View.KeyEventEventArgs a) { if (a.KeyEvent.IsCapslock) { Capslock.Title = "Caps: On"; diff --git a/UnitTests/Application/ApplicationTests.cs b/UnitTests/Application/ApplicationTests.cs index e2433beb1..ad73e43ea 100644 --- a/UnitTests/Application/ApplicationTests.cs +++ b/UnitTests/Application/ApplicationTests.cs @@ -582,7 +582,7 @@ namespace Terminal.Gui.ApplicationTests { int keyUps = 0; var output = string.Empty; - Application.Top.KeyUp += (View.KeyEventEventArgs args) => { + Application.Top.KeyUp += (object sender, View.KeyEventEventArgs args) => { if (args.KeyEvent.Key != (Key.CtrlMask | Key.Q)) { output += (char)args.KeyEvent.KeyValue; } diff --git a/UnitTests/Core/ViewTests.cs b/UnitTests/Core/ViewTests.cs index be32cee2c..89afa229f 100644 --- a/UnitTests/Core/ViewTests.cs +++ b/UnitTests/Core/ViewTests.cs @@ -1134,7 +1134,7 @@ namespace Terminal.Gui.CoreTests { var top = Application.Top; var text = new TextField (""); - text.KeyPress += (e) => { + text.KeyPress += (s, e) => { e.Handled = true; Assert.True (e.Handled); Assert.Equal (Key.N, e.KeyEvent.Key); @@ -1232,10 +1232,10 @@ namespace Terminal.Gui.CoreTests { Assert.Equal (80, view.Bounds.Width); Assert.Equal (25, view.Bounds.Height); bool layoutStarted = false; - view.LayoutStarted += (_) => layoutStarted = true; + view.LayoutStarted += (s,e) => layoutStarted = true; view.OnLayoutStarted (null); Assert.True (layoutStarted); - view.LayoutComplete += (_) => layoutStarted = false; + view.LayoutComplete += (s,e) => layoutStarted = false; view.OnLayoutComplete (null); Assert.False (layoutStarted); view.X = Pos.Center () - 41; @@ -1539,7 +1539,7 @@ namespace Terminal.Gui.CoreTests { var tf = new TextField (); tf.KeyPress += Tf_KeyPress; - void Tf_KeyPress (View.KeyEventEventArgs obj) + void Tf_KeyPress (object sender, View.KeyEventEventArgs obj) { if (obj.KeyEvent.Key == (Key.Q | Key.CtrlMask)) { obj.Handled = tfQuiting = true; @@ -1551,7 +1551,7 @@ namespace Terminal.Gui.CoreTests { var top = Application.Top; top.KeyPress += Top_KeyPress; - void Top_KeyPress (View.KeyEventEventArgs obj) + void Top_KeyPress (object sender, View.KeyEventEventArgs obj) { if (obj.KeyEvent.Key == (Key.Q | Key.CtrlMask)) { obj.Handled = topQuiting = true; @@ -1599,7 +1599,7 @@ namespace Terminal.Gui.CoreTests { var tf = new TextField (); tf.KeyPress += Tf_KeyPress; - void Tf_KeyPress (View.KeyEventEventArgs obj) + void Tf_KeyPress (object sender, View.KeyEventEventArgs obj) { if (obj.KeyEvent.Key == (Key.Q | Key.CtrlMask)) { obj.Handled = tfQuiting = true; @@ -2287,21 +2287,21 @@ This is a tes var keyUp = false; var view = new DerivedView (); - view.KeyDown += (e) => { + view.KeyDown += (s, e) => { Assert.Equal (Key.a, e.KeyEvent.Key); Assert.False (keyDown); Assert.False (view.IsKeyDown); e.Handled = true; keyDown = true; }; - view.KeyPress += (e) => { + view.KeyPress += (s,e) => { Assert.Equal (Key.a, e.KeyEvent.Key); Assert.False (keyPress); Assert.False (view.IsKeyPress); e.Handled = true; keyPress = true; }; - view.KeyUp += (e) => { + view.KeyUp += (s, e) => { Assert.Equal (Key.a, e.KeyEvent.Key); Assert.False (keyUp); Assert.False (view.IsKeyUp); @@ -2390,7 +2390,7 @@ This is a tes var keyUp = false; var view = new DerivedView (); - view.KeyDown += (e) => { + view.KeyDown += (s,e) => { Assert.Equal (-1, e.KeyEvent.KeyValue); Assert.Equal (shift, e.KeyEvent.IsShift); Assert.Equal (alt, e.KeyEvent.IsAlt); @@ -2399,10 +2399,10 @@ This is a tes Assert.False (view.IsKeyDown); keyDown = true; }; - view.KeyPress += (e) => { + view.KeyPress += (s, e) => { keyPress = true; }; - view.KeyUp += (e) => { + view.KeyUp += (s, e) => { Assert.Equal (-1, e.KeyEvent.KeyValue); Assert.Equal (shift, e.KeyEvent.IsShift); Assert.Equal (alt, e.KeyEvent.IsAlt); @@ -2908,15 +2908,15 @@ At 0,0 Assert.Equal (new Rect (0, 0, 30, 1), label.NeedDisplay); Assert.Equal (new Rect (0, 0, 13, 1), button.NeedDisplay); - top.LayoutComplete += e => { + top.LayoutComplete += (s,e) => { Assert.Equal (new Rect (0, 0, 80, 25), top.NeedDisplay); }; - frame.LayoutComplete += e => { + frame.LayoutComplete += (s, e) => { Assert.Equal (new Rect (0, 0, 40, 8), frame.NeedDisplay); }; - frame.Subviews [0].LayoutComplete += e => { + frame.Subviews [0].LayoutComplete += (s, e) => { if (top.IsLoaded) { Assert.Equal (new Rect (0, 0, 38, 6), frame.Subviews [0].NeedDisplay); } else { @@ -2924,11 +2924,11 @@ At 0,0 } }; - label.LayoutComplete += e => { + label.LayoutComplete += (s, e) => { Assert.Equal (new Rect (0, 0, 38, 1), label.NeedDisplay); }; - button.LayoutComplete += e => { + button.LayoutComplete += (s, e) => { Assert.Equal (new Rect (0, 0, 13, 1), button.NeedDisplay); }; diff --git a/UnitTests/Drivers/ConsoleDriverTests.cs b/UnitTests/Drivers/ConsoleDriverTests.cs index 6444b8f1c..804ae83d7 100644 --- a/UnitTests/Drivers/ConsoleDriverTests.cs +++ b/UnitTests/Drivers/ConsoleDriverTests.cs @@ -82,7 +82,7 @@ namespace Terminal.Gui.DriverTests { var count = 0; var wasKeyPressed = false; - view.KeyPress += (e) => { + view.KeyPress += (s, e) => { wasKeyPressed = true; }; top.Add (view); @@ -121,7 +121,7 @@ namespace Terminal.Gui.DriverTests { var rText = ""; var idx = 0; - view.KeyPress += (e) => { + view.KeyPress += (s, e) => { Assert.Equal (text [idx], (char)e.KeyEvent.Key); rText += (char)e.KeyEvent.Key; Assert.Equal (rText, text.Substring (0, idx + 1)); @@ -473,7 +473,7 @@ namespace Terminal.Gui.DriverTests { var top = Application.Top; - top.KeyPress += (e) => { + top.KeyPress += (s, e) => { var after = ShortcutHelper.GetModifiersKey (e.KeyEvent); Assert.Equal (expectedRemapping, after); e.Handled = true; diff --git a/UnitTests/Menus/ContextMenuTests.cs b/UnitTests/Menus/ContextMenuTests.cs index 314993794..e08f84efb 100644 --- a/UnitTests/Menus/ContextMenuTests.cs +++ b/UnitTests/Menus/ContextMenuTests.cs @@ -175,7 +175,7 @@ namespace Terminal.Gui.MenuTests { var cm = new ContextMenu (); - lbl.KeyPress += (e) => { + lbl.KeyPress += (s, e) => { if (e.KeyEvent.Key == cm.Key) { lbl.Text = "Replaced"; e.Handled = true; diff --git a/UnitTests/TopLevels/ToplevelTests.cs b/UnitTests/TopLevels/ToplevelTests.cs index 691c90630..1da5891e5 100644 --- a/UnitTests/TopLevels/ToplevelTests.cs +++ b/UnitTests/TopLevels/ToplevelTests.cs @@ -1060,7 +1060,7 @@ namespace Terminal.Gui.TopLevelTests { view.LayoutStarted += view_LayoutStarted; - void view_LayoutStarted (View.LayoutEventArgs e) + void view_LayoutStarted (object sender, View.LayoutEventArgs e) { Assert.Equal (new Rect (0, 0, 20, 10), view.NeedDisplay); view.LayoutStarted -= view_LayoutStarted; diff --git a/UnitTests/Types/DimTests.cs b/UnitTests/Types/DimTests.cs index ebcfefe67..7d174647f 100644 --- a/UnitTests/Types/DimTests.cs +++ b/UnitTests/Types/DimTests.cs @@ -629,7 +629,7 @@ namespace Terminal.Gui.TypeTests { var field = new TextField () { X = 0, Y = Pos.Bottom (view), Width = 20 }; var count = 0; - field.KeyDown += (k) => { + field.KeyDown += (s, k) => { if (k.KeyEvent.Key == Key.Enter) { field.Text = $"Label {count}"; var label = new Label (field.Text) { X = 0, Y = view.Bounds.Height, Width = 20 }; @@ -996,7 +996,7 @@ namespace Terminal.Gui.TypeTests { var count = 0; var listLabels = new List