mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-02 01:03:29 +01:00
Rename IApplication.Current to TopRunnable
Co-authored-by: tig <585482+tig@users.noreply.github.com>
This commit is contained in:
@@ -13,7 +13,7 @@ internal class FakeApplicationLifecycle (CancellationTokenSource hardStop) : IDi
|
||||
{
|
||||
hardStop.Cancel ();
|
||||
|
||||
Application.Current?.Dispose ();
|
||||
Application.TopRunnable?.Dispose ();
|
||||
Application.Shutdown ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,13 +40,13 @@ public partial class GuiTestContext
|
||||
public GuiTestContext Focus<T> (Func<T, bool>? evaluator = null) where T : View
|
||||
{
|
||||
evaluator ??= _ => true;
|
||||
Toplevel? t = App?.Current;
|
||||
Toplevel? t = App?.TopRunnable;
|
||||
|
||||
HashSet<View> seen = new ();
|
||||
|
||||
if (t == null)
|
||||
{
|
||||
Fail ("Application.Current was null when trying to set focus");
|
||||
Fail ("Application.TopRunnable was null when trying to set focus");
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ public partial class GuiTestContext
|
||||
{
|
||||
WaitIteration ((app) =>
|
||||
{
|
||||
Toplevel top = app.Current ?? throw new ("Top was null so could not add view");
|
||||
Toplevel top = app.TopRunnable ?? throw new ("Top was null so could not add view");
|
||||
top.Add (v);
|
||||
top.Layout ();
|
||||
_lastView = v;
|
||||
@@ -28,15 +28,15 @@ public partial class GuiTestContext
|
||||
/// <summary>
|
||||
/// The last view added (e.g. with <see cref="Add"/>) or the root/current top.
|
||||
/// </summary>
|
||||
public View LastView => _lastView ?? App?.Current ?? throw new ("Could not determine which view to add to");
|
||||
public View LastView => _lastView ?? App?.TopRunnable ?? throw new ("Could not determine which view to add to");
|
||||
|
||||
private T Find<T> (Func<T, bool> evaluator) where T : View
|
||||
{
|
||||
Toplevel? t = App?.Current;
|
||||
Toplevel? t = App?.TopRunnable;
|
||||
|
||||
if (t == null)
|
||||
{
|
||||
Fail ("App.Current was null when attempting to find view");
|
||||
Fail ("App.TopRunnable was null when attempting to find view");
|
||||
}
|
||||
|
||||
T? f = FindRecursive (t!, evaluator);
|
||||
|
||||
Reference in New Issue
Block a user