Switch to EventHandler<ToplevelEventArgs> for

- Activate
- Deactivate
- ChildClosed
- Closed
- ChildLoaded
- ChildUnloaded
This commit is contained in:
tznind
2023-03-11 10:18:39 +00:00
parent 58c267fd7c
commit bdcbd55856
10 changed files with 59 additions and 38 deletions

View File

@@ -497,7 +497,7 @@ namespace Terminal.Gui.ApplicationTests {
t2.RequestStop ();
};
// Now this will close the MdiContainer when all MdiChildes was closed
t2.Closed += (_) => {
t2.Closed += (s,_) => {
t1.RequestStop ();
};
Application.Iteration += () => {

View File

@@ -91,7 +91,7 @@ namespace Terminal.Gui.TopLevelTests {
Assert.True (Application.Current == d);
};
d.Closed += (e) => Application.RequestStop (top1);
d.Closed += (s,e) => Application.RequestStop (top1);
Application.Iteration += () => {
Assert.Null (Application.MdiChildes);
@@ -155,7 +155,7 @@ else Assert.True (Application.Current == top1);
};
// Now this will close the MdiContainer propagating through the MdiChildes.
d.Closed += (e) => {
d.Closed += (s,e) => {
mdi.RequestStop ();
};
@@ -215,7 +215,7 @@ else Assert.True (Application.Current == top1);
};
// Now this will close the MdiContainer propagating through the MdiChildes.
d.Closed += (e) => Application.RequestStop (mdi);
d.Closed += (s,e) => Application.RequestStop (mdi);
Application.Iteration += () => {
if (iterations == 4) {
@@ -273,7 +273,7 @@ else Assert.True (Application.Current == top1);
};
// Now this will close the MdiContainer propagating through the MdiChildes.
d.Closed += (e) => Application.RequestStop (mdi);
d.Closed += (s, e) => Application.RequestStop (mdi);
Application.Iteration += () => {
if (iterations == 4) {
@@ -361,7 +361,7 @@ else Assert.True (Application.Current == top1);
};
// Now this will close the MdiContainer propagating through the MdiChildes.
d1.Closed += (e) => {
d1.Closed += (s, e) => {
Assert.True (Application.Current == d1);
Assert.False (Application.Current.Running);
mdi.RequestStop ();
@@ -434,7 +434,7 @@ else Assert.True (Application.Current == top1);
};
// Now this will close the MdiContainer propagating through the MdiChildes.
d1.Closed += (e) => {
d1.Closed += (s, e) => {
mdi.RequestStop ();
};
@@ -489,7 +489,7 @@ else Assert.True (Application.Current == top1);
c1.RequestStop ();
};
// Now this will close the MdiContainer propagating through the MdiChildes.
c1.Closed += (e) => {
c1.Closed += (s, e) => {
mdi.RequestStop ();
};
Application.Iteration += () => {
@@ -570,7 +570,7 @@ else Assert.True (Application.Current == top1);
stage.RequestStop ();
};
stage.Closed += (_) => {
stage.Closed += (_, _) => {
if (iterations == 11) allStageClosed = true;
Assert.Equal (iterations, Application.MdiChildes.Count);
if (running) {

View File

@@ -154,13 +154,13 @@ namespace Terminal.Gui.TopLevelTests {
var eventInvoked = "";
top.ChildUnloaded += (e) => eventInvoked = "ChildUnloaded";
top.ChildUnloaded += (s,e) => eventInvoked = "ChildUnloaded";
top.OnChildUnloaded (top);
Assert.Equal ("ChildUnloaded", eventInvoked);
top.ChildLoaded += (e) => eventInvoked = "ChildLoaded";
top.ChildLoaded += (s,e) => eventInvoked = "ChildLoaded";
top.OnChildLoaded (top);
Assert.Equal ("ChildLoaded", eventInvoked);
top.Closed += (e) => eventInvoked = "Closed";
top.Closed += (s, e) => eventInvoked = "Closed";
top.OnClosed (top);
Assert.Equal ("Closed", eventInvoked);
top.Closing += (e) => eventInvoked = "Closing";
@@ -169,13 +169,13 @@ namespace Terminal.Gui.TopLevelTests {
top.AllChildClosed += (s, e) => eventInvoked = "AllChildClosed";
top.OnAllChildClosed ();
Assert.Equal ("AllChildClosed", eventInvoked);
top.ChildClosed += (e) => eventInvoked = "ChildClosed";
top.ChildClosed += (s,e) => eventInvoked = "ChildClosed";
top.OnChildClosed (top);
Assert.Equal ("ChildClosed", eventInvoked);
top.Deactivate += (e) => eventInvoked = "Deactivate";
top.Deactivate += (s,e) => eventInvoked = "Deactivate";
top.OnDeactivate (top);
Assert.Equal ("Deactivate", eventInvoked);
top.Activate += (e) => eventInvoked = "Activate";
top.Activate += (s,e) => eventInvoked = "Activate";
top.OnActivate (top);
Assert.Equal ("Activate", eventInvoked);
top.Loaded += (s, e) => eventInvoked = "Loaded";

View File

@@ -523,7 +523,7 @@ namespace Terminal.Gui.TopLevelTests {
};
var closedFired = false;
wizard.Closed += (args) => {
wizard.Closed += (s, e) => {
closedFired = true;
};
@@ -553,7 +553,7 @@ namespace Terminal.Gui.TopLevelTests {
};
closedFired = false;
wizard.Closed += (args) => {
wizard.Closed += (s,e) => {
closedFired = true;
};
@@ -591,7 +591,7 @@ namespace Terminal.Gui.TopLevelTests {
};
closedFired = false;
wizard.Closed += (args) => {
wizard.Closed += (s,e) => {
closedFired = true;
};