|
@@ -1635,7 +1635,12 @@ namespace Terminal.Gui {
|
|
|
/// <summary>
|
|
|
/// Initializes the Application
|
|
|
/// </summary>
|
|
|
- public static void Init ()
|
|
|
+ public static void Init () => Init (() => Toplevel.Create ());
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Initializes the Application
|
|
|
+ /// </summary>
|
|
|
+ static void Init (Func<Toplevel> topLevelFactory)
|
|
|
{
|
|
|
if (Top != null)
|
|
|
return;
|
|
@@ -1657,7 +1662,7 @@ namespace Terminal.Gui {
|
|
|
Driver.Init (TerminalResized);
|
|
|
MainLoop = new Mono.Terminal.MainLoop (mainLoopDriver);
|
|
|
SynchronizationContext.SetSynchronizationContext (new MainLoopSyncContext (MainLoop));
|
|
|
- Top = Toplevel.Create ();
|
|
|
+ Top = topLevelFactory ();
|
|
|
Current = Top;
|
|
|
}
|
|
|
|
|
@@ -1948,6 +1953,15 @@ namespace Terminal.Gui {
|
|
|
Run (Top);
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Runs the application with a new instance of the specified toplevel view
|
|
|
+ /// </summary>
|
|
|
+ public static void Run<T> () where T : Toplevel, new()
|
|
|
+ {
|
|
|
+ Init (() => new T());
|
|
|
+ Run (Top);
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// Runs the main loop on the given container.
|
|
|
/// </summary>
|