Преглед на файлове

Switch to EventHandler for TopLevel methods

- Loaded,
- Ready
- Unloaded
- AllChildClosed
tznind преди 2 години
родител
ревизия
58c267fd7c

+ 8 - 8
Terminal.Gui/Core/Toplevel.cs

@@ -48,7 +48,7 @@ namespace Terminal.Gui {
 		/// A Loaded event handler is a good place to finalize initialization before calling 
 		/// A Loaded event handler is a good place to finalize initialization before calling 
 		/// <see cref="Application.RunLoop(Application.RunState, bool)"/>.
 		/// <see cref="Application.RunLoop(Application.RunState, bool)"/>.
 		/// </summary>
 		/// </summary>
-		public event Action Loaded;
+		public event EventHandler Loaded;
 
 
 		/// <summary>
 		/// <summary>
 		/// Invoked when the Toplevel <see cref="MainLoop"/> has started it's first iteration.
 		/// Invoked when the Toplevel <see cref="MainLoop"/> has started it's first iteration.
@@ -57,13 +57,13 @@ namespace Terminal.Gui {
 		/// <para>A Ready event handler is a good place to finalize initialization after calling 
 		/// <para>A Ready event handler is a good place to finalize initialization after calling 
 		/// <see cref="Application.Run(Func{Exception, bool})"/> on this Toplevel.</para>
 		/// <see cref="Application.Run(Func{Exception, bool})"/> on this Toplevel.</para>
 		/// </summary>
 		/// </summary>
-		public event Action Ready;
+		public event EventHandler Ready;
 
 
 		/// <summary>
 		/// <summary>
 		/// Invoked when the Toplevel <see cref="Application.RunState"/> has been unloaded.
 		/// Invoked when the Toplevel <see cref="Application.RunState"/> has been unloaded.
 		/// A Unloaded event handler is a good place to dispose objects after calling <see cref="Application.End(Application.RunState)"/>.
 		/// A Unloaded event handler is a good place to dispose objects after calling <see cref="Application.End(Application.RunState)"/>.
 		/// </summary>
 		/// </summary>
-		public event Action Unloaded;
+		public event EventHandler Unloaded;
 
 
 		/// <summary>
 		/// <summary>
 		/// Invoked when the Toplevel <see cref="Application.RunState"/> becomes the <see cref="Application.Current"/> Toplevel.
 		/// Invoked when the Toplevel <see cref="Application.RunState"/> becomes the <see cref="Application.Current"/> Toplevel.
@@ -85,7 +85,7 @@ namespace Terminal.Gui {
 		/// Invoked when the last child of the Toplevel <see cref="Application.RunState"/> is closed from 
 		/// Invoked when the last child of the Toplevel <see cref="Application.RunState"/> is closed from 
 		/// by <see cref="Application.End(Application.RunState)"/>.
 		/// by <see cref="Application.End(Application.RunState)"/>.
 		/// </summary>
 		/// </summary>
-		public event Action AllChildClosed;
+		public event EventHandler AllChildClosed;
 
 
 		/// <summary>
 		/// <summary>
 		/// Invoked when the Toplevel's <see cref="Application.RunState"/> is being closed by  
 		/// Invoked when the Toplevel's <see cref="Application.RunState"/> is being closed by  
@@ -141,7 +141,7 @@ namespace Terminal.Gui {
 
 
 		internal virtual void OnAllChildClosed ()
 		internal virtual void OnAllChildClosed ()
 		{
 		{
-			AllChildClosed?.Invoke ();
+			AllChildClosed?.Invoke (this, EventArgs.Empty);
 		}
 		}
 
 
 		internal virtual void OnChildClosed (Toplevel top)
 		internal virtual void OnChildClosed (Toplevel top)
@@ -171,7 +171,7 @@ namespace Terminal.Gui {
 			foreach (Toplevel tl in Subviews.Where (v => v is Toplevel)) {
 			foreach (Toplevel tl in Subviews.Where (v => v is Toplevel)) {
 				tl.OnLoaded ();
 				tl.OnLoaded ();
 			}
 			}
-			Loaded?.Invoke ();
+			Loaded?.Invoke (this, EventArgs.Empty);
 		}
 		}
 
 
 		/// <summary>
 		/// <summary>
@@ -183,7 +183,7 @@ namespace Terminal.Gui {
 			foreach (Toplevel tl in Subviews.Where (v => v is Toplevel)) {
 			foreach (Toplevel tl in Subviews.Where (v => v is Toplevel)) {
 				tl.OnReady ();
 				tl.OnReady ();
 			}
 			}
-			Ready?.Invoke ();
+			Ready?.Invoke (this, EventArgs.Empty);
 		}
 		}
 
 
 		/// <summary>
 		/// <summary>
@@ -194,7 +194,7 @@ namespace Terminal.Gui {
 			foreach (Toplevel tl in Subviews.Where (v => v is Toplevel)) {
 			foreach (Toplevel tl in Subviews.Where (v => v is Toplevel)) {
 				tl.OnUnloaded ();
 				tl.OnUnloaded ();
 			}
 			}
-			Unloaded?.Invoke ();
+			Unloaded?.Invoke (this, EventArgs.Empty);
 		}
 		}
 
 
 		/// <summary>
 		/// <summary>

+ 1 - 1
Terminal.Gui/Windows/Wizard.cs

@@ -385,7 +385,7 @@ namespace Terminal.Gui {
 
 
 		}
 		}
 
 
-		private void Wizard_Loaded ()
+		private void Wizard_Loaded (object sender, EventArgs args)
 		{
 		{
 			CurrentStep = GetFirstStep (); // gets the first step if CurrentStep == null
 			CurrentStep = GetFirstStep (); // gets the first step if CurrentStep == null
 		}
 		}

+ 1 - 1
UICatalog/Scenarios/Buttons.cs

@@ -272,7 +272,7 @@ namespace UICatalog.Scenarios {
 				}
 				}
 			};
 			};
 
 
-			Application.Top.Ready += () => radioGroup.Refresh ();
+			Application.Top.Ready += (s,e) => radioGroup.Refresh ();
 		}
 		}
 	}
 	}
 }
 }

+ 1 - 1
UICatalog/Scenarios/Dialogs.cs

@@ -112,7 +112,7 @@ namespace UICatalog.Scenarios {
 			};
 			};
 			frame.Add (styleRadioGroup);
 			frame.Add (styleRadioGroup);
 
 
-			void Top_Loaded ()
+			void Top_Loaded (object sender, EventArgs args)
 			{
 			{
 				frame.Height = Dim.Height (widthEdit) + Dim.Height (heightEdit) + Dim.Height (titleEdit)
 				frame.Height = Dim.Height (widthEdit) + Dim.Height (heightEdit) + Dim.Height (titleEdit)
 					+ Dim.Height (numButtonsEdit) + Dim.Height (styleRadioGroup) + Dim.Height (glyphsNotWords) + 2;
 					+ Dim.Height (numButtonsEdit) + Dim.Height (styleRadioGroup) + Dim.Height (glyphsNotWords) + 2;

+ 2 - 2
UICatalog/Scenarios/LabelsAsButtons.cs

@@ -73,7 +73,7 @@ namespace UICatalog.Scenarios {
 				Win.Add (colorLabel);
 				Win.Add (colorLabel);
 				x += colorLabel.Text.Length + 2;
 				x += colorLabel.Text.Length + 2;
 			}
 			}
-			Application.Top.Ready += () => Application.Top.Redraw (Application.Top.Bounds);
+			Application.Top.Ready += (s,e) => Application.Top.Redraw (Application.Top.Bounds);
 
 
 			Label Label;
 			Label Label;
 			Win.Add (Label = new Label ("A super long _Label that will probably expose a bug in clipping or wrapping of text. Will it?") {
 			Win.Add (Label = new Label ("A super long _Label that will probably expose a bug in clipping or wrapping of text. Will it?") {
@@ -306,7 +306,7 @@ namespace UICatalog.Scenarios {
 				}
 				}
 			};
 			};
 
 
-			Application.Top.Ready += () => radioGroup.Refresh ();
+			Application.Top.Ready += (s,e) => radioGroup.Refresh ();
 		}
 		}
 	}
 	}
 }
 }

+ 1 - 1
UICatalog/Scenarios/MessageBoxes.cs

@@ -152,7 +152,7 @@ namespace UICatalog.Scenarios {
 			};
 			};
 			frame.Add (ckbEffect3D);
 			frame.Add (ckbEffect3D);
 
 
-			void Top_Loaded ()
+			void Top_Loaded (object sender, EventArgs args)
 			{
 			{
 				frame.Height = Dim.Height (widthEdit) + Dim.Height (heightEdit) + Dim.Height (titleEdit) + Dim.Height (messageEdit)
 				frame.Height = Dim.Height (widthEdit) + Dim.Height (heightEdit) + Dim.Height (titleEdit) + Dim.Height (messageEdit)
 				+ Dim.Height (numButtonsEdit) + Dim.Height (defaultButtonEdit) + Dim.Height (styleRadioGroup) + 2 + Dim.Height (ckbEffect3D);
 				+ Dim.Height (numButtonsEdit) + Dim.Height (defaultButtonEdit) + Dim.Height (styleRadioGroup) + 2 + Dim.Height (ckbEffect3D);

+ 1 - 1
UICatalog/Scenarios/ProgressBarStyles.cs

@@ -133,7 +133,7 @@ namespace UICatalog.Scenarios {
 
 
 			Application.Top.Unloaded += Top_Unloaded;
 			Application.Top.Unloaded += Top_Unloaded;
 
 
-			void Top_Unloaded ()
+			void Top_Unloaded (object sender, EventArgs args)
 			{
 			{
 				if (_fractionTimer != null) {
 				if (_fractionTimer != null) {
 					_fractionTimer.Dispose ();
 					_fractionTimer.Dispose ();

+ 2 - 2
UICatalog/Scenarios/Scrolling.cs

@@ -151,7 +151,7 @@ namespace UICatalog.Scenarios {
 			};
 			};
 			scrollView.Add (verticalRuler);
 			scrollView.Add (verticalRuler);
 
 
-			void Top_Loaded ()
+			void Top_Loaded (object sender, EventArgs args)
 			{
 			{
 				horizontalRuler.Text = rule.Repeat ((int)Math.Ceiling ((double)(horizontalRuler.Bounds.Width) / (double)rule.Length)) [0..(horizontalRuler.Bounds.Width)] +
 				horizontalRuler.Text = rule.Repeat ((int)Math.Ceiling ((double)(horizontalRuler.Bounds.Width) / (double)rule.Length)) [0..(horizontalRuler.Bounds.Width)] +
 					"\n" + "|         ".Repeat ((int)Math.Ceiling ((double)(horizontalRuler.Bounds.Width) / (double)rule.Length)) [0..(horizontalRuler.Bounds.Width)];
 					"\n" + "|         ".Repeat ((int)Math.Ceiling ((double)(horizontalRuler.Bounds.Width) / (double)rule.Length)) [0..(horizontalRuler.Bounds.Width)];
@@ -310,7 +310,7 @@ namespace UICatalog.Scenarios {
 			}
 			}
 			Application.MainLoop.AddTimeout (TimeSpan.FromMilliseconds (300), timer);
 			Application.MainLoop.AddTimeout (TimeSpan.FromMilliseconds (300), timer);
 
 
-			void Top_Unloaded ()
+			void Top_Unloaded (object sender, EventArgs args)
 			{
 			{
 				pulsing = false;
 				pulsing = false;
 				Application.Top.Unloaded -= Top_Unloaded;
 				Application.Top.Unloaded -= Top_Unloaded;

+ 1 - 1
UICatalog/Scenarios/Threading.cs

@@ -93,7 +93,7 @@ namespace UICatalog.Scenarios {
 
 
 			Win.Add (_itemsList, _btnActionCancel, _logJob, text, _btnAction, _btnLambda, _btnHandler, _btnSync, _btnMethod, _btnClearData, _btnQuit);
 			Win.Add (_itemsList, _btnActionCancel, _logJob, text, _btnAction, _btnLambda, _btnHandler, _btnSync, _btnMethod, _btnClearData, _btnQuit);
 
 
-			void Top_Loaded ()
+			void Top_Loaded (object sender, EventArgs args)
 			{
 			{
 				_btnActionCancel.SetFocus ();
 				_btnActionCancel.SetFocus ();
 				Application.Top.Loaded -= Top_Loaded;
 				Application.Top.Loaded -= Top_Loaded;

+ 1 - 1
UICatalog/Scenarios/TileViewNesting.cs

@@ -83,7 +83,7 @@ namespace UICatalog.Scenarios {
 
 
 			Application.Top.Add (menu);
 			Application.Top.Add (menu);
 
 
-			Win.Loaded += () => loaded = true;
+			Win.Loaded += (s,e) => loaded = true;
 		}
 		}
 
 
 		private void SetupTileView ()
 		private void SetupTileView ()

+ 1 - 1
UICatalog/Scenarios/Wizards.cs

@@ -70,7 +70,7 @@ namespace UICatalog.Scenarios {
 			};
 			};
 			frame.Add (titleEdit);
 			frame.Add (titleEdit);
 
 
-			void Top_Loaded ()
+			void Top_Loaded (object sender, EventArgs args)
 			{
 			{
 				frame.Height = Dim.Height (widthEdit) + Dim.Height (heightEdit) + Dim.Height (titleEdit) + 2;
 				frame.Height = Dim.Height (widthEdit) + Dim.Height (heightEdit) + Dim.Height (titleEdit) + 2;
 				Application.Top.Loaded -= Top_Loaded;
 				Application.Top.Loaded -= Top_Loaded;

+ 2 - 2
UICatalog/UICatalog.cs

@@ -352,7 +352,7 @@ namespace UICatalog {
 				ConfigurationManager.Applied += ConfigAppliedHandler;
 				ConfigurationManager.Applied += ConfigAppliedHandler;
 			}
 			}
  
  
-			void LoadedHandler ()
+			void LoadedHandler (object sender, EventArgs args)
 			{
 			{
 				ConfigChanged ();
 				ConfigChanged ();
 
 
@@ -381,7 +381,7 @@ namespace UICatalog {
 				Loaded -= LoadedHandler;
 				Loaded -= LoadedHandler;
 			}
 			}
 
 
-			private void UnloadedHandler ()
+			private void UnloadedHandler (object sender, EventArgs args)
 			{
 			{
 				ConfigurationManager.Applied -= ConfigAppliedHandler;
 				ConfigurationManager.Applied -= ConfigAppliedHandler;
 				Unloaded -= UnloadedHandler;
 				Unloaded -= UnloadedHandler;

+ 8 - 8
UnitTests/Application/ApplicationTests.cs

@@ -420,9 +420,9 @@ namespace Terminal.Gui.ApplicationTests {
 			Init ();
 			Init ();
 			var top = Application.Top;
 			var top = Application.Top;
 			var count = 0;
 			var count = 0;
-			top.Loaded += () => count++;
-			top.Ready += () => count++;
-			top.Unloaded += () => count++;
+			top.Loaded += (s,e) => count++;
+			top.Ready += (s,e) => count++;
+			top.Unloaded += (s,e) => count++;
 			Application.Iteration = () => Application.RequestStop ();
 			Application.Iteration = () => Application.RequestStop ();
 			Application.Run ();
 			Application.Run ();
 			Application.Shutdown ();
 			Application.Shutdown ();
@@ -473,23 +473,23 @@ namespace Terminal.Gui.ApplicationTests {
 			// t1, t2, t3, d, t4
 			// t1, t2, t3, d, t4
 			var iterations = 5;
 			var iterations = 5;
 
 
-			t1.Ready += () => {
+			t1.Ready += (s,e) => {
 				Assert.Equal (t1, Application.Top);
 				Assert.Equal (t1, Application.Top);
 				Application.Run (t2);
 				Application.Run (t2);
 			};
 			};
-			t2.Ready += () => {
+			t2.Ready += (s,e) => {
 				Assert.Equal (t2, Application.Top);
 				Assert.Equal (t2, Application.Top);
 				Application.Run (t3);
 				Application.Run (t3);
 			};
 			};
-			t3.Ready += () => {
+			t3.Ready += (s,e) => {
 				Assert.Equal (t3, Application.Top);
 				Assert.Equal (t3, Application.Top);
 				Application.Run (d);
 				Application.Run (d);
 			};
 			};
-			d.Ready += () => {
+			d.Ready += (s, e) => {
 				Assert.Equal (t3, Application.Top);
 				Assert.Equal (t3, Application.Top);
 				Application.Run (t4);
 				Application.Run (t4);
 			};
 			};
-			t4.Ready += () => {
+			t4.Ready += (s, e) => {
 				Assert.Equal (t4, Application.Top);
 				Assert.Equal (t4, Application.Top);
 				t4.RequestStop ();
 				t4.RequestStop ();
 				d.RequestStop ();
 				d.RequestStop ();

+ 7 - 7
UnitTests/Core/ViewTests.cs

@@ -899,7 +899,7 @@ namespace Terminal.Gui.CoreTests {
 			w.Add (f);
 			w.Add (f);
 			t.Add (w);
 			t.Add (w);
 
 
-			t.Ready += () => {
+			t.Ready += (s, e) => {
 				Assert.True (t.CanFocus);
 				Assert.True (t.CanFocus);
 				Assert.True (w.CanFocus);
 				Assert.True (w.CanFocus);
 				Assert.True (f.CanFocus);
 				Assert.True (f.CanFocus);
@@ -943,7 +943,7 @@ namespace Terminal.Gui.CoreTests {
 			w.Add (f);
 			w.Add (f);
 			t.Add (w);
 			t.Add (w);
 
 
-			t.Ready += () => {
+			t.Ready += (s, e) => {
 				Assert.True (t.CanFocus);
 				Assert.True (t.CanFocus);
 				Assert.True (w.CanFocus);
 				Assert.True (w.CanFocus);
 				Assert.True (f.CanFocus);
 				Assert.True (f.CanFocus);
@@ -978,7 +978,7 @@ namespace Terminal.Gui.CoreTests {
 			w.Add (f);
 			w.Add (f);
 			t.Add (w);
 			t.Add (w);
 
 
-			t.Ready += () => {
+			t.Ready += (s, e) => {
 				Assert.True (t.CanFocus);
 				Assert.True (t.CanFocus);
 				Assert.True (w.CanFocus);
 				Assert.True (w.CanFocus);
 				Assert.True (f.CanFocus);
 				Assert.True (f.CanFocus);
@@ -1012,7 +1012,7 @@ namespace Terminal.Gui.CoreTests {
 
 
 			Application.Init (new FakeDriver ());
 			Application.Init (new FakeDriver ());
 
 
-			Application.Top.Ready += () => {
+			Application.Top.Ready += (s, e) => {
 				Assert.Null (Application.Top.Focused);
 				Assert.Null (Application.Top.Focused);
 			};
 			};
 
 
@@ -1072,10 +1072,10 @@ namespace Terminal.Gui.CoreTests {
 
 
 			t.Ready += FirstDialogToplevel;
 			t.Ready += FirstDialogToplevel;
 
 
-			void FirstDialogToplevel ()
+			void FirstDialogToplevel (object sender, EventArgs args)
 			{
 			{
 				var od = new OpenDialog ();
 				var od = new OpenDialog ();
-				od.Ready += SecoundDialogToplevel;
+				od.Ready += SecondDialogToplevel;
 
 
 				Application.MainLoop.AddTimeout (TimeSpan.FromMilliseconds (100), (_) => {
 				Application.MainLoop.AddTimeout (TimeSpan.FromMilliseconds (100), (_) => {
 					count1++;
 					count1++;
@@ -1096,7 +1096,7 @@ namespace Terminal.Gui.CoreTests {
 				Application.Run (od);
 				Application.Run (od);
 			}
 			}
 
 
-			void SecoundDialogToplevel ()
+			void SecondDialogToplevel (object sender, EventArgs args)
 			{
 			{
 				var d = new Dialog ();
 				var d = new Dialog ();
 
 

+ 1 - 1
UnitTests/TopLevels/DialogTests.cs

@@ -582,7 +582,7 @@ namespace Terminal.Gui.TopLevelTests {
 		{
 		{
 			for (int i = 0; i < 8; i++) {
 			for (int i = 0; i < 8; i++) {
 				var fd = new FileDialog ();
 				var fd = new FileDialog ();
-				fd.Ready += () => Application.RequestStop ();
+				fd.Ready += (s,e) => Application.RequestStop ();
 				Application.Run (fd);
 				Application.Run (fd);
 			}
 			}
 		}
 		}

+ 46 - 46
UnitTests/TopLevels/MdiTests.cs

@@ -67,24 +67,24 @@ namespace Terminal.Gui.TopLevelTests {
 			// top1, top2, top3, d1 = 4
 			// top1, top2, top3, d1 = 4
 			var iterations = 4;
 			var iterations = 4;
 
 
-			top1.Ready += () => {
+			top1.Ready += (s, e) => {
 				Assert.Null (Application.MdiChildes);
 				Assert.Null (Application.MdiChildes);
 				Application.Run (top2);
 				Application.Run (top2);
 			};
 			};
-			top2.Ready += () => {
+			top2.Ready += (s, e) => {
 				Assert.Null (Application.MdiChildes);
 				Assert.Null (Application.MdiChildes);
 				Application.Run (top3);
 				Application.Run (top3);
 			};
 			};
-			top3.Ready += () => {
+			top3.Ready += (s, e) => {
 				Assert.Null (Application.MdiChildes);
 				Assert.Null (Application.MdiChildes);
 				Application.Run (top4);
 				Application.Run (top4);
 			};
 			};
-			top4.Ready += () => {
+			top4.Ready += (s, e) => {
 				Assert.Null (Application.MdiChildes);
 				Assert.Null (Application.MdiChildes);
 				Application.Run (d);
 				Application.Run (d);
 			};
 			};
 
 
-			d.Ready += () => {
+			d.Ready += (s, e) => {
 				Assert.Null (Application.MdiChildes);
 				Assert.Null (Application.MdiChildes);
 				// This will close the d because on a not MdiContainer the Application.Current it always used.
 				// This will close the d because on a not MdiContainer the Application.Current it always used.
 				Application.RequestStop (top1);
 				Application.RequestStop (top1);
@@ -130,25 +130,25 @@ else 					Assert.True (Application.Current == top1);
 			// d1 = 1
 			// d1 = 1
 			var iterations = 4;
 			var iterations = 4;
 
 
-			mdi.Ready += () => {
+			mdi.Ready += (s, e) => {
 				Assert.Empty (Application.MdiChildes);
 				Assert.Empty (Application.MdiChildes);
 				Application.Run (c1);
 				Application.Run (c1);
 			};
 			};
-			c1.Ready += () => {
+			c1.Ready += (s, e) => {
 				Assert.Single (Application.MdiChildes);
 				Assert.Single (Application.MdiChildes);
 				Application.Run (c2);
 				Application.Run (c2);
 			};
 			};
-			c2.Ready += () => {
+			c2.Ready += (s, e) => {
 				Assert.Equal (2, Application.MdiChildes.Count);
 				Assert.Equal (2, Application.MdiChildes.Count);
 				Application.Run (c3);
 				Application.Run (c3);
 			};
 			};
-			c3.Ready += () => {
+			c3.Ready += (s, e) => {
 				Assert.Equal (3, Application.MdiChildes.Count);
 				Assert.Equal (3, Application.MdiChildes.Count);
 				Application.Run (d);
 				Application.Run (d);
 			};
 			};
 
 
 			// More easy because the Mdi Container handles all at once
 			// More easy because the Mdi Container handles all at once
-			d.Ready += () => {
+			d.Ready += (s, e) => {
 				Assert.Equal (3, Application.MdiChildes.Count);
 				Assert.Equal (3, Application.MdiChildes.Count);
 				// This will not close the MdiContainer because d is a modal toplevel and will be closed.
 				// This will not close the MdiContainer because d is a modal toplevel and will be closed.
 				mdi.RequestStop ();
 				mdi.RequestStop ();
@@ -190,25 +190,25 @@ else 					Assert.True (Application.Current == top1);
 			// d1 = 1
 			// d1 = 1
 			var iterations = 4;
 			var iterations = 4;
 
 
-			mdi.Ready += () => {
+			mdi.Ready += (s, e) => {
 				Assert.Empty (Application.MdiChildes);
 				Assert.Empty (Application.MdiChildes);
 				Application.Run (c1);
 				Application.Run (c1);
 			};
 			};
-			c1.Ready += () => {
+			c1.Ready += (s, e) => {
 				Assert.Single (Application.MdiChildes);
 				Assert.Single (Application.MdiChildes);
 				Application.Run (c2);
 				Application.Run (c2);
 			};
 			};
-			c2.Ready += () => {
+			c2.Ready += (s, e) => {
 				Assert.Equal (2, Application.MdiChildes.Count);
 				Assert.Equal (2, Application.MdiChildes.Count);
 				Application.Run (c3);
 				Application.Run (c3);
 			};
 			};
-			c3.Ready += () => {
+			c3.Ready += (s, e) => {
 				Assert.Equal (3, Application.MdiChildes.Count);
 				Assert.Equal (3, Application.MdiChildes.Count);
 				Application.Run (d);
 				Application.Run (d);
 			};
 			};
 
 
 			// Also easy because the Mdi Container handles all at once
 			// Also easy because the Mdi Container handles all at once
-			d.Ready += () => {
+			d.Ready += (s, e) => {
 				Assert.Equal (3, Application.MdiChildes.Count);
 				Assert.Equal (3, Application.MdiChildes.Count);
 				// This will not close the MdiContainer because d is a modal toplevel
 				// This will not close the MdiContainer because d is a modal toplevel
 				Application.RequestStop (mdi);
 				Application.RequestStop (mdi);
@@ -248,25 +248,25 @@ else 					Assert.True (Application.Current == top1);
 			// d1 = 1
 			// d1 = 1
 			var iterations = 4;
 			var iterations = 4;
 
 
-			mdi.Ready += () => {
+			mdi.Ready += (s, e) => {
 				Assert.Empty (Application.MdiChildes);
 				Assert.Empty (Application.MdiChildes);
 				Application.Run (c1);
 				Application.Run (c1);
 			};
 			};
-			c1.Ready += () => {
+			c1.Ready += (s, e) => {
 				Assert.Single (Application.MdiChildes);
 				Assert.Single (Application.MdiChildes);
 				Application.Run (c2);
 				Application.Run (c2);
 			};
 			};
-			c2.Ready += () => {
+			c2.Ready += (s, e) => {
 				Assert.Equal (2, Application.MdiChildes.Count);
 				Assert.Equal (2, Application.MdiChildes.Count);
 				Application.Run (c3);
 				Application.Run (c3);
 			};
 			};
-			c3.Ready += () => {
+			c3.Ready += (s, e) => {
 				Assert.Equal (3, Application.MdiChildes.Count);
 				Assert.Equal (3, Application.MdiChildes.Count);
 				Application.Run (d);
 				Application.Run (d);
 			};
 			};
 
 
 			//More harder because it's sequential.
 			//More harder because it's sequential.
-			d.Ready += () => {
+			d.Ready += (s, e) => {
 				Assert.Equal (3, Application.MdiChildes.Count);
 				Assert.Equal (3, Application.MdiChildes.Count);
 				// Close the Dialog
 				// Close the Dialog
 				Application.RequestStop ();
 				Application.RequestStop ();
@@ -331,28 +331,28 @@ else 					Assert.True (Application.Current == top1);
 			// d1, d2 = 2
 			// d1, d2 = 2
 			var iterations = 5;
 			var iterations = 5;
 
 
-			mdi.Ready += () => {
+			mdi.Ready += (s, e) => {
 				Assert.Empty (Application.MdiChildes);
 				Assert.Empty (Application.MdiChildes);
 				Application.Run (c1);
 				Application.Run (c1);
 			};
 			};
-			c1.Ready += () => {
+			c1.Ready += (s, e) => {
 				Assert.Single (Application.MdiChildes);
 				Assert.Single (Application.MdiChildes);
 				Application.Run (c2);
 				Application.Run (c2);
 			};
 			};
-			c2.Ready += () => {
+			c2.Ready += (s, e) => {
 				Assert.Equal (2, Application.MdiChildes.Count);
 				Assert.Equal (2, Application.MdiChildes.Count);
 				Application.Run (c3);
 				Application.Run (c3);
 			};
 			};
-			c3.Ready += () => {
+			c3.Ready += (s, e) => {
 				Assert.Equal (3, Application.MdiChildes.Count);
 				Assert.Equal (3, Application.MdiChildes.Count);
 				Application.Run (d1);
 				Application.Run (d1);
 			};
 			};
-			d1.Ready += () => {
+			d1.Ready += (s, e) => {
 				Assert.Equal (3, Application.MdiChildes.Count);
 				Assert.Equal (3, Application.MdiChildes.Count);
 				Application.Run (d2);
 				Application.Run (d2);
 			};
 			};
 
 
-			d2.Ready += () => {
+			d2.Ready += (s, e) => {
 				Assert.Equal (3, Application.MdiChildes.Count);
 				Assert.Equal (3, Application.MdiChildes.Count);
 				Assert.True (Application.Current == d2);
 				Assert.True (Application.Current == d2);
 				Assert.True (Application.Current.Running);
 				Assert.True (Application.Current.Running);
@@ -406,28 +406,28 @@ else 					Assert.True (Application.Current == top1);
 			// d1 = 1
 			// d1 = 1
 			var iterations = 5;
 			var iterations = 5;
 
 
-			mdi.Ready += () => {
+			mdi.Ready += (s, e) => {
 				Assert.Empty (Application.MdiChildes);
 				Assert.Empty (Application.MdiChildes);
 				Application.Run (c1);
 				Application.Run (c1);
 			};
 			};
-			c1.Ready += () => {
+			c1.Ready += (s, e) => {
 				Assert.Single (Application.MdiChildes);
 				Assert.Single (Application.MdiChildes);
 				Application.Run (c2);
 				Application.Run (c2);
 			};
 			};
-			c2.Ready += () => {
+			c2.Ready += (s, e) => {
 				Assert.Equal (2, Application.MdiChildes.Count);
 				Assert.Equal (2, Application.MdiChildes.Count);
 				Application.Run (c3);
 				Application.Run (c3);
 			};
 			};
-			c3.Ready += () => {
+			c3.Ready += (s, e) => {
 				Assert.Equal (3, Application.MdiChildes.Count);
 				Assert.Equal (3, Application.MdiChildes.Count);
 				Application.Run (d1);
 				Application.Run (d1);
 			};
 			};
-			d1.Ready += () => {
+			d1.Ready += (s, e) => {
 				Assert.Equal (3, Application.MdiChildes.Count);
 				Assert.Equal (3, Application.MdiChildes.Count);
 				Application.Run (c4);
 				Application.Run (c4);
 			};
 			};
 
 
-			c4.Ready += () => {
+			c4.Ready += (s, e) => {
 				Assert.Equal (4, Application.MdiChildes.Count);
 				Assert.Equal (4, Application.MdiChildes.Count);
 				// Trying to close the Dialog1
 				// Trying to close the Dialog1
 				d1.RequestStop ();
 				d1.RequestStop ();
@@ -471,19 +471,19 @@ else 					Assert.True (Application.Current == top1);
 			// MdiChild = c1, c2, c3
 			// MdiChild = c1, c2, c3
 			var iterations = 3;
 			var iterations = 3;
 
 
-			mdi.Ready += () => {
+			mdi.Ready += (s, e) => {
 				Assert.Empty (Application.MdiChildes);
 				Assert.Empty (Application.MdiChildes);
 				Application.Run (c1);
 				Application.Run (c1);
 			};
 			};
-			c1.Ready += () => {
+			c1.Ready += (s, e) => {
 				Assert.Single (Application.MdiChildes);
 				Assert.Single (Application.MdiChildes);
 				Application.Run (c2);
 				Application.Run (c2);
 			};
 			};
-			c2.Ready += () => {
+			c2.Ready += (s, e) => {
 				Assert.Equal (2, Application.MdiChildes.Count);
 				Assert.Equal (2, Application.MdiChildes.Count);
 				Application.Run (c3);
 				Application.Run (c3);
 			};
 			};
-			c3.Ready += () => {
+			c3.Ready += (s, e) => {
 				Assert.Equal (3, Application.MdiChildes.Count);
 				Assert.Equal (3, Application.MdiChildes.Count);
 				c3.RequestStop ();
 				c3.RequestStop ();
 				c1.RequestStop ();
 				c1.RequestStop ();
@@ -532,7 +532,7 @@ else 					Assert.True (Application.Current == top1);
 			var mdi = new Mdi ();
 			var mdi = new Mdi ();
 			var mdi2 = new Mdi ();
 			var mdi2 = new Mdi ();
 
 
-			mdi.Ready += () => {
+			mdi.Ready += (s, e) => {
 				Assert.Throws<InvalidOperationException> (() => Application.Run (mdi2));
 				Assert.Throws<InvalidOperationException> (() => Application.Run (mdi2));
 				mdi.RequestStop ();
 				mdi.RequestStop ();
 			};
 			};
@@ -553,19 +553,19 @@ else 					Assert.True (Application.Current == top1);
 			var allStageClosed = false;
 			var allStageClosed = false;
 			var mdiRequestStop = false;
 			var mdiRequestStop = false;
 
 
-			mdi.Ready += () => {
+			mdi.Ready += (s, e) => {
 				Assert.Empty (Application.MdiChildes);
 				Assert.Empty (Application.MdiChildes);
 				Application.Run (logger);
 				Application.Run (logger);
 			};
 			};
 
 
-			logger.Ready += () => Assert.Single (Application.MdiChildes);
+			logger.Ready += (s, e) => Assert.Single (Application.MdiChildes);
 
 
 			Application.Iteration += () => {
 			Application.Iteration += () => {
 				if (stageCompleted && running) {
 				if (stageCompleted && running) {
 					stageCompleted = false;
 					stageCompleted = false;
 					var stage = new Window () { Modal = true };
 					var stage = new Window () { Modal = true };
 
 
-					stage.Ready += () => {
+					stage.Ready += (s, e) => {
 						Assert.Equal (iterations, Application.MdiChildes.Count);
 						Assert.Equal (iterations, Application.MdiChildes.Count);
 						stage.RequestStop ();
 						stage.RequestStop ();
 					};
 					};
@@ -578,7 +578,7 @@ else 					Assert.True (Application.Current == top1);
 
 
 							var rpt = new Window ();
 							var rpt = new Window ();
 
 
-							rpt.Ready += () => {
+							rpt.Ready += (s, e) => {
 								iterations++;
 								iterations++;
 								Assert.Equal (iterations, Application.MdiChildes.Count);
 								Assert.Equal (iterations, Application.MdiChildes.Count);
 							};
 							};
@@ -618,26 +618,26 @@ else if (!mdiRequestStop && !running && allStageClosed) {
 			// MdiChild = c1, c2, c3
 			// MdiChild = c1, c2, c3
 			var iterations = 3;
 			var iterations = 3;
 
 
-			mdi.Ready += () => {
+			mdi.Ready += (s, e) => {
 				Assert.Empty (Application.MdiChildes);
 				Assert.Empty (Application.MdiChildes);
 				Application.Run (c1);
 				Application.Run (c1);
 			};
 			};
-			c1.Ready += () => {
+			c1.Ready += (s, e) => {
 				Assert.Single (Application.MdiChildes);
 				Assert.Single (Application.MdiChildes);
 				Application.Run (c2);
 				Application.Run (c2);
 			};
 			};
-			c2.Ready += () => {
+			c2.Ready += (s, e) => {
 				Assert.Equal (2, Application.MdiChildes.Count);
 				Assert.Equal (2, Application.MdiChildes.Count);
 				Application.Run (c3);
 				Application.Run (c3);
 			};
 			};
-			c3.Ready += () => {
+			c3.Ready += (s, e) => {
 				Assert.Equal (3, Application.MdiChildes.Count);
 				Assert.Equal (3, Application.MdiChildes.Count);
 				c3.RequestStop ();
 				c3.RequestStop ();
 				c2.RequestStop ();
 				c2.RequestStop ();
 				c1.RequestStop ();
 				c1.RequestStop ();
 			};
 			};
 			// Now this will close the MdiContainer when all MdiChildes was closed
 			// Now this will close the MdiContainer when all MdiChildes was closed
-			mdi.AllChildClosed += () => {
+			mdi.AllChildClosed += (s, e) => {
 				mdi.RequestStop ();
 				mdi.RequestStop ();
 			};
 			};
 			Application.Iteration += () => {
 			Application.Iteration += () => {

+ 6 - 6
UnitTests/TopLevels/ToplevelTests.cs

@@ -166,7 +166,7 @@ namespace Terminal.Gui.TopLevelTests {
 			top.Closing += (e) => eventInvoked = "Closing";
 			top.Closing += (e) => eventInvoked = "Closing";
 			top.OnClosing (new ToplevelClosingEventArgs (top));
 			top.OnClosing (new ToplevelClosingEventArgs (top));
 			Assert.Equal ("Closing", eventInvoked);
 			Assert.Equal ("Closing", eventInvoked);
-			top.AllChildClosed += () => eventInvoked = "AllChildClosed";
+			top.AllChildClosed += (s, e) => eventInvoked = "AllChildClosed";
 			top.OnAllChildClosed ();
 			top.OnAllChildClosed ();
 			Assert.Equal ("AllChildClosed", eventInvoked);
 			Assert.Equal ("AllChildClosed", eventInvoked);
 			top.ChildClosed += (e) => eventInvoked = "ChildClosed";
 			top.ChildClosed += (e) => eventInvoked = "ChildClosed";
@@ -178,13 +178,13 @@ namespace Terminal.Gui.TopLevelTests {
 			top.Activate += (e) => eventInvoked = "Activate";
 			top.Activate += (e) => eventInvoked = "Activate";
 			top.OnActivate (top);
 			top.OnActivate (top);
 			Assert.Equal ("Activate", eventInvoked);
 			Assert.Equal ("Activate", eventInvoked);
-			top.Loaded += () => eventInvoked = "Loaded";
+			top.Loaded += (s, e) => eventInvoked = "Loaded";
 			top.OnLoaded ();
 			top.OnLoaded ();
 			Assert.Equal ("Loaded", eventInvoked);
 			Assert.Equal ("Loaded", eventInvoked);
-			top.Ready += () => eventInvoked = "Ready";
+			top.Ready += (s, e) => eventInvoked = "Ready";
 			top.OnReady ();
 			top.OnReady ();
 			Assert.Equal ("Ready", eventInvoked);
 			Assert.Equal ("Ready", eventInvoked);
-			top.Unloaded += () => eventInvoked = "Unloaded";
+			top.Unloaded += (s, e) => eventInvoked = "Unloaded";
 			top.OnUnloaded ();
 			top.OnUnloaded ();
 			Assert.Equal ("Unloaded", eventInvoked);
 			Assert.Equal ("Unloaded", eventInvoked);
 
 
@@ -355,7 +355,7 @@ namespace Terminal.Gui.TopLevelTests {
 
 
 			var top = Application.Top;
 			var top = Application.Top;
 			top.Add (win1, win2);
 			top.Add (win1, win2);
-			top.Loaded += () => isRunning = true;
+			top.Loaded += (s, e) => isRunning = true;
 			top.Closing += (_) => isRunning = false;
 			top.Closing += (_) => isRunning = false;
 			Application.Begin (top);
 			Application.Begin (top);
 			top.Running = true;
 			top.Running = true;
@@ -668,7 +668,7 @@ namespace Terminal.Gui.TopLevelTests {
 		{
 		{
 			for (int i = 0; i < 8; i++) {
 			for (int i = 0; i < 8; i++) {
 				var fd = new FileDialog ();
 				var fd = new FileDialog ();
-				fd.Ready += () => Application.RequestStop ();
+				fd.Ready += (s, e) => Application.RequestStop ();
 				Application.Run (fd);
 				Application.Run (fd);
 			}
 			}
 		}
 		}

+ 5 - 5
UnitTests/Types/DimTests.cs

@@ -268,7 +268,7 @@ namespace Terminal.Gui.TypeTests {
 			w.Add (v);
 			w.Add (v);
 			t.Add (w);
 			t.Add (w);
 
 
-			t.Ready += () => {
+			t.Ready += (s, e) => {
 				Assert.Equal (2, w.Width = 2);
 				Assert.Equal (2, w.Width = 2);
 				Assert.Equal (2, w.Height = 2);
 				Assert.Equal (2, w.Height = 2);
 				Assert.Throws<ArgumentException> (() => v.Width = 2);
 				Assert.Throws<ArgumentException> (() => v.Width = 2);
@@ -298,7 +298,7 @@ namespace Terminal.Gui.TypeTests {
 			var w = new Window (new Rect (1, 2, 4, 5), "w");
 			var w = new Window (new Rect (1, 2, 4, 5), "w");
 			t.Add (w);
 			t.Add (w);
 
 
-			t.Ready += () => {
+			t.Ready += (s, e) => {
 				Assert.Equal (3, w.Width = 3);
 				Assert.Equal (3, w.Width = 3);
 				Assert.Equal (4, w.Height = 4);
 				Assert.Equal (4, w.Height = 4);
 			};
 			};
@@ -328,7 +328,7 @@ namespace Terminal.Gui.TypeTests {
 			w.Add (v);
 			w.Add (v);
 			t.Add (w);
 			t.Add (w);
 
 
-			t.Ready += () => {
+			t.Ready += (s, e) => {
 				v.LayoutStyle = LayoutStyle.Absolute;
 				v.LayoutStyle = LayoutStyle.Absolute;
 				Assert.Equal (2, v.Width = 2);
 				Assert.Equal (2, v.Width = 2);
 				Assert.Equal (2, v.Height = 2);
 				Assert.Equal (2, v.Height = 2);
@@ -419,7 +419,7 @@ namespace Terminal.Gui.TypeTests {
 			w.Add (f1, f2, v1, v2, v3, v4, v5, v6);
 			w.Add (f1, f2, v1, v2, v3, v4, v5, v6);
 			t.Add (w);
 			t.Add (w);
 
 
-			t.Ready += () => {
+			t.Ready += (s, e) => {
 				Assert.Equal ("Absolute(100)", w.Width.ToString ());
 				Assert.Equal ("Absolute(100)", w.Width.ToString ());
 				Assert.Equal ("Absolute(100)", w.Height.ToString ());
 				Assert.Equal ("Absolute(100)", w.Height.ToString ());
 				Assert.Equal (100, w.Frame.Width);
 				Assert.Equal (100, w.Frame.Width);
@@ -565,7 +565,7 @@ namespace Terminal.Gui.TypeTests {
 			f.Width = Dim.Width (t) - Dim.Width (v2);
 			f.Width = Dim.Width (t) - Dim.Width (v2);
 			f.Height = Dim.Height (t) - Dim.Height (v2);
 			f.Height = Dim.Height (t) - Dim.Height (v2);
 
 
-			t.Ready += () => {
+			t.Ready += (s, e) => {
 				Assert.Equal (80, t.Frame.Width);
 				Assert.Equal (80, t.Frame.Width);
 				Assert.Equal (25, t.Frame.Height);
 				Assert.Equal (25, t.Frame.Height);
 				Assert.Equal (78, w.Frame.Width);
 				Assert.Equal (78, w.Frame.Width);

+ 4 - 4
UnitTests/Types/PosTests.cs

@@ -716,7 +716,7 @@ namespace Terminal.Gui.TypeTests {
 			w.Add (v);
 			w.Add (v);
 			t.Add (w);
 			t.Add (w);
 
 
-			t.Ready += () => {
+			t.Ready += (s, e) => {
 				Assert.Equal (2, w.X = 2);
 				Assert.Equal (2, w.X = 2);
 				Assert.Equal (2, w.Y = 2);
 				Assert.Equal (2, w.Y = 2);
 				Assert.Throws<ArgumentException> (() => v.X = 2);
 				Assert.Throws<ArgumentException> (() => v.X = 2);
@@ -739,7 +739,7 @@ namespace Terminal.Gui.TypeTests {
 			var w = new Window (new Rect (1, 2, 4, 5), "w");
 			var w = new Window (new Rect (1, 2, 4, 5), "w");
 			t.Add (w);
 			t.Add (w);
 
 
-			t.Ready += () => {
+			t.Ready += (s, e) => {
 				Assert.Equal (2, w.X = 2);
 				Assert.Equal (2, w.X = 2);
 				Assert.Equal (2, w.Y = 2);
 				Assert.Equal (2, w.Y = 2);
 			};
 			};
@@ -770,7 +770,7 @@ namespace Terminal.Gui.TypeTests {
 			w.Add (v);
 			w.Add (v);
 			t.Add (w);
 			t.Add (w);
 
 
-			t.Ready += () => {
+			t.Ready += (s, e) => {
 				v.LayoutStyle = LayoutStyle.Absolute;
 				v.LayoutStyle = LayoutStyle.Absolute;
 				Assert.Equal (2, v.X = 2);
 				Assert.Equal (2, v.X = 2);
 				Assert.Equal (2, v.Y = 2);
 				Assert.Equal (2, v.Y = 2);
@@ -812,7 +812,7 @@ namespace Terminal.Gui.TypeTests {
 			f.X = Pos.X (t) + Pos.X (v2) - Pos.X (v1);
 			f.X = Pos.X (t) + Pos.X (v2) - Pos.X (v1);
 			f.Y = Pos.Y (t) + Pos.Y (v2) - Pos.Y (v1);
 			f.Y = Pos.Y (t) + Pos.Y (v2) - Pos.Y (v1);
 
 
-			t.Ready += () => {
+			t.Ready += (s, e) => {
 				Assert.Equal (0, t.Frame.X);
 				Assert.Equal (0, t.Frame.X);
 				Assert.Equal (0, t.Frame.Y);
 				Assert.Equal (0, t.Frame.Y);
 				Assert.Equal (2, w.Frame.X);
 				Assert.Equal (2, w.Frame.X);

+ 2 - 2
UnitTests/Views/ScrollBarViewTests.cs

@@ -495,7 +495,7 @@ namespace Terminal.Gui.ViewTests {
 					newScrollBarView.Refresh ();
 					newScrollBarView.Refresh ();
 				};
 				};
 
 
-				top.Ready += () => {
+				top.Ready += (s, e) => {
 					newScrollBarView.Position = 45;
 					newScrollBarView.Position = 45;
 					Assert.Equal (newScrollBarView.Position, newScrollBarView.Size - listView.TopItem + (listView.TopItem - listView.Bounds.Height));
 					Assert.Equal (newScrollBarView.Position, newScrollBarView.Size - listView.TopItem + (listView.TopItem - listView.Bounds.Height));
 					Assert.Equal (newScrollBarView.Position, listView.TopItem);
 					Assert.Equal (newScrollBarView.Position, listView.TopItem);
@@ -570,7 +570,7 @@ namespace Terminal.Gui.ViewTests {
 					newScrollBarView.Refresh ();
 					newScrollBarView.Refresh ();
 				};
 				};
 
 
-				top.Ready += () => {
+				top.Ready += (s, e) => {
 					newScrollBarView.Position = 100;
 					newScrollBarView.Position = 100;
 					Assert.Equal (newScrollBarView.Position, newScrollBarView.Size - listView.LeftItem + (listView.LeftItem - listView.Bounds.Width));
 					Assert.Equal (newScrollBarView.Position, newScrollBarView.Size - listView.LeftItem + (listView.LeftItem - listView.Bounds.Width));
 					Assert.Equal (newScrollBarView.Position, listView.LeftItem);
 					Assert.Equal (newScrollBarView.Position, listView.LeftItem);