|
@@ -6,34 +6,22 @@
|
|
|
|
|
|
|
|
using Terminal.Gui.App;
|
|
using Terminal.Gui.App;
|
|
|
using Terminal.Gui.Configuration;
|
|
using Terminal.Gui.Configuration;
|
|
|
-using Terminal.Gui.Examples;
|
|
|
|
|
using Terminal.Gui.ViewBase;
|
|
using Terminal.Gui.ViewBase;
|
|
|
using Terminal.Gui.Views;
|
|
using Terminal.Gui.Views;
|
|
|
|
|
|
|
|
-[assembly: ExampleMetadata ("Simple Example", "A basic login form demonstrating Terminal.Gui fundamentals")]
|
|
|
|
|
-[assembly: ExampleCategory ("Getting Started")]
|
|
|
|
|
-[assembly: ExampleDemoKeyStrokes (KeyStrokes = ["a", "d", "m", "i", "n", "Tab", "p", "a", "s", "s", "w", "o", "r", "d", "Enter"], DelayMs = 500, Order = 1)]
|
|
|
|
|
-[assembly: ExampleDemoKeyStrokes (KeyStrokes = ["Enter"], DelayMs = 500, Order = 2)]
|
|
|
|
|
-[assembly: ExampleDemoKeyStrokes (KeyStrokes = ["Esc"], DelayMs = 100, Order = 3)]
|
|
|
|
|
|
|
+// Example metadata
|
|
|
|
|
+[assembly: Terminal.Gui.Examples.ExampleMetadata ("Simple Example", "A basic login form demonstrating Terminal.Gui fundamentals")]
|
|
|
|
|
+[assembly: Terminal.Gui.Examples.ExampleCategory ("Getting Started")]
|
|
|
|
|
+[assembly: Terminal.Gui.Examples.ExampleDemoKeyStrokes (KeyStrokes = ["SetDelay:500", "a", "d", "m", "i", "n", "Tab", "p", "a", "s", "s", "w", "o", "r", "d", "Enter"], Order = 1)]
|
|
|
|
|
+[assembly: Terminal.Gui.Examples.ExampleDemoKeyStrokes (KeyStrokes = ["SetDelay:500", "Enter"], Order = 2)]
|
|
|
|
|
+[assembly: Terminal.Gui.Examples.ExampleDemoKeyStrokes (KeyStrokes = ["SetDelay:100", "Esc"], Order = 3)]
|
|
|
|
|
|
|
|
// Override the default configuration for the application to use the Light theme
|
|
// Override the default configuration for the application to use the Light theme
|
|
|
ConfigurationManager.RuntimeConfig = """{ "Theme": "Light" }""";
|
|
ConfigurationManager.RuntimeConfig = """{ "Theme": "Light" }""";
|
|
|
ConfigurationManager.Enable (ConfigLocations.All);
|
|
ConfigurationManager.Enable (ConfigLocations.All);
|
|
|
|
|
|
|
|
-// Check for test context to determine driver
|
|
|
|
|
-string? contextJson = Environment.GetEnvironmentVariable (ExampleContext.ENVIRONMENT_VARIABLE_NAME);
|
|
|
|
|
-string? driverName = null;
|
|
|
|
|
-var isExample = false;
|
|
|
|
|
-
|
|
|
|
|
-if (!string.IsNullOrEmpty (contextJson))
|
|
|
|
|
-{
|
|
|
|
|
- ExampleContext? context = ExampleContext.FromJson (contextJson);
|
|
|
|
|
- driverName = context?.DriverName;
|
|
|
|
|
- isExample = true;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-IApplication app = Application.Create (example: isExample);
|
|
|
|
|
-app.Init (driverName);
|
|
|
|
|
|
|
+IApplication app = Application.Create (example: true);
|
|
|
|
|
+app.Init ();
|
|
|
app.Run<ExampleWindow> ();
|
|
app.Run<ExampleWindow> ();
|
|
|
|
|
|
|
|
// Dispose the app to clean up and enable Console.WriteLine below
|
|
// Dispose the app to clean up and enable Console.WriteLine below
|