|
3 | 3 |
|
4 | 4 | using Terminal.Gui.App; |
5 | 5 | using Terminal.Gui.Drawing; |
6 | | -using Terminal.Gui.Examples; |
7 | 6 | using Terminal.Gui.ViewBase; |
8 | 7 | using Terminal.Gui.Views; |
9 | 8 |
|
10 | | -[assembly: ExampleMetadata ("Runnable Wrapper Example", "Shows how to wrap any View to make it runnable without implementing IRunnable")] |
11 | | -[assembly: ExampleCategory ("API Patterns")] |
12 | | -[assembly: ExampleCategory ("Views")] |
13 | | -[assembly: ExampleDemoKeyStrokes (KeyStrokes = ["t", "e", "s", "t", "Esc"], Order = 1)] |
14 | | -[assembly: ExampleDemoKeyStrokes (KeyStrokes = ["Enter", "Esc"], DelayMs = 100, Order = 2)] |
15 | | -[assembly: ExampleDemoKeyStrokes (KeyStrokes = ["Enter", "Esc"], DelayMs = 100, Order = 3)] |
16 | | -[assembly: ExampleDemoKeyStrokes (KeyStrokes = ["Enter", "Esc"], DelayMs = 100, Order = 4)] |
17 | | -[assembly: ExampleDemoKeyStrokes (KeyStrokes = ["Enter", "Esc"], DelayMs = 100, Order = 5)] |
18 | | - |
19 | | -// Check for test context to determine driver |
20 | | -string? contextJson = Environment.GetEnvironmentVariable (ExampleContext.ENVIRONMENT_VARIABLE_NAME); |
21 | | -string? driverName = null; |
22 | | -var isExample = false; |
23 | | - |
24 | | -if (!string.IsNullOrEmpty (contextJson)) |
25 | | -{ |
26 | | - ExampleContext? context = ExampleContext.FromJson (contextJson); |
27 | | - driverName = context?.DriverName; |
28 | | - isExample = true; |
29 | | -} |
30 | | - |
31 | | -IApplication app = Application.Create (example: isExample); |
32 | | -app.Init (driverName); |
| 9 | +// Example metadata |
| 10 | +[assembly: Terminal.Gui.Examples.ExampleMetadata ("Runnable Wrapper Example", "Shows how to wrap any View to make it runnable without implementing IRunnable")] |
| 11 | +[assembly: Terminal.Gui.Examples.ExampleCategory ("API Patterns")] |
| 12 | +[assembly: Terminal.Gui.Examples.ExampleCategory ("Views")] |
| 13 | +[assembly: Terminal.Gui.Examples.ExampleDemoKeyStrokes (KeyStrokes = ["t", "e", "s", "t", "Esc"], Order = 1)] |
| 14 | +[assembly: Terminal.Gui.Examples.ExampleDemoKeyStrokes (KeyStrokes = ["SetDelay:100", "Enter", "Esc"], Order = 2)] |
| 15 | +[assembly: Terminal.Gui.Examples.ExampleDemoKeyStrokes (KeyStrokes = ["SetDelay:100", "Enter", "Esc"], Order = 3)] |
| 16 | +[assembly: Terminal.Gui.Examples.ExampleDemoKeyStrokes (KeyStrokes = ["SetDelay:100", "Enter", "Esc"], Order = 4)] |
| 17 | +[assembly: Terminal.Gui.Examples.ExampleDemoKeyStrokes (KeyStrokes = ["SetDelay:100", "Enter", "Esc"], Order = 5)] |
| 18 | + |
| 19 | +IApplication app = Application.Create (example: true); |
| 20 | +app.Init (); |
33 | 21 |
|
34 | 22 | // Example 1: Use extension method with result extraction |
35 | 23 | var textField = new TextField { Width = 40, Text = "Default text" }; |
|
0 commit comments