diff --git a/Terminal.Gui/App/ApplicationImpl.Lifecycle.cs b/Terminal.Gui/App/ApplicationImpl.Lifecycle.cs index 09f06588d..0d1b1011d 100644 --- a/Terminal.Gui/App/ApplicationImpl.Lifecycle.cs +++ b/Terminal.Gui/App/ApplicationImpl.Lifecycle.cs @@ -162,7 +162,7 @@ public partial class ApplicationImpl // === 1. Stop all running toplevels === foreach (Toplevel? t in SessionStack) { - t!.Running = false; + t!.IsRunning = false; } // === 2. Close and dispose popover === diff --git a/Terminal.Gui/App/ApplicationImpl.Run.cs b/Terminal.Gui/App/ApplicationImpl.Run.cs index 4e9f59645..eacb3fe45 100644 --- a/Terminal.Gui/App/ApplicationImpl.Run.cs +++ b/Terminal.Gui/App/ApplicationImpl.Run.cs @@ -198,11 +198,11 @@ public partial class ApplicationImpl SessionToken rs = Begin (view); - Current.Running = true; + Current.IsRunning = true; var firstIteration = true; - while (SessionStack.TryPeek (out Toplevel? found) && found == view && view.Running) + while (SessionStack.TryPeek (out Toplevel? found) && found == view && view.IsRunning) { if (Coordinator is null) { @@ -302,7 +302,7 @@ public partial class ApplicationImpl return; } - top.Running = false; + top.IsRunning = false; } /// @@ -327,7 +327,7 @@ public partial class ApplicationImpl public void Invoke (Action? action) { // If we are already on the main UI thread - if (Current is { Running: true } && MainThreadId == Thread.CurrentThread.ManagedThreadId) + if (Current is { IsRunning: true } && MainThreadId == Thread.CurrentThread.ManagedThreadId) { action?.Invoke (this); @@ -350,7 +350,7 @@ public partial class ApplicationImpl public void Invoke (Action action) { // If we are already on the main UI thread - if (Current is { Running: true } && MainThreadId == Thread.CurrentThread.ManagedThreadId) + if (Current is { IsRunning: true } && MainThreadId == Thread.CurrentThread.ManagedThreadId) { action?.Invoke (); diff --git a/Terminal.Gui/App/IApplication.cs b/Terminal.Gui/App/IApplication.cs index c02563170..d1f2d6dfd 100644 --- a/Terminal.Gui/App/IApplication.cs +++ b/Terminal.Gui/App/IApplication.cs @@ -313,7 +313,7 @@ public interface IApplication /// /// This will cause to return. /// - /// Calling is equivalent to setting the + /// Calling is equivalent to setting the /// property on the specified to . /// /// diff --git a/Terminal.Gui/Views/Toplevel.cs b/Terminal.Gui/Views/Toplevel.cs index fedc501f4..5d749f302 100644 --- a/Terminal.Gui/Views/Toplevel.cs +++ b/Terminal.Gui/Views/Toplevel.cs @@ -8,7 +8,7 @@ namespace Terminal.Gui.Views; /// /// Toplevel views can run as modal (popup) views, started by calling /// . They return control to the caller when -/// has been called (which sets the +/// has been called (which sets the /// property to false). /// /// @@ -83,7 +83,7 @@ public partial class Toplevel : View // TODO: IRunnable: Re-implement as a property on IRunnable /// Gets or sets whether the main loop for this is running or not. /// Setting this property directly is discouraged. Use instead. - public bool Running { get; set; } + public bool IsRunning { get; set; } // TODO: IRunnable: Re-implement in IRunnable /// diff --git a/Tests/IntegrationTests/FluentTests/GuiTestContextKeyEventTests.cs b/Tests/IntegrationTests/FluentTests/GuiTestContextKeyEventTests.cs index 51097c74c..dd26e1f09 100644 --- a/Tests/IntegrationTests/FluentTests/GuiTestContextKeyEventTests.cs +++ b/Tests/IntegrationTests/FluentTests/GuiTestContextKeyEventTests.cs @@ -16,11 +16,11 @@ public class GuiTestContextKeyEventTests (ITestOutputHelper outputHelper) public void QuitKey_ViaApplication_Stops (TestDriver d) { using GuiTestContext context = With.A (40, 10, d); - Assert.True (context.App?.Current!.Running); + Assert.True (context.App?.Current!.IsRunning); Toplevel? top = context.App?.Current; context.Then ((_) => context!.App?.Keyboard.RaiseKeyDownEvent (Application.QuitKey)); - Assert.False (top!.Running); + Assert.False (top!.IsRunning); } [Theory] @@ -28,12 +28,12 @@ public class GuiTestContextKeyEventTests (ITestOutputHelper outputHelper) public void QuitKey_ViaEnqueueKey_Stops (TestDriver d) { using GuiTestContext context = With.A (40, 10, d, _out); - Assert.True (context.App?.Current!.Running); + Assert.True (context.App?.Current!.IsRunning); Toplevel? top = context.App?.Current; context.EnqueueKeyEvent (Application.QuitKey); - Assert.False (top!.Running); + Assert.False (top!.IsRunning); } [Theory] diff --git a/Tests/IntegrationTests/FluentTests/GuiTestContextTests.cs b/Tests/IntegrationTests/FluentTests/GuiTestContextTests.cs index 30ea80cd8..37439b28a 100644 --- a/Tests/IntegrationTests/FluentTests/GuiTestContextTests.cs +++ b/Tests/IntegrationTests/FluentTests/GuiTestContextTests.cs @@ -43,7 +43,7 @@ public class GuiTestContextTests (ITestOutputHelper outputHelper) public void With_New_A_Runs (TestDriver d) { using GuiTestContext context = With.A (40, 10, d, _out); - Assert.True (context.App!.Current!.Running); + Assert.True (context.App!.Current!.IsRunning); Assert.NotEqual (Rectangle.Empty, context.App!.Screen); } diff --git a/Tests/IntegrationTests/FluentTests/MenuBarv2Tests.cs b/Tests/IntegrationTests/FluentTests/MenuBarv2Tests.cs index bc96b6f95..d3091f9aa 100644 --- a/Tests/IntegrationTests/FluentTests/MenuBarv2Tests.cs +++ b/Tests/IntegrationTests/FluentTests/MenuBarv2Tests.cs @@ -434,11 +434,11 @@ public class MenuBarv2Tests .ScreenShot ("MenuBar initial state", _out) .EnqueueKeyEvent (MenuBarv2.DefaultKey) .AssertEqual ("_New file", app.Navigation!.GetFocused ()!.Title) - .AssertTrue (app?.Current!.Running) + .AssertTrue (app?.Current!.IsRunning) .ScreenShot ($"After {MenuBarv2.DefaultKey}", _out) .EnqueueKeyEvent (Application.QuitKey) .AssertFalse (app?.Popover?.GetActivePopover () is PopoverMenu) - .AssertTrue (app!.Current!.Running); + .AssertTrue (app!.Current!.IsRunning); } [Theory] @@ -480,7 +480,7 @@ public class MenuBarv2Tests .ScreenShot ($"After {MenuBarv2.DefaultKey}", _out) .EnqueueKeyEvent (Application.QuitKey) .AssertFalse (app?.Popover?.GetActivePopover () is PopoverMenu) - .AssertTrue (app?.Current!.Running); + .AssertTrue (app?.Current!.IsRunning); } [Theory] diff --git a/Tests/IntegrationTests/FluentTests/PopverMenuTests.cs b/Tests/IntegrationTests/FluentTests/PopverMenuTests.cs index 83a173944..6efe81fe1 100644 --- a/Tests/IntegrationTests/FluentTests/PopverMenuTests.cs +++ b/Tests/IntegrationTests/FluentTests/PopverMenuTests.cs @@ -139,7 +139,7 @@ public class PopoverMenuTests .ScreenShot ($"After {Application.QuitKey}", _out) .AssertFalse (app?.Popover!.Popovers.Cast ().FirstOrDefault ()!.Visible) .AssertNull (app?.Popover!.GetActivePopover ()) - .AssertTrue (app?.Current!.Running); + .AssertTrue (app?.Current!.IsRunning); } [Theory] @@ -231,11 +231,11 @@ public class PopoverMenuTests .Then ((_) => app?.Popover!.Show (app?.Popover.Popovers.First ())) .ScreenShot ("PopoverMenu after Show", _out) .AssertEqual ("Cu_t", app?.Navigation!.GetFocused ()!.Title) - .AssertTrue (app?.Current!.Running) + .AssertTrue (app?.Current!.IsRunning) .EnqueueKeyEvent (Application.QuitKey) .ScreenShot ($"After {Application.QuitKey}", _out) .AssertFalse (app?.Popover?.GetActivePopover () is PopoverMenu) - .AssertTrue (app?.Current!.Running); + .AssertTrue (app?.Current!.IsRunning); } [Theory] diff --git a/Tests/StressTests/ApplicationStressTests.cs b/Tests/StressTests/ApplicationStressTests.cs index 0feadf210..c87927a45 100644 --- a/Tests/StressTests/ApplicationStressTests.cs +++ b/Tests/StressTests/ApplicationStressTests.cs @@ -72,7 +72,7 @@ public class ApplicationStressTests int tbNow = _tbCounter; // Wait for Application.Current to be running to ensure timed events can be processed - while (Application.Current is null || Application.Current is { Running: false }) + while (Application.Current is null || Application.Current is { IsRunning: false }) { Thread.Sleep (1); } diff --git a/Tests/UnitTests/Application/ApplicationImplBeginEndTests.cs b/Tests/UnitTests/Application/ApplicationImplBeginEndTests.cs index da9faad9d..9092200aa 100644 --- a/Tests/UnitTests/Application/ApplicationImplBeginEndTests.cs +++ b/Tests/UnitTests/Application/ApplicationImplBeginEndTests.cs @@ -385,14 +385,14 @@ public class ApplicationImplBeginEndTests try { - toplevel1 = new() { Id = "1", Running = true }; - toplevel2 = new() { Id = "2", Running = true }; + toplevel1 = new() { Id = "1", IsRunning = true }; + toplevel2 = new() { Id = "2", IsRunning = true }; app.Begin (toplevel1); app.Begin (toplevel2); - Assert.True (toplevel1.Running); - Assert.True (toplevel2.Running); + Assert.True (toplevel1.IsRunning); + Assert.True (toplevel2.IsRunning); } finally { @@ -404,8 +404,8 @@ public class ApplicationImplBeginEndTests app.Shutdown (); // Verify toplevels were stopped - Assert.False (toplevel1!.Running); - Assert.False (toplevel2!.Running); + Assert.False (toplevel1!.IsRunning); + Assert.False (toplevel2!.IsRunning); } } diff --git a/Tests/UnitTests/Application/ApplicationImplTests.cs b/Tests/UnitTests/Application/ApplicationImplTests.cs index faa4cf7a8..e9ac29e76 100644 --- a/Tests/UnitTests/Application/ApplicationImplTests.cs +++ b/Tests/UnitTests/Application/ApplicationImplTests.cs @@ -122,7 +122,7 @@ public class ApplicationImplTests TimeSpan.FromMilliseconds (150), () => { - Assert.True (top!.Running); + Assert.True (top!.IsRunning); if (app.Current != null) { @@ -135,7 +135,7 @@ public class ApplicationImplTests } ); - Assert.False (top!.Running); + Assert.False (top!.IsRunning); // Blocks until the timeout call is hit app.Run (top); @@ -143,7 +143,7 @@ public class ApplicationImplTests // We returned false above, so we should not have to remove the timeout Assert.False (app.RemoveTimeout (timeoutToken)); - Assert.False (top!.Running); + Assert.False (top!.IsRunning); // BUGBUG: Shutdown sets Top to null, not End. //Assert.Null (Application.Current); @@ -226,7 +226,7 @@ public class ApplicationImplTests TimeSpan.FromMilliseconds (150), () => { - Assert.True (top!.Running); + Assert.True (top!.IsRunning); if (app.Current != null) { @@ -273,7 +273,7 @@ public class ApplicationImplTests TimeSpan.FromMilliseconds (150), () => { - Assert.True (top!.Running); + Assert.True (top!.IsRunning); if (app.Current != null) { @@ -284,7 +284,7 @@ public class ApplicationImplTests } ); - Assert.False (top!.Running); + Assert.False (top!.IsRunning); // Blocks until the timeout call is hit app.Run (top); @@ -292,7 +292,7 @@ public class ApplicationImplTests // We returned false above, so we should not have to remove the timeout Assert.False (app.RemoveTimeout (timeoutToken)); - Assert.False (top!.Running); + Assert.False (top!.IsRunning); Assert.NotNull (app.Current); top.Dispose (); diff --git a/Tests/UnitTests/Application/ApplicationTests.cs b/Tests/UnitTests/Application/ApplicationTests.cs index f9230fccd..549d3c233 100644 --- a/Tests/UnitTests/Application/ApplicationTests.cs +++ b/Tests/UnitTests/Application/ApplicationTests.cs @@ -660,8 +660,8 @@ public class ApplicationTests void OnApplicationOnIteration (object s, IterationEventArgs a) { - Assert.True (top.Running); - top.Running = false; + Assert.True (top.IsRunning); + top.IsRunning = false; } } @@ -681,7 +681,7 @@ public class ApplicationTests return; - void OnApplicationOnIteration (object s, IterationEventArgs a) { top.Running = false; } + void OnApplicationOnIteration (object s, IterationEventArgs a) { top.IsRunning = false; } } [Fact] @@ -893,7 +893,7 @@ public class ApplicationTests Application.Run (); Assert.NotNull (Application.Driver); Assert.NotNull (Application.Current); - Assert.False (Application.Current!.Running); + Assert.False (Application.Current!.IsRunning); Application.Current!.Dispose (); Application.Shutdown (); } diff --git a/Tests/UnitTests/Application/SynchronizatonContextTests.cs b/Tests/UnitTests/Application/SynchronizatonContextTests.cs index 915cb3024..119cd3147 100644 --- a/Tests/UnitTests/Application/SynchronizatonContextTests.cs +++ b/Tests/UnitTests/Application/SynchronizatonContextTests.cs @@ -39,7 +39,7 @@ public class SyncrhonizationContextTests Task.Run (() => { - while (Application.Current is null || Application.Current is { Running: false }) + while (Application.Current is null || Application.Current is { IsRunning: false }) { Thread.Sleep (500); } @@ -56,7 +56,7 @@ public class SyncrhonizationContextTests null ); - if (Application.Current is { Running: true }) + if (Application.Current is { IsRunning: true }) { Assert.False (success); } diff --git a/Tests/UnitTests/View/SubviewTests.cs b/Tests/UnitTests/View/SubviewTests.cs index 2da6f6065..aade2d364 100644 --- a/Tests/UnitTests/View/SubviewTests.cs +++ b/Tests/UnitTests/View/SubviewTests.cs @@ -101,7 +101,7 @@ public class SubViewTests v1.Add (sv1); Application.LayoutAndDraw (); - t.Running = false; + t.IsRunning = false; } } } diff --git a/Tests/UnitTests/Views/ToplevelTests.cs b/Tests/UnitTests/Views/ToplevelTests.cs index 365ebd8bf..8ac269938 100644 --- a/Tests/UnitTests/Views/ToplevelTests.cs +++ b/Tests/UnitTests/Views/ToplevelTests.cs @@ -10,7 +10,7 @@ public class ToplevelTests Assert.Equal ("Toplevel", top.SchemeName); Assert.Equal ("Fill(Absolute(0))", top.Width.ToString ()); Assert.Equal ("Fill(Absolute(0))", top.Height.ToString ()); - Assert.False (top.Running); + Assert.False (top.IsRunning); Assert.False (top.Modal); Assert.Null (top.MenuBar);