|
@@ -165,7 +165,7 @@ public static partial class Application
|
|
Colors.Reset ();
|
|
Colors.Reset ();
|
|
|
|
|
|
// Reset synchronization context to allow the user to run async/await,
|
|
// Reset synchronization context to allow the user to run async/await,
|
|
- // as the main loop has been ended, the synchronization context from
|
|
|
|
|
|
+ // as the main loop has been ended, the synchronization context from
|
|
// gui.cs does no longer process any callbacks. See #1084 for more details:
|
|
// gui.cs does no longer process any callbacks. See #1084 for more details:
|
|
// (https://github.com/gui-cs/Terminal.Gui/issues/1084).
|
|
// (https://github.com/gui-cs/Terminal.Gui/issues/1084).
|
|
SynchronizationContext.SetSynchronizationContext (null);
|
|
SynchronizationContext.SetSynchronizationContext (null);
|
|
@@ -211,11 +211,11 @@ public static partial class Application
|
|
// INTERNAL function for initializing an app with a Toplevel factory object, driver, and mainloop.
|
|
// INTERNAL function for initializing an app with a Toplevel factory object, driver, and mainloop.
|
|
//
|
|
//
|
|
// Called from:
|
|
// Called from:
|
|
- //
|
|
|
|
|
|
+ //
|
|
// Init() - When the user wants to use the default Toplevel. calledViaRunT will be false, causing all state to be reset.
|
|
// Init() - When the user wants to use the default Toplevel. calledViaRunT will be false, causing all state to be reset.
|
|
// Run<T>() - When the user wants to use a custom Toplevel. calledViaRunT will be true, enabling Run<T>() to be called without calling Init first.
|
|
// Run<T>() - When the user wants to use a custom Toplevel. calledViaRunT will be true, enabling Run<T>() to be called without calling Init first.
|
|
// Unit Tests - To initialize the app with a custom Toplevel, using the FakeDriver. calledViaRunT will be false, causing all state to be reset.
|
|
// Unit Tests - To initialize the app with a custom Toplevel, using the FakeDriver. calledViaRunT will be false, causing all state to be reset.
|
|
- //
|
|
|
|
|
|
+ //
|
|
// calledViaRunT: If false (default) all state will be reset. If true the state will not be reset.
|
|
// calledViaRunT: If false (default) all state will be reset. If true the state will not be reset.
|
|
[RequiresUnreferencedCode ("AOT")]
|
|
[RequiresUnreferencedCode ("AOT")]
|
|
[RequiresDynamicCode ("AOT")]
|
|
[RequiresDynamicCode ("AOT")]
|
|
@@ -250,7 +250,7 @@ public static partial class Application
|
|
// Start the process of configuration management.
|
|
// Start the process of configuration management.
|
|
// Note that we end up calling LoadConfigurationFromAllSources
|
|
// Note that we end up calling LoadConfigurationFromAllSources
|
|
// multiple times. We need to do this because some settings are only
|
|
// multiple times. We need to do this because some settings are only
|
|
- // valid after a Driver is loaded. In this cases we need just
|
|
|
|
|
|
+ // valid after a Driver is loaded. In this case we need just
|
|
// `Settings` so we can determine which driver to use.
|
|
// `Settings` so we can determine which driver to use.
|
|
// Don't reset, so we can inherit the theme from the previous run.
|
|
// Don't reset, so we can inherit the theme from the previous run.
|
|
Load ();
|
|
Load ();
|
|
@@ -391,7 +391,7 @@ public static partial class Application
|
|
/// </remarks>
|
|
/// </remarks>
|
|
public static event EventHandler<RunStateEventArgs> NotifyNewRunState;
|
|
public static event EventHandler<RunStateEventArgs> NotifyNewRunState;
|
|
|
|
|
|
- /// <summary>Notify that a existent <see cref="RunState"/> is stopping (<see cref="End(RunState)"/> was called).</summary>
|
|
|
|
|
|
+ /// <summary>Notify that an existent <see cref="RunState"/> is stopping (<see cref="End(RunState)"/> was called).</summary>
|
|
/// <remarks>
|
|
/// <remarks>
|
|
/// If <see cref="EndAfterFirstIteration"/> is <see langword="true"/> callers to <see cref="Begin(Toplevel)"/>
|
|
/// If <see cref="EndAfterFirstIteration"/> is <see langword="true"/> callers to <see cref="Begin(Toplevel)"/>
|
|
/// must also subscribe to <see cref="NotifyStopRunState"/> and manually dispose of the <see cref="RunState"/> token
|
|
/// must also subscribe to <see cref="NotifyStopRunState"/> and manually dispose of the <see cref="RunState"/> token
|
|
@@ -471,7 +471,7 @@ public static partial class Application
|
|
Top.OnLeave (toplevel);
|
|
Top.OnLeave (toplevel);
|
|
}
|
|
}
|
|
|
|
|
|
- // BUGBUG: We should not depend on `Id` internally.
|
|
|
|
|
|
+ // BUGBUG: We should not depend on `Id` internally.
|
|
// BUGBUG: It is super unclear what this code does anyway.
|
|
// BUGBUG: It is super unclear what this code does anyway.
|
|
if (string.IsNullOrEmpty (toplevel.Id))
|
|
if (string.IsNullOrEmpty (toplevel.Id))
|
|
{
|
|
{
|
|
@@ -859,7 +859,7 @@ public static partial class Application
|
|
}
|
|
}
|
|
|
|
|
|
// TODO: Determine if this is really needed. The only code that calls WakeUp I can find
|
|
// TODO: Determine if this is really needed. The only code that calls WakeUp I can find
|
|
- // is ProgressBarStyles and it's not clear it needs to.
|
|
|
|
|
|
+ // is ProgressBarStyles, and it's not clear it needs to.
|
|
/// <summary>Wakes up the running application that might be waiting on input.</summary>
|
|
/// <summary>Wakes up the running application that might be waiting on input.</summary>
|
|
public static void Wakeup () { MainLoop?.Wakeup (); }
|
|
public static void Wakeup () { MainLoop?.Wakeup (); }
|
|
|
|
|
|
@@ -1168,13 +1168,13 @@ public static partial class Application
|
|
runState.Toplevel.OnUnloaded ();
|
|
runState.Toplevel.OnUnloaded ();
|
|
}
|
|
}
|
|
|
|
|
|
- // End the RunState.Toplevel
|
|
|
|
|
|
+ // End the RunState.Toplevel
|
|
// First, take it off the Toplevel Stack
|
|
// First, take it off the Toplevel Stack
|
|
if (_topLevels.Count > 0)
|
|
if (_topLevels.Count > 0)
|
|
{
|
|
{
|
|
if (_topLevels.Peek () != runState.Toplevel)
|
|
if (_topLevels.Peek () != runState.Toplevel)
|
|
{
|
|
{
|
|
- // If there the top of the stack is not the RunState.Toplevel then
|
|
|
|
|
|
+ // If the top of the stack is not the RunState.Toplevel then
|
|
// this call to End is not balanced with the call to Begin that started the RunState
|
|
// this call to End is not balanced with the call to Begin that started the RunState
|
|
throw new ArgumentException ("End must be balanced with calls to Begin");
|
|
throw new ArgumentException ("End must be balanced with calls to Begin");
|
|
}
|
|
}
|
|
@@ -1185,8 +1185,8 @@ public static partial class Application
|
|
// Notify that it is closing
|
|
// Notify that it is closing
|
|
runState.Toplevel?.OnClosed (runState.Toplevel);
|
|
runState.Toplevel?.OnClosed (runState.Toplevel);
|
|
|
|
|
|
- // If there is a OverlappedTop that is not the RunState.Toplevel then runstate.TopLevel
|
|
|
|
- // is a child of MidTop and we should notify the OverlappedTop that it is closing
|
|
|
|
|
|
+ // If there is a OverlappedTop that is not the RunState.Toplevel then RunState.Toplevel
|
|
|
|
+ // is a child of MidTop, and we should notify the OverlappedTop that it is closing
|
|
if (OverlappedTop is { } && !runState.Toplevel.Modal && runState.Toplevel != OverlappedTop)
|
|
if (OverlappedTop is { } && !runState.Toplevel.Modal && runState.Toplevel != OverlappedTop)
|
|
{
|
|
{
|
|
OverlappedTop.OnChildClosed (runState.Toplevel);
|
|
OverlappedTop.OnChildClosed (runState.Toplevel);
|
|
@@ -1242,7 +1242,7 @@ public static partial class Application
|
|
|
|
|
|
/// <summary>Holds the stack of TopLevel views.</summary>
|
|
/// <summary>Holds the stack of TopLevel views.</summary>
|
|
|
|
|
|
- // BUGBUG: Techncally, this is not the full lst of TopLevels. THere be dragons hwre. E.g. see how Toplevel.Id is used. What
|
|
|
|
|
|
+ // BUGBUG: Technically, this is not the full lst of TopLevels. There be dragons here, e.g. see how Toplevel.Id is used. What
|
|
// about TopLevels that are just a SubView of another View?
|
|
// about TopLevels that are just a SubView of another View?
|
|
internal static readonly Stack<Toplevel> _topLevels = new ();
|
|
internal static readonly Stack<Toplevel> _topLevels = new ();
|
|
|
|
|