mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Removed un-needed and un-used RequestStop override from Scenario
This commit is contained in:
@@ -6,9 +6,11 @@
|
||||
using System;
|
||||
using Terminal.Gui;
|
||||
|
||||
Application.Run<ExampleWindow> ();
|
||||
var app = Application.Run<ExampleWindow> ();
|
||||
|
||||
Console.WriteLine ($"Username: {((ExampleWindow)Application.Top).UserNameText.Text}");
|
||||
Console.WriteLine ($"Username: {app.UserNameText.Text}");
|
||||
|
||||
app.Dispose ();
|
||||
|
||||
// Before the application exits, reset Terminal.Gui for clean shutdown
|
||||
Application.Shutdown ();
|
||||
|
||||
@@ -587,10 +587,10 @@ public static partial class Application
|
||||
/// <see langword="null"/> if <see cref="Init"/> has already been called.
|
||||
/// </param>
|
||||
/// <returns>The created T object. The caller is responsible for disposing this object.</returns>
|
||||
public static Toplevel Run<T> (Func<Exception, bool> errorHandler = null, ConsoleDriver driver = null)
|
||||
public static T Run<T> (Func<Exception, bool> errorHandler = null, ConsoleDriver driver = null)
|
||||
where T : Toplevel, new()
|
||||
{
|
||||
var top = new T () as Toplevel;
|
||||
var top = new T ();
|
||||
|
||||
EnsureValidInitialization (top, driver);
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace UICatalog;
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The UI Catalog program uses reflection to find all scenarios and adds them to the ListViews. Press ENTER to
|
||||
/// run the selected scenario. Press the default quit key to quit. /
|
||||
/// run the selected scenario. Press the default quit key to quit.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <example>
|
||||
@@ -141,7 +141,7 @@ public class Scenario : IDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper that provides the default <see cref="Terminal.Gui.Window"/> implementation with a frame and label
|
||||
/// Helper that calls <see cref="Application.Init"/> and creates the default <see cref="Terminal.Gui.Window"/> implementation with a frame and label
|
||||
/// showing the name of the <see cref="Scenario"/> and logic to exit back to the Scenario picker UI. Override
|
||||
/// <see cref="Init"/> to provide any <see cref="Terminal.Gui.Toplevel"/> behavior needed.
|
||||
/// </summary>
|
||||
@@ -176,9 +176,6 @@ public class Scenario : IDisposable
|
||||
Top.Add (Win);
|
||||
}
|
||||
|
||||
/// <summary>Stops the scenario. Override to change shutdown behavior for the <see cref="Scenario"/>.</summary>
|
||||
public virtual void RequestStop () { Application.RequestStop (); }
|
||||
|
||||
/// <summary>
|
||||
/// Runs the <see cref="Scenario"/>. Override to start the <see cref="Scenario"/> using a <see cref="Toplevel"/>
|
||||
/// different than `Top`.
|
||||
|
||||
@@ -15,8 +15,9 @@ public class BackgroundWorkerCollection : Scenario
|
||||
{
|
||||
public override void Init ()
|
||||
{
|
||||
Application.Run<OverlappedMain> ();
|
||||
var main = Application.Run<OverlappedMain> ();
|
||||
|
||||
//main.Dispose ();
|
||||
Application.Top.Dispose ();
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public class ChineseUI : Scenario
|
||||
|
||||
if (result == 0)
|
||||
{
|
||||
RequestStop ();
|
||||
Application.RequestStop ();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -464,10 +464,6 @@ internal class UICatalogApp
|
||||
_selectedScenario = null;
|
||||
RequestStop ();
|
||||
}
|
||||
else
|
||||
{
|
||||
_selectedScenario.RequestStop ();
|
||||
}
|
||||
}
|
||||
),
|
||||
new (
|
||||
|
||||
Reference in New Issue
Block a user