|
@@ -5,7 +5,7 @@ using System.Reflection;
|
|
|
|
|
|
|
|
namespace Terminal.Gui.App;
|
|
namespace Terminal.Gui.App;
|
|
|
|
|
|
|
|
-public static partial class Application // Initialization (Init/Shutdown)
|
|
|
|
|
|
|
+public static partial class Application // Lifecycle (Init/Shutdown)
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
/// <summary>Initializes a new instance of a Terminal.Gui Application. <see cref="Shutdown"/> must be called when the application is closing.</summary>
|
|
/// <summary>Initializes a new instance of a Terminal.Gui Application. <see cref="Shutdown"/> must be called when the application is closing.</summary>
|
|
@@ -24,7 +24,7 @@ public static partial class Application // Initialization (Init/Shutdown)
|
|
|
/// The <see cref="Run{T}"/> function combines
|
|
/// The <see cref="Run{T}"/> function combines
|
|
|
/// <see cref="Init(IConsoleDriver,string)"/> and <see cref="Run(Toplevel, Func{Exception, bool})"/>
|
|
/// <see cref="Init(IConsoleDriver,string)"/> and <see cref="Run(Toplevel, Func{Exception, bool})"/>
|
|
|
/// into a single
|
|
/// into a single
|
|
|
- /// call. An application cam use <see cref="Run{T}"/> without explicitly calling
|
|
|
|
|
|
|
+ /// call. An application can use <see cref="Run{T}"/> without explicitly calling
|
|
|
/// <see cref="Init(IConsoleDriver,string)"/>.
|
|
/// <see cref="Init(IConsoleDriver,string)"/>.
|
|
|
/// </para>
|
|
/// </para>
|
|
|
/// <param name="driver">
|
|
/// <param name="driver">
|
|
@@ -118,28 +118,9 @@ public static partial class Application // Initialization (Init/Shutdown)
|
|
|
// or go through the modern application architecture
|
|
// or go through the modern application architecture
|
|
|
if (Driver is null)
|
|
if (Driver is null)
|
|
|
{
|
|
{
|
|
|
- //// Try to find a legacy IConsoleDriver type that matches the driver name
|
|
|
|
|
- //bool useLegacyDriver = false;
|
|
|
|
|
- //if (!string.IsNullOrEmpty (ForceDriver))
|
|
|
|
|
- //{
|
|
|
|
|
- // (List<Type?> drivers, List<string?> driverTypeNames) = GetDriverTypes ();
|
|
|
|
|
- // Type? driverType = drivers.FirstOrDefault (t => t!.Name.Equals (ForceDriver, StringComparison.InvariantCultureIgnoreCase));
|
|
|
|
|
-
|
|
|
|
|
- // if (driverType is { } && !typeof (IConsoleDriverFacade).IsAssignableFrom (driverType))
|
|
|
|
|
- // {
|
|
|
|
|
- // // This is a legacy driver (not a ConsoleDriverFacade)
|
|
|
|
|
- // Driver = (IConsoleDriver)Activator.CreateInstance (driverType)!;
|
|
|
|
|
- // useLegacyDriver = true;
|
|
|
|
|
- // }
|
|
|
|
|
- //}
|
|
|
|
|
-
|
|
|
|
|
- //// Use the modern application architecture
|
|
|
|
|
- //if (!useLegacyDriver)
|
|
|
|
|
- {
|
|
|
|
|
- ApplicationImpl.Instance.Init (driver, driverName);
|
|
|
|
|
- Debug.Assert (Driver is { });
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ ApplicationImpl.Instance.Init (driver, driverName);
|
|
|
|
|
+ Debug.Assert (Driver is { });
|
|
|
|
|
+ return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Debug.Assert (Navigation is null);
|
|
Debug.Assert (Navigation is null);
|
|
@@ -203,7 +184,7 @@ public static partial class Application // Initialization (Init/Shutdown)
|
|
|
private static void Driver_KeyUp (object? sender, Key e) { RaiseKeyUpEvent (e); }
|
|
private static void Driver_KeyUp (object? sender, Key e) { RaiseKeyUpEvent (e); }
|
|
|
private static void Driver_MouseEvent (object? sender, MouseEventArgs e) { RaiseMouseEvent (e); }
|
|
private static void Driver_MouseEvent (object? sender, MouseEventArgs e) { RaiseMouseEvent (e); }
|
|
|
|
|
|
|
|
- /// <summary>Gets of list of <see cref="IConsoleDriver"/> types and type names that are available.</summary>
|
|
|
|
|
|
|
+ /// <summary>Gets a list of <see cref="IConsoleDriver"/> types and type names that are available.</summary>
|
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
|
[RequiresUnreferencedCode ("AOT")]
|
|
[RequiresUnreferencedCode ("AOT")]
|
|
|
public static (List<Type?>, List<string?>) GetDriverTypes ()
|
|
public static (List<Type?>, List<string?>) GetDriverTypes ()
|
|
@@ -229,8 +210,6 @@ public static partial class Application // Initialization (Init/Shutdown)
|
|
|
.Union (["dotnet", "windows", "unix", "fake"])
|
|
.Union (["dotnet", "windows", "unix", "fake"])
|
|
|
.ToList ()!;
|
|
.ToList ()!;
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
return (driverTypes, driverTypeNames);
|
|
return (driverTypes, driverTypeNames);
|
|
|
}
|
|
}
|
|
|
|
|
|