diff --git a/Example/Example.cs b/Example/Example.cs index 069e366d5..25fc42ade 100644 --- a/Example/Example.cs +++ b/Example/Example.cs @@ -57,7 +57,7 @@ public class ExampleWindow : Window { }; // When login button is clicked display a message popup - btnLogin.Clicked += () => { + btnLogin.Clicked += (s,e) => { if (usernameText.Text == "admin" && passwordText.Text == "password") { MessageBox.Query ("Logging In", "Login Successful", "Ok"); Application.RequestStop (); diff --git a/README.md b/README.md index 1fb484212..a344c541a 100644 --- a/README.md +++ b/README.md @@ -121,7 +121,7 @@ public class ExampleWindow : Window { }; // When login button is clicked display a message popup - btnLogin.Clicked += () => { + btnLogin.Clicked += (s,e) => { if (usernameText.Text == "admin" && passwordText.Text == "password") { MessageBox.Query ("Logging In", "Login Successful", "Ok"); Application.RequestStop (); diff --git a/Terminal.Gui/Core/Window.cs b/Terminal.Gui/Core/Window.cs index c647a3afd..cbf958a89 100644 --- a/Terminal.Gui/Core/Window.cs +++ b/Terminal.Gui/Core/Window.cs @@ -383,7 +383,7 @@ namespace Terminal.Gui { public virtual bool OnTitleChanging (ustring oldTitle, ustring newTitle) { var args = new TitleEventArgs (oldTitle, newTitle); - TitleChanging?.Invoke (args); + TitleChanging?.Invoke (this, args); return args.Cancel; } @@ -391,7 +391,7 @@ namespace Terminal.Gui { /// Event fired when the is changing. Set to /// `true` to cancel the Title change. /// - public event Action TitleChanging; + public event EventHandler TitleChanging; /// /// Called when the has been changed. Invokes the event. @@ -401,12 +401,12 @@ namespace Terminal.Gui { public virtual void OnTitleChanged (ustring oldTitle, ustring newTitle) { var args = new TitleEventArgs (oldTitle, newTitle); - TitleChanged?.Invoke (args); + TitleChanged?.Invoke (this, args); } /// /// Event fired after the has been changed. /// - public event Action TitleChanged; + public event EventHandler TitleChanged; } } diff --git a/Terminal.Gui/Views/Button.cs b/Terminal.Gui/Views/Button.cs index c5995f838..f86b9e28e 100644 --- a/Terminal.Gui/Views/Button.cs +++ b/Terminal.Gui/Views/Button.cs @@ -231,7 +231,7 @@ namespace Terminal.Gui { /// public virtual void OnClicked () { - Clicked?.Invoke (); + Clicked?.Invoke (this, EventArgs.Empty); } /// @@ -243,7 +243,7 @@ namespace Terminal.Gui { /// raised when the button is activated either with /// the mouse or the keyboard. /// - public event Action Clicked; + public event EventHandler Clicked; /// public override bool MouseEvent (MouseEvent me) diff --git a/Terminal.Gui/Views/ColorPicker.cs b/Terminal.Gui/Views/ColorPicker.cs index 07472279a..5d3a91551 100644 --- a/Terminal.Gui/Views/ColorPicker.cs +++ b/Terminal.Gui/Views/ColorPicker.cs @@ -51,7 +51,7 @@ namespace Terminal.Gui { /// /// Fired when a color is picked. /// - public event Action ColorChanged; + public event EventHandler ColorChanged; private int selectColorIndex = (int)Color.Black; @@ -65,7 +65,7 @@ namespace Terminal.Gui { set { selectColorIndex = (int)value; - ColorChanged?.Invoke (); + ColorChanged?.Invoke (this, EventArgs.Empty); SetNeedsDisplay (); } } diff --git a/Terminal.Gui/Views/ComboBox.cs b/Terminal.Gui/Views/ComboBox.cs index 9bc6a80ec..b204d33b8 100644 --- a/Terminal.Gui/Views/ComboBox.cs +++ b/Terminal.Gui/Views/ComboBox.cs @@ -214,22 +214,22 @@ namespace Terminal.Gui { /// /// This event is raised when the selected item in the has changed. /// - public event Action SelectedItemChanged; + public event EventHandler SelectedItemChanged; /// /// This event is raised when the drop-down list is expanded. /// - public event Action Expanded; + public event EventHandler Expanded; /// /// This event is raised when the drop-down list is collapsed. /// - public event Action Collapsed; + public event EventHandler Collapsed; /// /// This event is raised when the user Double Clicks on an item or presses ENTER to open the selected item. /// - public event Action OpenSelectedItem; + public event EventHandler OpenSelectedItem; readonly IList searchset = new List (); ustring text = ""; @@ -294,7 +294,7 @@ namespace Terminal.Gui { search.TextChanged += Search_Changed; listview.Y = Pos.Bottom (search); - listview.OpenSelectedItem += (ListViewItemEventArgs a) => Selected (); + listview.OpenSelectedItem += (object sender, ListViewItemEventArgs a) => Selected (); this.Add (search, listview); @@ -309,7 +309,7 @@ namespace Terminal.Gui { } }; - listview.SelectedItemChanged += (ListViewItemEventArgs e) => { + listview.SelectedItemChanged += (object sender, ListViewItemEventArgs e) => { if (!HideDropdownListOnClick && searchset.Count > 0) { SetValue (searchset [listview.SelectedItem]); @@ -466,7 +466,7 @@ namespace Terminal.Gui { /// public virtual void OnExpanded () { - Expanded?.Invoke (); + Expanded?.Invoke (this, EventArgs.Empty); } /// @@ -474,7 +474,7 @@ namespace Terminal.Gui { /// public virtual void OnCollapsed () { - Collapsed?.Invoke (); + Collapsed?.Invoke (this, EventArgs.Empty); } /// @@ -515,7 +515,7 @@ namespace Terminal.Gui { { // Note: Cannot rely on "listview.SelectedItem != lastSelectedItem" because the list is dynamic. // So we cannot optimize. Ie: Don't call if not changed - SelectedItemChanged?.Invoke (new ListViewItemEventArgs (SelectedItem, search.Text)); + SelectedItemChanged?.Invoke (this, new ListViewItemEventArgs (SelectedItem, search.Text)); return true; } @@ -528,7 +528,7 @@ namespace Terminal.Gui { { var value = search.Text; lastSelectedItem = SelectedItem; - OpenSelectedItem?.Invoke (new ListViewItemEventArgs (SelectedItem, value)); + OpenSelectedItem?.Invoke (this, new ListViewItemEventArgs (SelectedItem, value)); return true; } diff --git a/Terminal.Gui/Views/ContextMenu.cs b/Terminal.Gui/Views/ContextMenu.cs index 2c7d0d109..e4cd03d06 100644 --- a/Terminal.Gui/Views/ContextMenu.cs +++ b/Terminal.Gui/Views/ContextMenu.cs @@ -169,7 +169,7 @@ namespace Terminal.Gui { /// /// Event invoked when the is changed. /// - public event Action KeyChanged; + public event EventHandler KeyChanged; /// /// Event invoked when the is changed. @@ -194,7 +194,7 @@ namespace Terminal.Gui { set { var oldKey = key; key = value; - KeyChanged?.Invoke (oldKey); + KeyChanged?.Invoke (this, new KeyChangedEventArgs(oldKey,key)); } } diff --git a/Terminal.Gui/Views/Label.cs b/Terminal.Gui/Views/Label.cs index 0a1d795b3..444d4926a 100644 --- a/Terminal.Gui/Views/Label.cs +++ b/Terminal.Gui/Views/Label.cs @@ -68,7 +68,7 @@ namespace Terminal.Gui { /// raised when the button is activated either with /// the mouse or the keyboard. /// - public event Action Clicked; + public event EventHandler Clicked; ///// //public new ustring Text { @@ -139,7 +139,7 @@ namespace Terminal.Gui { /// public virtual void OnClicked () { - Clicked?.Invoke (); + Clicked?.Invoke (this, EventArgs.Empty); } } } diff --git a/Terminal.Gui/Views/ListView.cs b/Terminal.Gui/Views/ListView.cs index 498c494fd..506cf7019 100644 --- a/Terminal.Gui/Views/ListView.cs +++ b/Terminal.Gui/Views/ListView.cs @@ -395,17 +395,17 @@ namespace Terminal.Gui { /// /// This event is raised when the selected item in the has changed. /// - public event Action SelectedItemChanged; + public event EventHandler SelectedItemChanged; /// /// This event is raised when the user Double Clicks on an item or presses ENTER to open the selected item. /// - public event Action OpenSelectedItem; + public event EventHandler OpenSelectedItem; /// /// This event is invoked when this is being drawn before rendering. /// - public event Action RowRender; + public event EventHandler RowRender; /// /// Gets the that searches the collection as @@ -685,7 +685,7 @@ namespace Terminal.Gui { { if (selected != lastSelectedItem) { var value = source?.Count > 0 ? source.ToList () [selected] : null; - SelectedItemChanged?.Invoke (new ListViewItemEventArgs (selected, value)); + SelectedItemChanged?.Invoke (this, new ListViewItemEventArgs (selected, value)); if (HasFocus) { lastSelectedItem = selected; } @@ -707,7 +707,7 @@ namespace Terminal.Gui { var value = source.ToList () [selected]; - OpenSelectedItem?.Invoke (new ListViewItemEventArgs (selected, value)); + OpenSelectedItem?.Invoke (this, new ListViewItemEventArgs (selected, value)); return true; } @@ -718,7 +718,7 @@ namespace Terminal.Gui { /// public virtual void OnRowRender (ListViewRowEventArgs rowEventArgs) { - RowRender?.Invoke (rowEventArgs); + RowRender?.Invoke (this, rowEventArgs); } /// diff --git a/Terminal.Gui/Views/Menu.cs b/Terminal.Gui/Views/Menu.cs index e4019237f..3eaed4c9d 100644 --- a/Terminal.Gui/Views/Menu.cs +++ b/Terminal.Gui/Views/Menu.cs @@ -1196,7 +1196,7 @@ namespace Terminal.Gui { /// /// Raised as a menu is opening. /// - public event Action MenuOpening; + public event EventHandler MenuOpening; /// /// Raised when a menu is opened. @@ -1244,7 +1244,7 @@ namespace Terminal.Gui { public virtual MenuOpeningEventArgs OnMenuOpening (MenuBarItem currentMenu) { var ev = new MenuOpeningEventArgs (currentMenu); - MenuOpening?.Invoke (ev); + MenuOpening?.Invoke (this, ev); return ev; } diff --git a/Terminal.Gui/Views/TextField.cs b/Terminal.Gui/Views/TextField.cs index fecc2cb42..7b0f88e33 100644 --- a/Terminal.Gui/Views/TextField.cs +++ b/Terminal.Gui/Views/TextField.cs @@ -228,9 +228,9 @@ namespace Terminal.Gui { }); } - private void ContextMenu_KeyChanged (Key obj) + private void ContextMenu_KeyChanged (object sender, KeyChangedEventArgs e) { - ReplaceKeyBinding (obj, ContextMenu.Key); + ReplaceKeyBinding (e.OldKey, e.NewKey); } private void HistoryText_ChangeText (HistoryText.HistoryTextItem obj) diff --git a/Terminal.Gui/Views/TextView.cs b/Terminal.Gui/Views/TextView.cs index 91472cd3b..8556b6cfb 100644 --- a/Terminal.Gui/Views/TextView.cs +++ b/Terminal.Gui/Views/TextView.cs @@ -1378,9 +1378,9 @@ namespace Terminal.Gui { }); } - private void ContextMenu_KeyChanged (Key obj) + private void ContextMenu_KeyChanged (object sender, KeyChangedEventArgs e) { - ReplaceKeyBinding (obj, ContextMenu.Key); + ReplaceKeyBinding (e.OldKey, e.NewKey); } private void Model_LinesLoaded () diff --git a/Terminal.Gui/Windows/FileDialog.cs b/Terminal.Gui/Windows/FileDialog.cs index 6eee497fb..2d2307967 100644 --- a/Terminal.Gui/Windows/FileDialog.cs +++ b/Terminal.Gui/Windows/FileDialog.cs @@ -678,7 +678,7 @@ namespace Terminal.Gui { HideDropdownListOnClick = true }; cmbAllowedTypes.SetSource (allowedTypes ?? new List ()); - cmbAllowedTypes.OpenSelectedItem += (e) => { + cmbAllowedTypes.OpenSelectedItem += (s, e) => { dirListView.AllowedFileTypes = cmbAllowedTypes.Text.ToString ().Split (';'); dirListView.Reload (); }; @@ -698,7 +698,7 @@ namespace Terminal.Gui { dirListView.FileChanged = (file) => nameEntry.Text = file == ".." ? "" : file; dirListView.SelectedChanged = (file) => nameEntry.Text = file.Item1 == ".." ? "" : file.Item1; this.cancel = new Button ("Cancel"); - this.cancel.Clicked += () => { + this.cancel.Clicked += (s,e) => { Cancel (); }; AddButton (cancel); @@ -707,7 +707,7 @@ namespace Terminal.Gui { IsDefault = true, Enabled = nameEntry.Text.IsEmpty ? false : true }; - this.prompt.Clicked += () => { + this.prompt.Clicked += (s,e) => { if (this is OpenDialog) { if (!dirListView.GetValidFilesName (nameEntry.Text.ToString (), out string res)) { nameEntry.Text = res; diff --git a/Terminal.Gui/Windows/MessageBox.cs b/Terminal.Gui/Windows/MessageBox.cs index 4f509f146..0ac9e8a94 100644 --- a/Terminal.Gui/Windows/MessageBox.cs +++ b/Terminal.Gui/Windows/MessageBox.cs @@ -311,7 +311,7 @@ namespace Terminal.Gui { for (int n = 0; n < buttonList.Count; n++) { int buttonId = n; var b = buttonList [n]; - b.Clicked += () => { + b.Clicked += (s,e) => { Clicked = buttonId; Application.RequestStop (); }; diff --git a/Terminal.Gui/Windows/Wizard.cs b/Terminal.Gui/Windows/Wizard.cs index b0ab0ff63..846cb440d 100644 --- a/Terminal.Gui/Windows/Wizard.cs +++ b/Terminal.Gui/Windows/Wizard.cs @@ -400,7 +400,7 @@ namespace Terminal.Gui { } } - private void NextfinishBtn_Clicked () + private void NextfinishBtn_Clicked (object sender, EventArgs e) { if (CurrentStep == GetLastStep ()) { var args = new WizardButtonEventArgs (); @@ -486,7 +486,7 @@ namespace Terminal.Gui { return null; } - private void BackBtn_Clicked () + private void BackBtn_Clicked (object sender, EventArgs e) { var args = new WizardButtonEventArgs (); MovingBack?.Invoke (args); diff --git a/UICatalog/KeyBindingsDialog.cs b/UICatalog/KeyBindingsDialog.cs index 5bcb5611c..278f9981a 100644 --- a/UICatalog/KeyBindingsDialog.cs +++ b/UICatalog/KeyBindingsDialog.cs @@ -154,14 +154,14 @@ namespace UICatalog { btnChange.Clicked += RemapKey; var close = new Button ("Ok"); - close.Clicked += () => { + close.Clicked += (s,e) => { Application.RequestStop (); ViewTracker.Instance.StartUsingNewKeyMap (CurrentBindings); }; AddButton (close); var cancel = new Button ("Cancel"); - cancel.Clicked += ()=>Application.RequestStop(); + cancel.Clicked += (s,e)=>Application.RequestStop(); AddButton (cancel); // Register event handler as the last thing in constructor to prevent early calls @@ -172,7 +172,7 @@ namespace UICatalog { SetTextBoxToShowBinding (commands.First()); } - private void RemapKey () + private void RemapKey (object sender, EventArgs e) { var cmd = commands [commandsListView.SelectedItem]; Key? key = null; @@ -201,7 +201,7 @@ namespace UICatalog { SetNeedsDisplay (); } - private void CommandsListView_SelectedItemChanged (ListViewItemEventArgs obj) + private void CommandsListView_SelectedItemChanged (object sender, ListViewItemEventArgs obj) { SetTextBoxToShowBinding ((Command)obj.Value); } diff --git a/UICatalog/Scenarios/ASCIICustomButton.cs b/UICatalog/Scenarios/ASCIICustomButton.cs index 802709f63..c731d187c 100644 --- a/UICatalog/Scenarios/ASCIICustomButton.cs +++ b/UICatalog/Scenarios/ASCIICustomButton.cs @@ -271,7 +271,7 @@ namespace UICatalog.Scenarios { } } - private void Button_Clicked () + private void Button_Clicked (object sender, EventArgs e) { MessageBox.Query ("Button clicked.", $"'{selected.Text}' clicked!", "Ok"); if (selected.Text == "Close") { diff --git a/UICatalog/Scenarios/AllViewsTester.cs b/UICatalog/Scenarios/AllViewsTester.cs index 4387a8d9b..7ef9ff4d6 100644 --- a/UICatalog/Scenarios/AllViewsTester.cs +++ b/UICatalog/Scenarios/AllViewsTester.cs @@ -83,10 +83,10 @@ namespace UICatalog.Scenarios { AllowsMarking = false, ColorScheme = Colors.TopLevel, }; - _classListView.OpenSelectedItem += (a) => { + _classListView.OpenSelectedItem += (s, a) => { _settingsPane.SetFocus (); }; - _classListView.SelectedItemChanged += (args) => { + _classListView.SelectedItemChanged += (s,args) => { ClearClass (_curView); _curView = CreateClass (_viewClasses.Values.ToArray () [_classListView.SelectedItem]); }; diff --git a/UICatalog/Scenarios/BackgroundWorkerCollection.cs b/UICatalog/Scenarios/BackgroundWorkerCollection.cs index d2448e156..2573b00e5 100644 --- a/UICatalog/Scenarios/BackgroundWorkerCollection.cs +++ b/UICatalog/Scenarios/BackgroundWorkerCollection.cs @@ -69,7 +69,7 @@ namespace UICatalog.Scenarios { Dispose (); } - private void Menu_MenuOpening (MenuOpeningEventArgs menu) + private void Menu_MenuOpening (object sender, MenuOpeningEventArgs menu) { if (!canOpenWorkerApp) { canOpenWorkerApp = true; @@ -328,7 +328,7 @@ namespace UICatalog.Scenarios { Add (listView); start = new Button ("Start") { IsDefault = true }; - start.Clicked += () => { + start.Clicked += (s,e) => { Staging = new Staging (DateTime.Now); RequestStop (); }; @@ -340,7 +340,7 @@ namespace UICatalog.Scenarios { KeyPress += (s, e) => { if (e.KeyEvent.Key == Key.Esc) { - OnReportClosed (); + OnReportClosed (this, EventArgs.Empty); } }; @@ -358,7 +358,7 @@ namespace UICatalog.Scenarios { }; } - private void OnReportClosed () + private void OnReportClosed (object sender, EventArgs e) { if (Staging?.StartStaging != null) { ReportClosed?.Invoke (this); diff --git a/UICatalog/Scenarios/Borders.cs b/UICatalog/Scenarios/Borders.cs index c176ed040..f1ed391af 100644 --- a/UICatalog/Scenarios/Borders.cs +++ b/UICatalog/Scenarios/Borders.cs @@ -191,7 +191,7 @@ namespace UICatalog.Scenarios { X = Pos.Left (paddingLeftEdit), Y = 5 }; - replacePadding.Clicked += () => { + replacePadding.Clicked += (s,e) => { smartPanel.Child.Border.Padding = new Thickness (smartPanel.Child.Border.Padding.Top); smartLabel.Border.Padding = new Thickness (smartLabel.Border.Padding.Top); if (paddingTopEdit.Text.IsEmpty) { @@ -310,7 +310,7 @@ namespace UICatalog.Scenarios { X = Pos.Left (borderLeftEdit), Y = 5 }; - replaceBorder.Clicked += () => { + replaceBorder.Clicked += (s,e) => { smartPanel.Child.Border.BorderThickness = new Thickness (smartPanel.Child.Border.BorderThickness.Top); smartLabel.Border.BorderThickness = new Thickness (smartLabel.Border.BorderThickness.Top); if (borderTopEdit.Text.IsEmpty) { diff --git a/UICatalog/Scenarios/BordersComparisons.cs b/UICatalog/Scenarios/BordersComparisons.cs index 3ea642d3b..2ecb4fbcb 100644 --- a/UICatalog/Scenarios/BordersComparisons.cs +++ b/UICatalog/Scenarios/BordersComparisons.cs @@ -35,7 +35,7 @@ namespace UICatalog.Scenarios { X = Pos.Center (), Y = Pos.Center (), }; - button.Clicked += () => MessageBox.Query (20, 7, "Hi", "I'm a Window?", "Yes", "No"); + button.Clicked += (s,e) => MessageBox.Query (20, 7, "Hi", "I'm a Window?", "Yes", "No"); var label = new Label ("I'm a Window") { X = Pos.Center (), Y = Pos.Center () - 1, @@ -74,7 +74,7 @@ namespace UICatalog.Scenarios { X = Pos.Center (), Y = Pos.Center (), }; - button2.Clicked += () => MessageBox.Query (20, 7, "Hi", "I'm a Toplevel?", "Yes", "No"); + button2.Clicked += (s,e) => MessageBox.Query (20, 7, "Hi", "I'm a Toplevel?", "Yes", "No"); var label2 = new Label ("I'm a Toplevel") { X = Pos.Center (), Y = Pos.Center () - 1, @@ -110,7 +110,7 @@ namespace UICatalog.Scenarios { X = Pos.Center (), Y = Pos.Center (), }; - button3.Clicked += () => MessageBox.Query (20, 7, "Hi", "I'm a FrameView?", "Yes", "No"); + button3.Clicked += (s,e) => MessageBox.Query (20, 7, "Hi", "I'm a FrameView?", "Yes", "No"); var label3 = new Label ("I'm a FrameView") { X = Pos.Center (), Y = Pos.Center () - 1, diff --git a/UICatalog/Scenarios/BordersOnContainers.cs b/UICatalog/Scenarios/BordersOnContainers.cs index 0debccc76..2b17284ae 100644 --- a/UICatalog/Scenarios/BordersOnContainers.cs +++ b/UICatalog/Scenarios/BordersOnContainers.cs @@ -37,7 +37,7 @@ namespace UICatalog.Scenarios { X = Pos.Center (), Y = Pos.Center (), }; - button.Clicked += () => MessageBox.Query (20, 7, "Hi", $"I'm a {typeName}?", "Yes", "No"); + button.Clicked += (s,e) => MessageBox.Query (20, 7, "Hi", $"I'm a {typeName}?", "Yes", "No"); var label = new Label ($"I'm a {typeName}") { X = Pos.Center (), Y = Pos.Center () - 1, @@ -140,7 +140,7 @@ namespace UICatalog.Scenarios { X = Pos.Left (paddingLeftEdit), Y = 5 }; - replacePadding.Clicked += () => { + replacePadding.Clicked += (s,e) => { smartView.Border.Padding = new Thickness (smartView.Border.Padding.Top); if (paddingTopEdit.Text.IsEmpty) { paddingTopEdit.Text = "0"; @@ -234,7 +234,7 @@ namespace UICatalog.Scenarios { X = Pos.Left (borderLeftEdit), Y = 5 }; - replaceBorder.Clicked += () => { + replaceBorder.Clicked += (s,e) => { smartView.Border.BorderThickness = new Thickness (smartView.Border.BorderThickness.Top); if (borderTopEdit.Text.IsEmpty) { borderTopEdit.Text = "0"; diff --git a/UICatalog/Scenarios/Buttons.cs b/UICatalog/Scenarios/Buttons.cs index 9b085a66b..678914170 100644 --- a/UICatalog/Scenarios/Buttons.cs +++ b/UICatalog/Scenarios/Buttons.cs @@ -30,11 +30,11 @@ namespace UICatalog.Scenarios { Y = Pos.Bottom (Win) - 3, IsDefault = true, }; - defaultButton.Clicked += () => Application.RequestStop (); + defaultButton.Clicked += (s,e) => Application.RequestStop (); Win.Add (defaultButton); var swapButton = new Button (50, 0, "Swap Default (Absolute Layout)"); - swapButton.Clicked += () => { + swapButton.Clicked += (s,e) => { defaultButton.IsDefault = !defaultButton.IsDefault; swapButton.IsDefault = !swapButton.IsDefault; }; @@ -42,7 +42,7 @@ namespace UICatalog.Scenarios { static void DoMessage (Button button, ustring txt) { - button.Clicked += () => { + button.Clicked += (s,e) => { var btnText = button.Text.ToString (); MessageBox.Query ("Message", $"Did you click {txt}?", "Yes", "No"); }; @@ -83,14 +83,14 @@ namespace UICatalog.Scenarios { X = 2, Y = Pos.Bottom (button) + 1, }); - button.Clicked += () => MessageBox.Query ("Message", "Question?", "Yes", "No"); + button.Clicked += (s,e) => MessageBox.Query ("Message", "Question?", "Yes", "No"); var textChanger = new Button ("Te_xt Changer") { X = 2, Y = Pos.Bottom (button) + 1, }; Win.Add (textChanger); - textChanger.Clicked += () => textChanger.Text += "!"; + textChanger.Clicked += (s,e) => textChanger.Text += "!"; Win.Add (button = new Button ("Lets see if this will move as \"Text Changer\" grows") { X = Pos.Right (textChanger) + 2, @@ -104,7 +104,7 @@ namespace UICatalog.Scenarios { }; Win.Add (removeButton); // This in interesting test case because `moveBtn` and below are laid out relative to this one! - removeButton.Clicked += () => { + removeButton.Clicked += (s,e) => { // Now this throw a InvalidOperationException on the TopologicalSort method as is expected. //Win.Remove (removeButton); @@ -126,7 +126,7 @@ namespace UICatalog.Scenarios { Width = 30, ColorScheme = Colors.Error, }; - moveBtn.Clicked += () => { + moveBtn.Clicked += (s,e) => { moveBtn.X = moveBtn.Frame.X + 5; // This is already fixed with the call to SetNeedDisplay() in the Pos Dim. //computedFrame.LayoutSubviews (); // BUGBUG: This call should not be needed. View.X is not causing relayout correctly @@ -140,7 +140,7 @@ namespace UICatalog.Scenarios { Width = 30, ColorScheme = Colors.Error, }; - sizeBtn.Clicked += () => { + sizeBtn.Clicked += (s,e) => { sizeBtn.Width = sizeBtn.Frame.Width + 5; //computedFrame.LayoutSubviews (); // FIXED: This call should not be needed. View.X is not causing relayout correctly }; @@ -158,7 +158,7 @@ namespace UICatalog.Scenarios { var moveBtnA = new Button (0, 0, "Move This Button via Frame") { ColorScheme = Colors.Error, }; - moveBtnA.Clicked += () => { + moveBtnA.Clicked += (s,e) => { moveBtnA.Frame = new Rect (moveBtnA.Frame.X + 5, moveBtnA.Frame.Y, moveBtnA.Frame.Width, moveBtnA.Frame.Height); }; absoluteFrame.Add (moveBtnA); @@ -167,7 +167,7 @@ namespace UICatalog.Scenarios { var sizeBtnA = new Button (0, 2, " ~  s  gui.cs   master ↑10 = Со_хранить") { ColorScheme = Colors.Error, }; - sizeBtnA.Clicked += () => { + sizeBtnA.Clicked += (s,e) => { sizeBtnA.Frame = new Rect (sizeBtnA.Frame.X, sizeBtnA.Frame.Y, sizeBtnA.Frame.Width + 5, sizeBtnA.Frame.Height); }; absoluteFrame.Add (sizeBtnA); @@ -218,7 +218,7 @@ namespace UICatalog.Scenarios { Width = Dim.Width (computedFrame) - 2, ColorScheme = Colors.TopLevel, }; - moveHotKeyBtn.Clicked += () => { + moveHotKeyBtn.Clicked += (s,e) => { moveHotKeyBtn.Text = MoveHotkey (moveHotKeyBtn.Text); }; Win.Add (moveHotKeyBtn); @@ -230,7 +230,7 @@ namespace UICatalog.Scenarios { Width = Dim.Width (absoluteFrame) - 2, // BUGBUG: Not always the width isn't calculated correctly. ColorScheme = Colors.TopLevel, }; - moveUnicodeHotKeyBtn.Clicked += () => { + moveUnicodeHotKeyBtn.Clicked += (s,e) => { moveUnicodeHotKeyBtn.Text = MoveHotkey (moveUnicodeHotKeyBtn.Text); }; Win.Add (moveUnicodeHotKeyBtn); diff --git a/UICatalog/Scenarios/CharacterMap.cs b/UICatalog/Scenarios/CharacterMap.cs index 0018d825f..b89d2fa5a 100644 --- a/UICatalog/Scenarios/CharacterMap.cs +++ b/UICatalog/Scenarios/CharacterMap.cs @@ -84,7 +84,7 @@ namespace UICatalog.Scenarios { Height = Dim.Fill(1), SelectedItem = 0 }; - jumpList.SelectedItemChanged += (args) => { + jumpList.SelectedItemChanged += (s, args) => { _charMap.StartGlyph = radioItems [jumpList.SelectedItem].start; }; diff --git a/UICatalog/Scenarios/Clipping.cs b/UICatalog/Scenarios/Clipping.cs index 0d68229a9..606902bd4 100644 --- a/UICatalog/Scenarios/Clipping.cs +++ b/UICatalog/Scenarios/Clipping.cs @@ -58,7 +58,7 @@ namespace UICatalog.Scenarios { }; var testButton = new Button (2, 2, "click me"); - testButton.Clicked += () => { + testButton.Clicked += (s,e) => { MessageBox.Query (10, 5, "Test", "test message", "Ok"); }; embedded3.Add (testButton); diff --git a/UICatalog/Scenarios/ColorPicker.cs b/UICatalog/Scenarios/ColorPicker.cs index 29ead81ae..290dd7899 100644 --- a/UICatalog/Scenarios/ColorPicker.cs +++ b/UICatalog/Scenarios/ColorPicker.cs @@ -78,7 +78,7 @@ namespace UICatalog.Scenarios { /// /// Fired when foreground color is changed. /// - private void ForegroundColor_ColorChanged () + private void ForegroundColor_ColorChanged (object sender, EventArgs e) { UpdateColorLabel (foregroundColorLabel, foregroundColorPicker); UpdateDemoLabel (); @@ -87,7 +87,7 @@ namespace UICatalog.Scenarios { /// /// Fired when background color is changed. /// - private void BackgroundColor_ColorChanged () + private void BackgroundColor_ColorChanged (object sender, EventArgs e) { UpdateColorLabel (backgroundColorLabel, backgroundColorPicker); UpdateDemoLabel (); diff --git a/UICatalog/Scenarios/ComboBoxIteration.cs b/UICatalog/Scenarios/ComboBoxIteration.cs index 1c9e67002..d3062763b 100644 --- a/UICatalog/Scenarios/ComboBoxIteration.cs +++ b/UICatalog/Scenarios/ComboBoxIteration.cs @@ -38,12 +38,12 @@ namespace UICatalog.Scenarios { }; comboBox.SetSource (items); - listview.SelectedItemChanged += (e) => { + listview.SelectedItemChanged += (s,e) => { lbListView.Text = items [e.Item]; comboBox.SelectedItem = e.Item; }; - comboBox.SelectedItemChanged += (ListViewItemEventArgs text) => { + comboBox.SelectedItemChanged += (object sender, ListViewItemEventArgs text) => { if (text.Item != -1) { lbComboBox.Text = text.Value.ToString (); listview.SelectedItem = text.Item; @@ -55,7 +55,7 @@ namespace UICatalog.Scenarios { var btnTwo = new Button ("Two") { X = Pos.Right (comboBox) + 1, }; - btnTwo.Clicked += () => { + btnTwo.Clicked += (s,e) => { items = new List () { "one", "two" }; comboBox.SetSource (items); listview.SetSource (items); @@ -67,7 +67,7 @@ namespace UICatalog.Scenarios { X = Pos.Right (comboBox) + 1, Y = Pos.Top (comboBox) }; - btnThree.Clicked += () => { + btnThree.Clicked += (s,e) => { items = new List () { "one", "two", "three" }; comboBox.SetSource (items); listview.SetSource (items); diff --git a/UICatalog/Scenarios/ComputedLayout.cs b/UICatalog/Scenarios/ComputedLayout.cs index 9427cad84..4d3d1dfd4 100644 --- a/UICatalog/Scenarios/ComputedLayout.cs +++ b/UICatalog/Scenarios/ComputedLayout.cs @@ -207,7 +207,7 @@ namespace UICatalog.Scenarios { Y = Pos.AnchorEnd () - 1, }; anchorButton.X = Pos.AnchorEnd () - (Pos.Right (anchorButton) - Pos.Left (anchorButton)); - anchorButton.Clicked += () => { + anchorButton.Clicked += (s,e) => { // Ths demonstrates how to have a dynamically sized button // Each time the button is clicked the button's text gets longer // The call to Application.Top.LayoutSubviews causes the Computed layout to @@ -243,7 +243,7 @@ namespace UICatalog.Scenarios { var leftButton = new Button ("Left") { Y = Pos.AnchorEnd () - 1 // Pos.Combine }; - leftButton.Clicked += () => { + leftButton.Clicked += (s,e) => { // Ths demonstrates how to have a dynamically sized button // Each time the button is clicked the button's text gets longer // The call to Application.Top.LayoutSubviews causes the Computed layout to @@ -258,7 +258,7 @@ namespace UICatalog.Scenarios { X = Pos.Center (), Y = Pos.AnchorEnd (1) // Pos.AnchorEnd(1) }; - centerButton.Clicked += () => { + centerButton.Clicked += (s,e) => { // Ths demonstrates how to have a dynamically sized button // Each time the button is clicked the button's text gets longer // The call to Application.Top.LayoutSubviews causes the Computed layout to @@ -271,7 +271,7 @@ namespace UICatalog.Scenarios { var rightButton = new Button ("Right") { Y = Pos.Y (centerButton) }; - rightButton.Clicked += () => { + rightButton.Clicked += (s,e) => { // Ths demonstrates how to have a dynamically sized button // Each time the button is clicked the button's text gets longer // The call to Application.Top.LayoutSubviews causes the Computed layout to diff --git a/UICatalog/Scenarios/CsvEditor.cs b/UICatalog/Scenarios/CsvEditor.cs index 17eb9a873..89062a7e6 100644 --- a/UICatalog/Scenarios/CsvEditor.cs +++ b/UICatalog/Scenarios/CsvEditor.cs @@ -514,9 +514,9 @@ namespace UICatalog.Scenarios { bool okPressed = false; var ok = new Button ("Ok", is_default: true); - ok.Clicked += () => { okPressed = true; Application.RequestStop (); }; + ok.Clicked += (s,e) => { okPressed = true; Application.RequestStop (); }; var cancel = new Button ("Cancel"); - cancel.Clicked += () => { Application.RequestStop (); }; + cancel.Clicked += (s,e) => { Application.RequestStop (); }; var d = new Dialog (title, 60, 20, ok, cancel); var lbl = new Label () { diff --git a/UICatalog/Scenarios/Dialogs.cs b/UICatalog/Scenarios/Dialogs.cs index 50d0c3f5e..e864a6791 100644 --- a/UICatalog/Scenarios/Dialogs.cs +++ b/UICatalog/Scenarios/Dialogs.cs @@ -144,7 +144,7 @@ namespace UICatalog.Scenarios { Y = Pos.Bottom (frame) + 2, IsDefault = true, }; - showDialogButton.Clicked += () => { + showDialogButton.Clicked += (s,e) => { try { Dialog dialog = null; @@ -168,7 +168,7 @@ namespace UICatalog.Scenarios { button = new Button (NumberToWords.Convert (buttonId), is_default: buttonId == 0); } - button.Clicked += () => { + button.Clicked += (s,e) => { clicked = buttonId; Application.RequestStop (); }; @@ -193,7 +193,7 @@ namespace UICatalog.Scenarios { X = Pos.Center (), Y = Pos.Center () }; - add.Clicked += () => { + add.Clicked += (s,e) => { var buttonId = buttons.Count; Button button; if (glyphsNotWords.Checked == true) { @@ -203,7 +203,7 @@ namespace UICatalog.Scenarios { button = new Button (NumberToWords.Convert (buttonId), is_default: buttonId == 0); } - button.Clicked += () => { + button.Clicked += (s,e) => { clicked = buttonId; Application.RequestStop (); @@ -220,7 +220,7 @@ namespace UICatalog.Scenarios { X = Pos.Center (), Y = Pos.Center () + 1 }; - addChar.Clicked += () => { + addChar.Clicked += (s,e) => { foreach (var button in buttons) { button.Text += Char.ConvertFromUtf32 (CODE_POINT); } diff --git a/UICatalog/Scenarios/DynamicMenuBar.cs b/UICatalog/Scenarios/DynamicMenuBar.cs index b03dd24f4..542c6897a 100644 --- a/UICatalog/Scenarios/DynamicMenuBar.cs +++ b/UICatalog/Scenarios/DynamicMenuBar.cs @@ -209,7 +209,7 @@ namespace UICatalog.Scenarios { }; Add (_frmMenuDetails); - _btnMenuBarUp.Clicked += () => { + _btnMenuBarUp.Clicked += (s,e) => { var i = _currentSelectedMenuBar; var menuItem = _menuBar != null && _menuBar.Menus.Length > 0 ? _menuBar.Menus [i] : null; if (menuItem != null) { @@ -223,7 +223,7 @@ namespace UICatalog.Scenarios { } }; - _btnMenuBarDown.Clicked += () => { + _btnMenuBarDown.Clicked += (s,e) => { var i = _currentSelectedMenuBar; var menuItem = _menuBar != null && _menuBar.Menus.Length > 0 ? _menuBar.Menus [i] : null; if (menuItem != null) { @@ -237,7 +237,7 @@ namespace UICatalog.Scenarios { } }; - _btnUp.Clicked += () => { + _btnUp.Clicked += (s,e) => { var i = _lstMenus.SelectedItem; var menuItem = DataContext.Menus.Count > 0 ? DataContext.Menus [i].MenuItem : null; if (menuItem != null) { @@ -252,7 +252,7 @@ namespace UICatalog.Scenarios { } }; - _btnDown.Clicked += () => { + _btnDown.Clicked += (s,e) => { var i = _lstMenus.SelectedItem; var menuItem = DataContext.Menus.Count > 0 ? DataContext.Menus [i].MenuItem : null; if (menuItem != null) { @@ -267,7 +267,7 @@ namespace UICatalog.Scenarios { } }; - _btnPreviowsParent.Clicked += () => { + _btnPreviowsParent.Clicked += (s,e) => { if (_currentMenuBarItem != null && _currentMenuBarItem.Parent != null) { var mi = _currentMenuBarItem; _currentMenuBarItem = _currentMenuBarItem.Parent as MenuBarItem; @@ -297,16 +297,16 @@ namespace UICatalog.Scenarios { X = Pos.Right (_btnOk) + 3, Y = Pos.Top (_btnOk), }; - _btnCancel.Clicked += () => { + _btnCancel.Clicked += (s,e) => { SetFrameDetails (_currentEditMenuBarItem); }; Add (_btnCancel); - _lstMenus.SelectedItemChanged += (e) => { + _lstMenus.SelectedItemChanged += (s,e) => { SetFrameDetails (); }; - _btnOk.Clicked += () => { + _btnOk.Clicked += (s,e) => { if (ustring.IsNullOrEmpty (_frmMenuDetails._txtTitle.Text) && _currentEditMenuBarItem != null) { MessageBox.ErrorQuery ("Invalid title", "Must enter a valid title!.", "Ok"); } else if (_currentEditMenuBarItem != null) { @@ -322,7 +322,7 @@ namespace UICatalog.Scenarios { } }; - _btnAdd.Clicked += () => { + _btnAdd.Clicked += (s,e) => { if (MenuBar == null) { MessageBox.ErrorQuery ("Menu Bar Error", "Must add a MenuBar first!", "Ok"); _btnAddMenuBar.SetFocus (); @@ -359,7 +359,7 @@ namespace UICatalog.Scenarios { } }; - _btnRemove.Clicked += () => { + _btnRemove.Clicked += (s,e) => { var menuItem = DataContext.Menus.Count > 0 ? DataContext.Menus [_lstMenus.SelectedItem].MenuItem : null; if (menuItem != null) { var childrens = ((MenuBarItem)_currentMenuBarItem).Children; @@ -391,7 +391,7 @@ namespace UICatalog.Scenarios { } }; - _lstMenus.OpenSelectedItem += (e) => { + _lstMenus.OpenSelectedItem += (s,e) => { _currentMenuBarItem = DataContext.Menus [e.Item].MenuItem; if (!(_currentMenuBarItem is MenuBarItem)) { MessageBox.ErrorQuery ("Menu Open Error", "Must allows sub menus first!", "Ok"); @@ -409,14 +409,14 @@ namespace UICatalog.Scenarios { SetFrameDetails (menuBarItem); }; - _btnNext.Clicked += () => { + _btnNext.Clicked += (s,e) => { if (_menuBar != null && _currentSelectedMenuBar + 1 < _menuBar.Menus.Length) { _currentSelectedMenuBar++; } SelectCurrentMenuBarItem (); }; - _btnPrevious.Clicked += () => { + _btnPrevious.Clicked += (s,e) => { if (_currentSelectedMenuBar - 1 > -1) { _currentSelectedMenuBar--; } @@ -430,7 +430,7 @@ namespace UICatalog.Scenarios { } }; - _btnAddMenuBar.Clicked += () => { + _btnAddMenuBar.Clicked += (s,e) => { var frameDetails = new DynamicMenuBarDetails (null, false); var item = frameDetails.EnterMenuItem (); if (item == null) { @@ -457,7 +457,7 @@ namespace UICatalog.Scenarios { _menuBar.SetNeedsDisplay (); }; - _btnRemoveMenuBar.Clicked += () => { + _btnRemoveMenuBar.Clicked += (s,e) => { if (_menuBar == null || _menuBar.Menus.Length == 0) { return; } @@ -784,7 +784,7 @@ namespace UICatalog.Scenarios { X = Pos.X (_lblShortcut), Y = Pos.Bottom (_txtShortcut) + 1 }; - _btnShortcut.Clicked += () => { + _btnShortcut.Clicked += (s,e) => { _txtShortcut.Text = ""; }; Add (_btnShortcut); @@ -868,7 +868,7 @@ namespace UICatalog.Scenarios { var _btnOk = new Button ("Ok") { IsDefault = true, }; - _btnOk.Clicked += () => { + _btnOk.Clicked += (s,e) => { if (ustring.IsNullOrEmpty (_txtTitle.Text)) { MessageBox.ErrorQuery ("Invalid title", "Must enter a valid title!.", "Ok"); } else { @@ -877,7 +877,7 @@ namespace UICatalog.Scenarios { } }; var _btnCancel = new Button ("Cancel"); - _btnCancel.Clicked += () => { + _btnCancel.Clicked += (s,e) => { _txtTitle.Text = ustring.Empty; Application.RequestStop (); }; diff --git a/UICatalog/Scenarios/DynamicStatusBar.cs b/UICatalog/Scenarios/DynamicStatusBar.cs index 7da6352b7..d78327a63 100644 --- a/UICatalog/Scenarios/DynamicStatusBar.cs +++ b/UICatalog/Scenarios/DynamicStatusBar.cs @@ -142,7 +142,7 @@ namespace UICatalog.Scenarios { }; Add (_frmStatusBarDetails); - _btnUp.Clicked += () => { + _btnUp.Clicked += (s,e) => { var i = _lstItems.SelectedItem; var statusItem = DataContext.Items.Count > 0 ? DataContext.Items [i].StatusItem : null; if (statusItem != null) { @@ -158,7 +158,7 @@ namespace UICatalog.Scenarios { } }; - _btnDown.Clicked += () => { + _btnDown.Clicked += (s,e) => { var i = _lstItems.SelectedItem; var statusItem = DataContext.Items.Count > 0 ? DataContext.Items [i].StatusItem : null; if (statusItem != null) { @@ -184,16 +184,16 @@ namespace UICatalog.Scenarios { X = Pos.Right (_btnOk) + 3, Y = Pos.Top (_btnOk), }; - _btnCancel.Clicked += () => { + _btnCancel.Clicked += (s,e) => { SetFrameDetails (_currentEditStatusItem); }; Add (_btnCancel); - _lstItems.SelectedItemChanged += (e) => { + _lstItems.SelectedItemChanged += (s, e) => { SetFrameDetails (); }; - _btnOk.Clicked += () => { + _btnOk.Clicked += (s,e) => { if (ustring.IsNullOrEmpty (_frmStatusBarDetails._txtTitle.Text) && _currentEditStatusItem != null) { MessageBox.ErrorQuery ("Invalid title", "Must enter a valid title!.", "Ok"); } else if (_currentEditStatusItem != null) { @@ -206,7 +206,7 @@ namespace UICatalog.Scenarios { } }; - _btnAdd.Clicked += () => { + _btnAdd.Clicked += (s,e) => { if (StatusBar == null) { MessageBox.ErrorQuery ("StatusBar Bar Error", "Must add a StatusBar first!", "Ok"); _btnAddStatusBar.SetFocus (); @@ -227,7 +227,7 @@ namespace UICatalog.Scenarios { SetFrameDetails (); }; - _btnRemove.Clicked += () => { + _btnRemove.Clicked += (s,e) => { var statusItem = DataContext.Items.Count > 0 ? DataContext.Items [_lstItems.SelectedItem].StatusItem : null; if (statusItem != null) { _statusBar.RemoveItem (_currentSelectedStatusBar); @@ -245,7 +245,7 @@ namespace UICatalog.Scenarios { SetFrameDetails (statusItem); }; - _btnAddStatusBar.Clicked += () => { + _btnAddStatusBar.Clicked += (s,e) => { if (_statusBar != null) { return; } @@ -254,7 +254,7 @@ namespace UICatalog.Scenarios { Add (_statusBar); }; - _btnRemoveStatusBar.Clicked += () => { + _btnRemoveStatusBar.Clicked += (s,e) => { if (_statusBar == null) { return; } @@ -457,7 +457,7 @@ namespace UICatalog.Scenarios { X = Pos.X (_lblShortcut), Y = Pos.Bottom (_txtShortcut) + 1 }; - _btnShortcut.Clicked += () => { + _btnShortcut.Clicked += (s,e) => { _txtShortcut.Text = ""; }; Add (_btnShortcut); @@ -479,7 +479,7 @@ namespace UICatalog.Scenarios { var _btnOk = new Button ("Ok") { IsDefault = true, }; - _btnOk.Clicked += () => { + _btnOk.Clicked += (s,e) => { if (ustring.IsNullOrEmpty (_txtTitle.Text)) { MessageBox.ErrorQuery ("Invalid title", "Must enter a valid title!.", "Ok"); } else { @@ -492,7 +492,7 @@ namespace UICatalog.Scenarios { } }; var _btnCancel = new Button ("Cancel"); - _btnCancel.Clicked += () => { + _btnCancel.Clicked += (s,e) => { _txtTitle.Text = ustring.Empty; Application.RequestStop (); }; diff --git a/UICatalog/Scenarios/Editor.cs b/UICatalog/Scenarios/Editor.cs index 3cf2376e7..a39b420cc 100644 --- a/UICatalog/Scenarios/Editor.cs +++ b/UICatalog/Scenarios/Editor.cs @@ -799,7 +799,7 @@ namespace UICatalog.Scenarios { IsDefault = true, AutoSize = false }; - btnFindNext.Clicked += () => FindNext (); + btnFindNext.Clicked += (s,e) => FindNext (); d.Add (btnFindNext); var btnFindPrevious = new Button ("Find _Previous") { @@ -810,7 +810,7 @@ namespace UICatalog.Scenarios { TextAlignment = TextAlignment.Centered, AutoSize = false }; - btnFindPrevious.Clicked += () => FindPrevious (); + btnFindPrevious.Clicked += (s,e) => FindPrevious (); d.Add (btnFindPrevious); txtToFind.TextChanged += (e) => { @@ -827,7 +827,7 @@ namespace UICatalog.Scenarios { TextAlignment = TextAlignment.Centered, AutoSize = false }; - btnCancel.Clicked += () => { + btnCancel.Clicked += (s,e) => { DisposeWinDialog (); }; d.Add (btnCancel); @@ -891,7 +891,7 @@ namespace UICatalog.Scenarios { IsDefault = true, AutoSize = false }; - btnFindNext.Clicked += () => ReplaceNext (); + btnFindNext.Clicked += (s,e) => ReplaceNext (); d.Add (btnFindNext); label = new Label ("Replace:") { @@ -919,7 +919,7 @@ namespace UICatalog.Scenarios { TextAlignment = TextAlignment.Centered, AutoSize = false }; - btnFindPrevious.Clicked += () => ReplacePrevious (); + btnFindPrevious.Clicked += (s,e) => ReplacePrevious (); d.Add (btnFindPrevious); var btnReplaceAll = new Button ("Replace _All") { @@ -930,7 +930,7 @@ namespace UICatalog.Scenarios { TextAlignment = TextAlignment.Centered, AutoSize = false }; - btnReplaceAll.Clicked += () => ReplaceAll (); + btnReplaceAll.Clicked += (s,e) => ReplaceAll (); d.Add (btnReplaceAll); txtToFind.TextChanged += (e) => { @@ -948,7 +948,7 @@ namespace UICatalog.Scenarios { TextAlignment = TextAlignment.Centered, AutoSize = false }; - btnCancel.Clicked += () => { + btnCancel.Clicked += (s,e) => { DisposeWinDialog (); }; d.Add (btnCancel); diff --git a/UICatalog/Scenarios/Generic.cs b/UICatalog/Scenarios/Generic.cs index 076ed7d92..9b787c468 100644 --- a/UICatalog/Scenarios/Generic.cs +++ b/UICatalog/Scenarios/Generic.cs @@ -32,7 +32,7 @@ namespace UICatalog.Scenarios { X = Pos.Center (), Y = Pos.Center (), }; - button.Clicked += () => MessageBox.Query (20, 7, "Hi", "Neat?", "Yes", "No"); + button.Clicked += (s,e) => MessageBox.Query (20, 7, "Hi", "Neat?", "Yes", "No"); Win.Add (button); } } diff --git a/UICatalog/Scenarios/InteractiveTree.cs b/UICatalog/Scenarios/InteractiveTree.cs index a8da38ca2..6cfd71fd1 100644 --- a/UICatalog/Scenarios/InteractiveTree.cs +++ b/UICatalog/Scenarios/InteractiveTree.cs @@ -116,9 +116,9 @@ namespace UICatalog.Scenarios { bool okPressed = false; var ok = new Button ("Ok", is_default: true); - ok.Clicked += () => { okPressed = true; Application.RequestStop (); }; + ok.Clicked += (s,e) => { okPressed = true; Application.RequestStop (); }; var cancel = new Button ("Cancel"); - cancel.Clicked += () => { Application.RequestStop (); }; + cancel.Clicked += (s,e) => { Application.RequestStop (); }; var d = new Dialog (title, 60, 20, ok, cancel); var lbl = new Label () { diff --git a/UICatalog/Scenarios/InvertColors.cs b/UICatalog/Scenarios/InvertColors.cs index b342b935e..66499789d 100644 --- a/UICatalog/Scenarios/InvertColors.cs +++ b/UICatalog/Scenarios/InvertColors.cs @@ -33,7 +33,7 @@ namespace UICatalog.Scenarios { X = Pos.Center (), Y = foreColors.Length + 1, }; - button.Clicked += () => { + button.Clicked += (s,e) => { foreach (var label in labels) { var color = label.ColorScheme.Normal; diff --git a/UICatalog/Scenarios/LabelsAsButtons.cs b/UICatalog/Scenarios/LabelsAsButtons.cs index 739a01f4c..0c58c82a3 100644 --- a/UICatalog/Scenarios/LabelsAsButtons.cs +++ b/UICatalog/Scenarios/LabelsAsButtons.cs @@ -32,14 +32,14 @@ namespace UICatalog.Scenarios { HotKeySpecifier = (System.Rune)'_', CanFocus = true, }; - defaultLabel.Clicked += () => Application.RequestStop (); + defaultLabel.Clicked += (s,e) => Application.RequestStop (); Win.Add (defaultLabel); var swapLabel = new Label (50, 0, "S_wap Default (Absolute Layout)") { HotKeySpecifier = (System.Rune)'_', CanFocus = true, }; - swapLabel.Clicked += () => { + swapLabel.Clicked += (s,e) => { //defaultLabel.IsDefault = !defaultLabel.IsDefault; //swapLabel.IsDefault = !swapLabel.IsDefault; }; @@ -47,7 +47,7 @@ namespace UICatalog.Scenarios { static void DoMessage (Label Label, ustring txt) { - Label.Clicked += () => { + Label.Clicked += (s,e) => { var btnText = Label.Text.ToString (); MessageBox.Query ("Message", $"Did you click {txt}?", "Yes", "No"); }; @@ -93,7 +93,7 @@ namespace UICatalog.Scenarios { TextAlignment = TextAlignment.Centered, VerticalTextAlignment = VerticalTextAlignment.Middle }); - Label.Clicked += () => MessageBox.Query ("Message", "Question?", "Yes", "No"); + Label.Clicked += (s,e) => MessageBox.Query ("Message", "Question?", "Yes", "No"); var textChanger = new Label ("Te_xt Changer") { X = 2, @@ -102,7 +102,7 @@ namespace UICatalog.Scenarios { CanFocus = true, }; Win.Add (textChanger); - textChanger.Clicked += () => textChanger.Text += "!"; + textChanger.Clicked += (s,e) => textChanger.Text += "!"; Win.Add (Label = new Label ("Lets see if this will move as \"Text Changer\" grows") { X = Pos.Right (textChanger) + 2, @@ -120,7 +120,7 @@ namespace UICatalog.Scenarios { }; Win.Add (removeLabel); // This in interesting test case because `moveBtn` and below are laid out relative to this one! - removeLabel.Clicked += () => { + removeLabel.Clicked += (s,e) => { // Now this throw a InvalidOperationException on the TopologicalSort method as is expected. //Win.Remove (removeLabel); @@ -145,7 +145,7 @@ namespace UICatalog.Scenarios { HotKeySpecifier = (System.Rune)'_', CanFocus = true, }; - moveBtn.Clicked += () => { + moveBtn.Clicked += (s,e) => { moveBtn.X = moveBtn.Frame.X + 5; // This is already fixed with the call to SetNeedDisplay() in the Pos Dim. //computedFrame.LayoutSubviews (); // BUGBUG: This call should not be needed. View.X is not causing relayout correctly @@ -163,7 +163,7 @@ namespace UICatalog.Scenarios { CanFocus = true, AutoSize = false }; - sizeBtn.Clicked += () => { + sizeBtn.Clicked += (s,e) => { sizeBtn.Width = sizeBtn.Frame.Width + 5; //computedFrame.LayoutSubviews (); // FIXED: This call should not be needed. View.X is not causing relayout correctly }; @@ -183,7 +183,7 @@ namespace UICatalog.Scenarios { HotKeySpecifier = (System.Rune)'_', CanFocus = true, }; - moveBtnA.Clicked += () => { + moveBtnA.Clicked += (s,e) => { moveBtnA.Frame = new Rect (moveBtnA.Frame.X + 5, moveBtnA.Frame.Y, moveBtnA.Frame.Width, moveBtnA.Frame.Height); }; absoluteFrame.Add (moveBtnA); @@ -195,7 +195,7 @@ namespace UICatalog.Scenarios { CanFocus = true, AutoSize = false }; - sizeBtnA.Clicked += () => { + sizeBtnA.Clicked += (s,e) => { sizeBtnA.Frame = new Rect (sizeBtnA.Frame.X, sizeBtnA.Frame.Y, sizeBtnA.Frame.Width + 5, sizeBtnA.Frame.Height); }; absoluteFrame.Add (sizeBtnA); @@ -250,7 +250,7 @@ namespace UICatalog.Scenarios { HotKeySpecifier = (System.Rune)'_', CanFocus = true, }; - moveHotKeyBtn.Clicked += () => { + moveHotKeyBtn.Clicked += (s,e) => { moveHotKeyBtn.Text = MoveHotkey (moveHotKeyBtn.Text); }; Win.Add (moveHotKeyBtn); @@ -264,7 +264,7 @@ namespace UICatalog.Scenarios { HotKeySpecifier = (System.Rune)'_', CanFocus = true, }; - moveUnicodeHotKeyBtn.Clicked += () => { + moveUnicodeHotKeyBtn.Clicked += (s,e) => { moveUnicodeHotKeyBtn.Text = MoveHotkey (moveUnicodeHotKeyBtn.Text); }; Win.Add (moveUnicodeHotKeyBtn); diff --git a/UICatalog/Scenarios/ListViewWithSelection.cs b/UICatalog/Scenarios/ListViewWithSelection.cs index 2ccbcd51c..c1d333290 100644 --- a/UICatalog/Scenarios/ListViewWithSelection.cs +++ b/UICatalog/Scenarios/ListViewWithSelection.cs @@ -97,7 +97,7 @@ namespace UICatalog.Scenarios { Win.Add (keepCheckBox); } - private void ListView_RowRender (ListViewRowEventArgs obj) + private void ListView_RowRender (object sender, ListViewRowEventArgs obj) { if (obj.Row == _listView.SelectedItem) { return; diff --git a/UICatalog/Scenarios/ListsAndCombos.cs b/UICatalog/Scenarios/ListsAndCombos.cs index cd4ae69c8..bd1881955 100644 --- a/UICatalog/Scenarios/ListsAndCombos.cs +++ b/UICatalog/Scenarios/ListsAndCombos.cs @@ -36,7 +36,7 @@ namespace UICatalog.Scenarios { Height = Dim.Fill(2), Width = Dim.Percent (40) }; - listview.SelectedItemChanged += (ListViewItemEventArgs e) => lbListView.Text = items [listview.SelectedItem]; + listview.SelectedItemChanged += (object s, ListViewItemEventArgs e) => lbListView.Text = items [listview.SelectedItem]; Win.Add (lbListView, listview); var _scrollBar = new ScrollBarView (listview, true); @@ -80,7 +80,7 @@ namespace UICatalog.Scenarios { }; comboBox.SetSource (items); - comboBox.SelectedItemChanged += (ListViewItemEventArgs text) => lbComboBox.Text = text.Value.ToString (); + comboBox.SelectedItemChanged += (object s, ListViewItemEventArgs text) => lbComboBox.Text = text.Value.ToString (); Win.Add (lbComboBox, comboBox); var scrollBarCbx = new ScrollBarView (comboBox.Subviews [1], true); @@ -114,7 +114,7 @@ namespace UICatalog.Scenarios { X = 1, Y = Pos.Bottom(lbListView), }; - btnMoveUp.Clicked += () => { + btnMoveUp.Clicked += (s,e) => { listview.MoveUp (); }; @@ -122,7 +122,7 @@ namespace UICatalog.Scenarios { X = Pos.Right (btnMoveUp) + 1, Y = Pos.Bottom (lbListView), }; - btnMoveDown.Clicked += () => { + btnMoveDown.Clicked += (s,e) => { listview.MoveDown (); }; diff --git a/UICatalog/Scenarios/MessageBoxes.cs b/UICatalog/Scenarios/MessageBoxes.cs index f1b3fad11..5e523171b 100644 --- a/UICatalog/Scenarios/MessageBoxes.cs +++ b/UICatalog/Scenarios/MessageBoxes.cs @@ -183,7 +183,7 @@ namespace UICatalog.Scenarios { Y = Pos.Bottom (frame) + 2, IsDefault = true, }; - showMessageBoxButton.Clicked += () => { + showMessageBoxButton.Clicked += (s,e) => { try { int width = int.Parse (widthEdit.Text.ToString ()); int height = int.Parse (heightEdit.Text.ToString ()); diff --git a/UICatalog/Scenarios/MultiColouredTable.cs b/UICatalog/Scenarios/MultiColouredTable.cs index d1d9b4059..6bce14ff6 100644 --- a/UICatalog/Scenarios/MultiColouredTable.cs +++ b/UICatalog/Scenarios/MultiColouredTable.cs @@ -72,9 +72,9 @@ namespace UICatalog.Scenarios { bool okPressed = false; var ok = new Button ("Ok", is_default: true); - ok.Clicked += () => { okPressed = true; Application.RequestStop (); }; + ok.Clicked += (s,e) => { okPressed = true; Application.RequestStop (); }; var cancel = new Button ("Cancel"); - cancel.Clicked += () => { Application.RequestStop (); }; + cancel.Clicked += (s,e) => { Application.RequestStop (); }; var d = new Dialog (title, 60, 20, ok, cancel); var lbl = new Label () { diff --git a/UICatalog/Scenarios/Progress.cs b/UICatalog/Scenarios/Progress.cs index b5c4d9000..a6869607d 100644 --- a/UICatalog/Scenarios/Progress.cs +++ b/UICatalog/Scenarios/Progress.cs @@ -58,17 +58,17 @@ namespace UICatalog.Scenarios { X = Pos.Right (LeftFrame) + 1, Y = 0, }; - startButton.Clicked += () => Start (); + startButton.Clicked += (s,e) => Start (); var pulseButton = new Button ("Pulse") { X = Pos.Right (startButton) + 2, Y = Pos.Y (startButton), }; - pulseButton.Clicked += () => Pulse (); + pulseButton.Clicked += (s,e) => Pulse (); var stopbutton = new Button ("Stop Timer") { X = Pos.Right (pulseButton) + 2, Y = Pos.Top (pulseButton), }; - stopbutton.Clicked += () => Stop (); + stopbutton.Clicked += (s,e) => Stop (); Add (startButton); Add (pulseButton); @@ -225,7 +225,7 @@ namespace UICatalog.Scenarios { X = Pos.Center (), Y = Pos.Bottom(mainLoopTimeoutDemo) + 1, }; - startBoth.Clicked += () => { + startBoth.Clicked += (s,e) => { systemTimerDemo.Start (); mainLoopTimeoutDemo.Start (); }; diff --git a/UICatalog/Scenarios/ProgressBarStyles.cs b/UICatalog/Scenarios/ProgressBarStyles.cs index 72b2d4a27..bad40aae7 100644 --- a/UICatalog/Scenarios/ProgressBarStyles.cs +++ b/UICatalog/Scenarios/ProgressBarStyles.cs @@ -64,7 +64,7 @@ namespace UICatalog.Scenarios { X = Pos.Center (), Y = Pos.Bottom (continuousPB) + 1 }; - button.Clicked += () => { + button.Clicked += (s,e) => { if (_fractionTimer == null) { button.Enabled = false; blocksPB.Fraction = 0; diff --git a/UICatalog/Scenarios/RunTExample.cs b/UICatalog/Scenarios/RunTExample.cs index 98d421d7e..8a7c9c3ba 100644 --- a/UICatalog/Scenarios/RunTExample.cs +++ b/UICatalog/Scenarios/RunTExample.cs @@ -58,7 +58,7 @@ namespace UICatalog.Scenarios { }; // When login button is clicked display a message popup - btnLogin.Clicked += () => { + btnLogin.Clicked += (s,e) => { if (usernameText.Text == "admin" && passwordText.Text == "password") { MessageBox.Query ("Login Successful", $"Username: {usernameText.Text}", "Ok"); Application.RequestStop (); diff --git a/UICatalog/Scenarios/RuneWidthGreaterThanOne.cs b/UICatalog/Scenarios/RuneWidthGreaterThanOne.cs index 4e4105778..5c6ed9859 100644 --- a/UICatalog/Scenarios/RuneWidthGreaterThanOne.cs +++ b/UICatalog/Scenarios/RuneWidthGreaterThanOne.cs @@ -91,17 +91,17 @@ namespace UICatalog.Scenarios { } } - private void MixedMessage () + private void MixedMessage (object sender, EventArgs e) { MessageBox.Query ("Say Hello 你", $"Hello {_text.Text}", "Ok"); } - private void NarrowMessage () + private void NarrowMessage (object sender, EventArgs e) { MessageBox.Query ("Say Hello", $"Hello {_text.Text}", "Ok"); } - private void WideMessage () + private void WideMessage (object sender, EventArgs e) { MessageBox.Query ("こんにちはと言う", $"こんにちは {_text.Text}", "Ok"); } diff --git a/UICatalog/Scenarios/Scrolling.cs b/UICatalog/Scenarios/Scrolling.cs index 11535de46..a6ca4ff19 100644 --- a/UICatalog/Scenarios/Scrolling.cs +++ b/UICatalog/Scenarios/Scrolling.cs @@ -164,7 +164,7 @@ namespace UICatalog.Scenarios { X = 3, Y = 3, }; - pressMeButton.Clicked += () => MessageBox.Query (20, 7, "MessageBox", "Neat?", "Yes", "No"); + pressMeButton.Clicked += (s,e) => MessageBox.Query (20, 7, "MessageBox", "Neat?", "Yes", "No"); scrollView.Add (pressMeButton); var aLongButton = new Button ("A very long button. Should be wide enough to demo clipping!") { @@ -172,7 +172,7 @@ namespace UICatalog.Scenarios { Y = 4, Width = Dim.Fill (3), }; - aLongButton.Clicked += () => MessageBox.Query (20, 7, "MessageBox", "Neat?", "Yes", "No"); + aLongButton.Clicked += (s,e) => MessageBox.Query (20, 7, "MessageBox", "Neat?", "Yes", "No"); scrollView.Add (aLongButton); scrollView.Add (new TextField ("This is a test of...") { @@ -202,7 +202,7 @@ namespace UICatalog.Scenarios { }; // TODO: Use Pos.Width instead of (Right-Left) when implemented (#502) anchorButton.X = Pos.AnchorEnd () - (Pos.Right (anchorButton) - Pos.Left (anchorButton)); - anchorButton.Clicked += () => { + anchorButton.Clicked += (s,e) => { // Ths demonstrates how to have a dynamically sized button // Each time the button is clicked the button's text gets longer // The call to Win.LayoutSubviews causes the Computed layout to diff --git a/UICatalog/Scenarios/SendKeys.cs b/UICatalog/Scenarios/SendKeys.cs index 0359c7d17..2cd4163e5 100644 --- a/UICatalog/Scenarios/SendKeys.cs +++ b/UICatalog/Scenarios/SendKeys.cs @@ -114,7 +114,7 @@ namespace UICatalog.Scenarios { txtInput.SetFocus (); } - button.Clicked += () => ProcessInput (); + button.Clicked += (s,e) => ProcessInput (); Win.KeyPress += (s, e) => { if (e.KeyEvent.Key == Key.Enter) { diff --git a/UICatalog/Scenarios/SingleBackgroundWorker.cs b/UICatalog/Scenarios/SingleBackgroundWorker.cs index 352f608b4..fd27f2684 100644 --- a/UICatalog/Scenarios/SingleBackgroundWorker.cs +++ b/UICatalog/Scenarios/SingleBackgroundWorker.cs @@ -63,7 +63,7 @@ namespace UICatalog.Scenarios { worker = new BackgroundWorker () { WorkerSupportsCancellation = true }; var cancel = new Button ("Cancel Worker"); - cancel.Clicked += () => { + cancel.Clicked += (s,e) => { if (worker == null) { log.Add ($"Worker is not running at {DateTime.Now}!"); listLog.SetNeedsDisplay (); diff --git a/UICatalog/Scenarios/TableEditor.cs b/UICatalog/Scenarios/TableEditor.cs index b9b1e168b..a11fddd25 100644 --- a/UICatalog/Scenarios/TableEditor.cs +++ b/UICatalog/Scenarios/TableEditor.cs @@ -278,9 +278,9 @@ namespace UICatalog.Scenarios { { var accepted = false; var ok = new Button ("Ok", is_default: true); - ok.Clicked += () => { accepted = true; Application.RequestStop (); }; + ok.Clicked += (s,e) => { accepted = true; Application.RequestStop (); }; var cancel = new Button ("Cancel"); - cancel.Clicked += () => { Application.RequestStop (); }; + cancel.Clicked += (s,e) => { Application.RequestStop (); }; var d = new Dialog (prompt, 60, 20, ok, cancel); var style = tableView.Style.GetOrCreateColumnStyle (col); @@ -760,9 +760,9 @@ namespace UICatalog.Scenarios { bool okPressed = false; var ok = new Button ("Ok", is_default: true); - ok.Clicked += () => { okPressed = true; Application.RequestStop (); }; + ok.Clicked += (s,e) => { okPressed = true; Application.RequestStop (); }; var cancel = new Button ("Cancel"); - cancel.Clicked += () => { Application.RequestStop (); }; + cancel.Clicked += (s,e) => { Application.RequestStop (); }; var d = new Dialog (title, 60, 20, ok, cancel); var lbl = new Label () { diff --git a/UICatalog/Scenarios/TextAlignments.cs b/UICatalog/Scenarios/TextAlignments.cs index b9b36ca35..defc68eb4 100644 --- a/UICatalog/Scenarios/TextAlignments.cs +++ b/UICatalog/Scenarios/TextAlignments.cs @@ -52,7 +52,7 @@ namespace UICatalog.Scenarios { X = Pos.Right (edit) + 1, Y = 0, }; - unicodeSample.Clicked += () => { + unicodeSample.Clicked += (s,e) => { edit.Text = unicodeSampleText; }; Win.Add (unicodeSample); @@ -62,7 +62,7 @@ namespace UICatalog.Scenarios { Y = Pos.Bottom (edit) - 1, }; - update.Clicked += () => { + update.Clicked += (s,e) => { foreach (var alignment in alignments) { singleLines [(int)alignment].Text = edit.Text; multipleLines [(int)alignment].Text = edit.Text; diff --git a/UICatalog/Scenarios/Threading.cs b/UICatalog/Scenarios/Threading.cs index 19df3ab95..40f44cb29 100644 --- a/UICatalog/Scenarios/Threading.cs +++ b/UICatalog/Scenarios/Threading.cs @@ -46,7 +46,7 @@ namespace UICatalog.Scenarios { _btnActionCancel = new Button (1, 1, "Cancelable Load Items"); - _btnActionCancel.Clicked += () => Application.MainLoop.Invoke (CallLoadItemsAsync); + _btnActionCancel.Clicked += (s,e) => Application.MainLoop.Invoke (CallLoadItemsAsync); Win.Add (new Label ("Data Items:") { X = Pos.X (_btnActionCancel), @@ -77,19 +77,19 @@ namespace UICatalog.Scenarios { var text = new TextField (1, 3, 100, "Type anything after press the button"); var _btnAction = new Button (80, 10, "Load Data Action"); - _btnAction.Clicked += () => _action.Invoke (); + _btnAction.Clicked += (s,e) => _action.Invoke (); var _btnLambda = new Button (80, 12, "Load Data Lambda"); - _btnLambda.Clicked += () => _lambda.Invoke (); + _btnLambda.Clicked += (s,e) => _lambda.Invoke (); var _btnHandler = new Button (80, 14, "Load Data Handler"); - _btnHandler.Clicked += () => _handler.Invoke (null, new EventArgs ()); + _btnHandler.Clicked += (s,e) => _handler.Invoke (null, new EventArgs ()); var _btnSync = new Button (80, 16, "Load Data Synchronous"); - _btnSync.Clicked += () => _sync.Invoke (); + _btnSync.Clicked += (s,e) => _sync.Invoke (); var _btnMethod = new Button (80, 18, "Load Data Method"); - _btnMethod.Clicked += async () => await MethodAsync (); + _btnMethod.Clicked += async (s,e) => await MethodAsync (); var _btnClearData = new Button (80, 20, "Clear Data"); - _btnClearData.Clicked += () => { _itemsList.Source = null; LogJob ("Cleaning Data"); }; + _btnClearData.Clicked += (s,e) => { _itemsList.Source = null; LogJob ("Cleaning Data"); }; var _btnQuit = new Button (80, 22, "Quit"); - _btnQuit.Clicked += () => Application.RequestStop (); + _btnQuit.Clicked += (s,e) => Application.RequestStop (); Win.Add (_itemsList, _btnActionCancel, _logJob, text, _btnAction, _btnLambda, _btnHandler, _btnSync, _btnMethod, _btnClearData, _btnQuit); diff --git a/UICatalog/Scenarios/TimeAndDate.cs b/UICatalog/Scenarios/TimeAndDate.cs index dc88faa89..7885c3dd2 100644 --- a/UICatalog/Scenarios/TimeAndDate.cs +++ b/UICatalog/Scenarios/TimeAndDate.cs @@ -102,7 +102,7 @@ namespace UICatalog.Scenarios { X = Pos.Center (), Y = Pos.Bottom (Win) - 5, }; - swapButton.Clicked += () => { + swapButton.Clicked += (s,e) => { longTime.ReadOnly = !longTime.ReadOnly; shortTime.ReadOnly = !shortTime.ReadOnly; diff --git a/UICatalog/Scenarios/VkeyPacketSimulator.cs b/UICatalog/Scenarios/VkeyPacketSimulator.cs index d9a8f3ffa..c76050910 100644 --- a/UICatalog/Scenarios/VkeyPacketSimulator.cs +++ b/UICatalog/Scenarios/VkeyPacketSimulator.cs @@ -207,13 +207,13 @@ namespace UICatalog.Scenarios { } }; - btnInput.Clicked += () => { + btnInput.Clicked += (s,e) => { if (!tvInput.HasFocus && _keyboardStrokes.Count == 0) { tvInput.SetFocus (); } }; - btnOutput.Clicked += () => { + btnOutput.Clicked += (s,e) => { if (!tvOutput.HasFocus && _keyboardStrokes.Count == 0) { tvOutput.SetFocus (); } diff --git a/UICatalog/Scenarios/WindowsAndFrameViews.cs b/UICatalog/Scenarios/WindowsAndFrameViews.cs index 417dbe810..54ca84b9e 100644 --- a/UICatalog/Scenarios/WindowsAndFrameViews.cs +++ b/UICatalog/Scenarios/WindowsAndFrameViews.cs @@ -38,7 +38,7 @@ namespace UICatalog.Scenarios { Y = 0, ColorScheme = Colors.Error, }; - paddingButton.Clicked += () => About (); + paddingButton.Clicked += (s,e) => About (); Win.Add (paddingButton); Win.Add (new Button ("Press ME! (Y = Pos.AnchorEnd(1))") { X = Pos.Center (), @@ -71,7 +71,7 @@ namespace UICatalog.Scenarios { Y = 0, ColorScheme = Colors.Error, }; - pressMeButton.Clicked += () => + pressMeButton.Clicked += (s,e) => MessageBox.ErrorQuery (win.Title.ToString (), "Neat?", "Yes", "No"); win.Add (pressMeButton); var subWin = new Window ("Sub Window") { diff --git a/UICatalog/Scenarios/WizardAsView.cs b/UICatalog/Scenarios/WizardAsView.cs index e7be17552..e4ed7f4e5 100644 --- a/UICatalog/Scenarios/WizardAsView.cs +++ b/UICatalog/Scenarios/WizardAsView.cs @@ -76,7 +76,7 @@ namespace UICatalog.Scenarios { X = Pos.Right (buttonLbl), Y = Pos.Top (buttonLbl) }; - button.Clicked += () => { + button.Clicked += (s,e) => { secondStep.Title = "2nd Step"; MessageBox.Query ("Wizard Scenario", "This Wizard Step's title was changed to '2nd Step'", "Ok"); }; diff --git a/UICatalog/Scenarios/Wizards.cs b/UICatalog/Scenarios/Wizards.cs index 7078dd321..b358aada0 100644 --- a/UICatalog/Scenarios/Wizards.cs +++ b/UICatalog/Scenarios/Wizards.cs @@ -97,7 +97,7 @@ namespace UICatalog.Scenarios { IsDefault = true, }; - showWizardButton.Clicked += () => { + showWizardButton.Clicked += (s,e) => { try { int width = 0; int.TryParse (widthEdit.Text.ToString (), out width); @@ -153,7 +153,7 @@ namespace UICatalog.Scenarios { X = Pos.Right (buttonLbl), Y = Pos.Top (buttonLbl) }; - button.Clicked += () => { + button.Clicked += (s,e) => { secondStep.Title = "2nd Step"; MessageBox.Query ("Wizard Scenario", "This Wizard Step's title was changed to '2nd Step'"); }; @@ -226,7 +226,7 @@ namespace UICatalog.Scenarios { X = Pos.Center (), Y = Pos.AnchorEnd (1) }; - hideHelpBtn.Clicked += () => { + hideHelpBtn.Clicked += (s,e) => { if (fourthStep.HelpText.Length > 0) { fourthStep.HelpText = ustring.Empty; } else { diff --git a/UICatalog/UICatalog.cs b/UICatalog/UICatalog.cs index b4977eab6..e8e243af5 100644 --- a/UICatalog/UICatalog.cs +++ b/UICatalog/UICatalog.cs @@ -312,7 +312,7 @@ namespace UICatalog { AllowsMarking = false, CanFocus = true, }; - CategoryListView.OpenSelectedItem += (a) => { + CategoryListView.OpenSelectedItem += (s,a) => { ScenarioListView.SetFocus (); }; CategoryListView.SelectedItemChanged += CategoryListView_SelectedChanged; @@ -396,7 +396,7 @@ namespace UICatalog { /// Launches the selected scenario, setting the global _selectedScenario /// /// - void ScenarioListView_OpenSelectedItem (EventArgs e) + void ScenarioListView_OpenSelectedItem (object sender, EventArgs e) { if (_selectedScenario is null) { // Save selected item state @@ -678,7 +678,7 @@ namespace UICatalog { } } - void CategoryListView_SelectedChanged (ListViewItemEventArgs e) + void CategoryListView_SelectedChanged (object sender, ListViewItemEventArgs e) { var item = _categories [e.Item]; List newlist; diff --git a/UnitTests/Application/MainLoopTests.cs b/UnitTests/Application/MainLoopTests.cs index b88ffbb41..6498d4745 100644 --- a/UnitTests/Application/MainLoopTests.cs +++ b/UnitTests/Application/MainLoopTests.cs @@ -636,7 +636,7 @@ namespace Terminal.Gui.ApplicationTests { var btnLaunch = new Button ("Open Window"); - btnLaunch.Clicked += () => action (); + btnLaunch.Clicked += (s,e) => action (); Application.Top.Add (btnLaunch); @@ -700,7 +700,7 @@ namespace Terminal.Gui.ApplicationTests { Text = "total" }; - totalbtn.Clicked += () => { + totalbtn.Clicked += (s,e) => { MessageBox.Query ("Count", $"Count is {total}", "Ok"); }; @@ -715,7 +715,7 @@ namespace Terminal.Gui.ApplicationTests { Application.RequestStop (); } - private static async void RunAsyncTest () + private static async void RunAsyncTest (object sender, EventArgs e) { Assert.Equal (clickMe, btn.Text); Assert.Equal (zero, total); diff --git a/UnitTests/Core/ViewTests.cs b/UnitTests/Core/ViewTests.cs index 89afa229f..bd45d853c 100644 --- a/UnitTests/Core/ViewTests.cs +++ b/UnitTests/Core/ViewTests.cs @@ -1252,7 +1252,7 @@ namespace Terminal.Gui.CoreTests { { var wasClicked = false; var view = new Button ("Click Me"); - view.Clicked += () => wasClicked = !wasClicked; + view.Clicked += (s,e) => wasClicked = !wasClicked; Application.Top.Add (view); view.ProcessKey (new KeyEvent (Key.Enter, null)); @@ -1281,7 +1281,7 @@ namespace Terminal.Gui.CoreTests { { var wasClicked = false; var button = new Button ("Click Me"); - button.Clicked += () => wasClicked = !wasClicked; + button.Clicked += (s,e) => wasClicked = !wasClicked; var win = new Window () { Width = Dim.Fill (), Height = Dim.Fill () }; win.Add (button); Application.Top.Add (win); diff --git a/UnitTests/Menus/ContextMenuTests.cs b/UnitTests/Menus/ContextMenuTests.cs index e08f84efb..9062e05aa 100644 --- a/UnitTests/Menus/ContextMenuTests.cs +++ b/UnitTests/Menus/ContextMenuTests.cs @@ -228,7 +228,7 @@ namespace Terminal.Gui.MenuTests { var oldKey = Key.Null; var cm = new ContextMenu (); - cm.KeyChanged += (e) => oldKey = e; + cm.KeyChanged += (s,e) => oldKey = e.OldKey; cm.Key = Key.Space | Key.CtrlMask; Assert.Equal (Key.Space | Key.CtrlMask, cm.Key); diff --git a/UnitTests/Menus/MenuTests.cs b/UnitTests/Menus/MenuTests.cs index 1f822c2cc..972e0e84b 100644 --- a/UnitTests/Menus/MenuTests.cs +++ b/UnitTests/Menus/MenuTests.cs @@ -109,7 +109,7 @@ namespace Terminal.Gui.MenuTests { new MenuItem ("_New", "Creates new file.", New) }) }); - menu.MenuOpening += (e) => { + menu.MenuOpening += (s,e) => { Assert.Equal ("_File", e.CurrentMenu.Title); Assert.Equal ("_New", e.CurrentMenu.Children [0].Title); Assert.Equal ("Creates new file.", e.CurrentMenu.Children [0].Help); @@ -378,7 +378,7 @@ Edit }), new MenuBarItem ("_About", "Top-Level", () => miAction ="About") }); - menu.MenuOpening += (e) => mbiCurrent = e.CurrentMenu; + menu.MenuOpening += (s,e) => mbiCurrent = e.CurrentMenu; menu.MenuOpened += (e) => { miCurrent = e; mCurrent = menu.openCurrentMenu; diff --git a/UnitTests/TopLevels/WindowTests.cs b/UnitTests/TopLevels/WindowTests.cs index 840105f1a..21efaca61 100644 --- a/UnitTests/TopLevels/WindowTests.cs +++ b/UnitTests/TopLevels/WindowTests.cs @@ -107,7 +107,7 @@ namespace Terminal.Gui.TopLevelTests { string expectedDuring = null; string expectedAfter = null; bool cancel = false; - r.TitleChanging += (args) => { + r.TitleChanging += (s, args) => { Assert.Equal (expectedOld, args.OldTitle); Assert.Equal (expectedDuring, args.NewTitle); args.Cancel = cancel; @@ -138,7 +138,7 @@ namespace Terminal.Gui.TopLevelTests { string expectedOld = null; string expected = null; - r.TitleChanged += (args) => { + r.TitleChanged += (s,args) => { Assert.Equal (expectedOld, args.OldTitle); Assert.Equal (r.Title, args.NewTitle); }; diff --git a/UnitTests/TopLevels/WizardTests.cs b/UnitTests/TopLevels/WizardTests.cs index b10d862e8..1502e2eb8 100644 --- a/UnitTests/TopLevels/WizardTests.cs +++ b/UnitTests/TopLevels/WizardTests.cs @@ -47,7 +47,7 @@ namespace Terminal.Gui.TopLevelTests { string expectedAfter = string.Empty; string expectedDuring = string.Empty; bool cancel = false; - r.TitleChanging += (args) => { + r.TitleChanging += (s,args) => { Assert.Equal (expectedDuring, args.NewTitle); args.Cancel = cancel; }; @@ -73,7 +73,7 @@ namespace Terminal.Gui.TopLevelTests { Assert.Equal (ustring.Empty, r.Title); string expected = string.Empty; - r.TitleChanged += (args) => { + r.TitleChanged += (s,args) => { Assert.Equal (r.Title, args.NewTitle); }; diff --git a/UnitTests/UICatalog/ScenarioTests.cs b/UnitTests/UICatalog/ScenarioTests.cs index 7a8c733d3..a1ea6e14e 100644 --- a/UnitTests/UICatalog/ScenarioTests.cs +++ b/UnitTests/UICatalog/ScenarioTests.cs @@ -295,10 +295,10 @@ namespace UICatalog.Tests { ColorScheme = Colors.Dialog, }; - _classListView.OpenSelectedItem += (a) => { + _classListView.OpenSelectedItem += (s, a) => { _settingsPane.SetFocus (); }; - _classListView.SelectedItemChanged += (args) => { + _classListView.SelectedItemChanged += (s, args) => { ClearClass (_curView); _curView = CreateClass (_viewClasses.Values.ToArray () [_classListView.SelectedItem]); }; diff --git a/UnitTests/Views/ButtonTests.cs b/UnitTests/Views/ButtonTests.cs index 9585b4bba..4017714a7 100644 --- a/UnitTests/Views/ButtonTests.cs +++ b/UnitTests/Views/ButtonTests.cs @@ -76,7 +76,7 @@ namespace Terminal.Gui.ViewTests { { var clicked = false; Button btn = new Button ("Test"); - btn.Clicked += () => clicked = true; + btn.Clicked += (s,e) => clicked = true; Application.Top.Add (btn); Application.Begin (Application.Top); @@ -119,7 +119,7 @@ namespace Terminal.Gui.ViewTests { { var clicked = false; Button btn = new Button ("Test"); - btn.Clicked += () => clicked = true; + btn.Clicked += (s,e) => clicked = true; Application.Top.Add (btn); Application.Begin (Application.Top); @@ -146,7 +146,7 @@ namespace Terminal.Gui.ViewTests { { int pressed = 0; var btn = new Button ("Press Me"); - btn.Clicked += () => pressed++; + btn.Clicked += (s,e) => pressed++; // The Button class supports the Accept command Assert.Contains (Command.Accept, btn.GetSupportedCommands ()); diff --git a/UnitTests/Views/ComboBoxTests.cs b/UnitTests/Views/ComboBoxTests.cs index 331461473..74c2a33a7 100644 --- a/UnitTests/Views/ComboBoxTests.cs +++ b/UnitTests/Views/ComboBoxTests.cs @@ -88,7 +88,7 @@ namespace Terminal.Gui.ViewTests { Assert.Equal (-1, cb.SelectedItem); Assert.Equal (string.Empty, cb.Text); var opened = false; - cb.OpenSelectedItem += (_) => opened = true; + cb.OpenSelectedItem += (s,_) => opened = true; Assert.True (cb.ProcessKey (new KeyEvent (Key.Enter, new KeyModifiers ()))); Assert.False (opened); cb.Text = "Tw"; @@ -274,7 +274,7 @@ Three Width = 5 }; cb.SetSource (new List { "One", "Two", "Three" }); - cb.OpenSelectedItem += (e) => selected = e.Value.ToString (); + cb.OpenSelectedItem += (s,e) => selected = e.Value.ToString (); Application.Top.Add (cb); Application.Begin (Application.Top); @@ -369,7 +369,7 @@ Three HideDropdownListOnClick = true }; cb.SetSource (new List { "One", "Two", "Three" }); - cb.OpenSelectedItem += (e) => selected = e.Value.ToString (); + cb.OpenSelectedItem += (s,e) => selected = e.Value.ToString (); Application.Top.Add (cb); Application.Begin (Application.Top); @@ -431,7 +431,7 @@ Three HideDropdownListOnClick = true }; cb.SetSource (new List { "One", "Two", "Three" }); - cb.OpenSelectedItem += (e) => selected = e.Value.ToString (); + cb.OpenSelectedItem += (s,e) => selected = e.Value.ToString (); Application.Top.Add (cb); Application.Begin (Application.Top); @@ -490,7 +490,7 @@ Three HideDropdownListOnClick = false }; cb.SetSource (new List { "One", "Two", "Three" }); - cb.OpenSelectedItem += (e) => selected = e.Value.ToString (); + cb.OpenSelectedItem += (s, e) => selected = e.Value.ToString (); Application.Top.Add (cb); Application.Begin (Application.Top); @@ -551,7 +551,7 @@ Three ReadOnly = true }; cb.SetSource (new List { "One", "Two", "Three" }); - cb.OpenSelectedItem += (e) => selected = e.Value.ToString (); + cb.OpenSelectedItem += (s,e) => selected = e.Value.ToString (); Application.Top.Add (cb); Application.Begin (Application.Top); @@ -611,7 +611,7 @@ Three HideDropdownListOnClick = true }; cb.SetSource (new List { "One", "Two", "Three" }); - cb.OpenSelectedItem += (e) => selected = e.Value.ToString (); + cb.OpenSelectedItem += (s,e) => selected = e.Value.ToString (); Application.Top.Add (cb); Application.Begin (Application.Top); @@ -648,7 +648,7 @@ Three HideDropdownListOnClick = false }; cb.SetSource (new List { "One", "Two", "Three" }); - cb.OpenSelectedItem += (e) => selected = e.Value.ToString (); + cb.OpenSelectedItem += (s,e) => selected = e.Value.ToString (); Application.Top.Add (cb); Application.Begin (Application.Top); @@ -685,7 +685,7 @@ Three HideDropdownListOnClick = true }; cb.SetSource (new List { "One", "Two", "Three" }); - cb.OpenSelectedItem += (e) => selected = e.Value.ToString (); + cb.OpenSelectedItem += (s,e) => selected = e.Value.ToString (); Application.Top.Add (cb); Application.Begin (Application.Top); @@ -790,7 +790,7 @@ Three HideDropdownListOnClick = true, }; cb.SetSource (new List { "One", "Two", "Three" }); - cb.OpenSelectedItem += (e) => selected = e.Value.ToString (); + cb.OpenSelectedItem += (s,e) => selected = e.Value.ToString (); Application.Top.Add (cb); Application.Begin (Application.Top); @@ -912,8 +912,8 @@ Three ", output); }; var list = new List { "One", "Two", "Three" }; - cb.Expanded += () => cb.SetSource (list); - cb.Collapsed += () => cb.Source = null; + cb.Expanded += (s,e) => cb.SetSource (list); + cb.Collapsed += (s,e) => cb.Source = null; Application.Top.Add (cb); Application.Begin (Application.Top); diff --git a/UnitTests/Views/ListViewTests.cs b/UnitTests/Views/ListViewTests.cs index 01e784810..82a648cc3 100644 --- a/UnitTests/Views/ListViewTests.cs +++ b/UnitTests/Views/ListViewTests.cs @@ -175,7 +175,7 @@ namespace Terminal.Gui.ViewTests { Assert.True (lv.ProcessKey (new KeyEvent (Key.Space, new KeyModifiers ()))); Assert.True (lv.Source.IsMarked (lv.SelectedItem)); var opened = false; - lv.OpenSelectedItem += (_) => opened = true; + lv.OpenSelectedItem += (s,_) => opened = true; Assert.True (lv.ProcessKey (new KeyEvent (Key.Enter, new KeyModifiers ()))); Assert.True (opened); Assert.True (lv.ProcessKey (new KeyEvent (Key.End, new KeyModifiers ()))); @@ -191,7 +191,7 @@ namespace Terminal.Gui.ViewTests { var rendered = false; var source = new List () { "one", "two", "three" }; var lv = new ListView () { Width = Dim.Fill (), Height = Dim.Fill () }; - lv.RowRender += _ => rendered = true; + lv.RowRender += (s,_) => rendered = true; Application.Top.Add (lv); Application.Begin (Application.Top); Assert.False (rendered); diff --git a/UnitTests/Views/ScrollBarViewTests.cs b/UnitTests/Views/ScrollBarViewTests.cs index d5526c1a6..e421b7971 100644 --- a/UnitTests/Views/ScrollBarViewTests.cs +++ b/UnitTests/Views/ScrollBarViewTests.cs @@ -909,7 +909,7 @@ This is a test var text = "This is a test\nThis is a test\nThis is a test\nThis is a test\nThis is a test"; var label = new Label (text) { Width = 14, Height = 5 }; var btn = new Button (14, 0, "Click Me!"); - btn.Clicked += () => clicked = true; + btn.Clicked += (s,e) => clicked = true; Application.Top.Add (label, btn); var sbv = new ScrollBarView (label, true, false) {