diff --git a/UICatalog/Properties/launchSettings.json b/UICatalog/Properties/launchSettings.json
index f5f092229..3599a8810 100644
--- a/UICatalog/Properties/launchSettings.json
+++ b/UICatalog/Properties/launchSettings.json
@@ -23,10 +23,6 @@
"commandLineArgs": "dotnet UICatalog.dll --driver NetDriver",
"distributionName": ""
},
- "Buttons": {
- "commandName": "Project",
- "commandLineArgs": "Buttons"
- },
"WizardAsView": {
"commandName": "Project",
"commandLineArgs": "WizardAsView"
@@ -37,11 +33,11 @@
},
"Charmap": {
"commandName": "Project",
- "commandLineArgs": "\"Character Map\""
+ "commandLineArgs": "\"Character Map\" -b"
},
"All Views Tester": {
"commandName": "Project",
- "commandLineArgs": "\"All Views Tester\""
+ "commandLineArgs": "\"All Views Tester\" -b"
},
"Windows & FrameViews": {
"commandName": "Project",
@@ -73,6 +69,10 @@
"Benchmark All": {
"commandName": "Project",
"commandLineArgs": "--benchmark"
+ },
+ "ContextMenus": {
+ "commandName": "Project",
+ "commandLineArgs": "ContextMenus -b"
}
}
}
\ No newline at end of file
diff --git a/UICatalog/Scenario.cs b/UICatalog/Scenario.cs
index 3936ca1a6..c5dc1723c 100644
--- a/UICatalog/Scenario.cs
+++ b/UICatalog/Scenario.cs
@@ -25,12 +25,12 @@ namespace UICatalog;
/// -
///
/// Annotate the derived class with a
-/// attribute specifying the scenario's name and description.
+/// attribute specifying the scenario's name and description.
///
///
/// -
///
-/// Add one or more attributes to the class specifying
+/// Add one or more attributes to the class specifying
/// which categories the scenario belongs to. If you don't specify a category the scenario will show up
/// in "_All".
///
@@ -151,8 +151,9 @@ public class Scenario : IDisposable
///
public virtual void Main () { }
- private const uint ABORT_TIME = 1000;
- private const uint MAX_ITERATIONS = 500;
+ private const uint MAX_NATURAL_ITERATIONS = 100; // not including needed for demo keys
+ private const uint ABORT_TIMEOUT_MS = 5000;
+ private const int DEMO_KEY_PACING_MS = 1; // Must be non-zero
private readonly object _timeoutLock = new ();
private object? _timeout;
@@ -180,13 +181,16 @@ public class Scenario : IDisposable
return _benchmarkResults;
}
+ private List _demoKeys;
+ private int _currentDemoKey = 0;
+
private void OnApplicationOnInitializedChanged (object? s, EventArgs a)
{
if (a.CurrentValue)
{
lock (_timeoutLock!)
{
- _timeout = Application.AddTimeout (TimeSpan.FromMilliseconds (ABORT_TIME), ForceCloseCallback);
+ _timeout = Application.AddTimeout (TimeSpan.FromMilliseconds (ABORT_TIMEOUT_MS), ForceCloseCallback);
}
Application.Iteration += OnApplicationOnIteration;
@@ -202,6 +206,7 @@ public class Scenario : IDisposable
};
Application.NotifyNewRunState += OnApplicationNotifyNewRunState;
+
_stopwatch = Stopwatch.StartNew ();
}
else
@@ -216,7 +221,7 @@ public class Scenario : IDisposable
private void OnApplicationOnIteration (object? s, IterationEventArgs a)
{
BenchmarkResults.IterationCount++;
- if (BenchmarkResults.IterationCount > MAX_ITERATIONS)
+ if (BenchmarkResults.IterationCount > MAX_NATURAL_ITERATIONS + (_demoKeys.Count* DEMO_KEY_PACING_MS))
{
Application.RequestStop ();
}
@@ -237,6 +242,25 @@ public class Scenario : IDisposable
}
SubscribeAllSubviews (Application.Top!);
+
+ _currentDemoKey = 0;
+ _demoKeys = GetDemoKeyStrokes ();
+ _demoKeys.Add (Application.QuitKey);
+
+ Application.AddTimeout (
+ new TimeSpan (0, 0, 0, 0, DEMO_KEY_PACING_MS),
+ () =>
+ {
+ if (_currentDemoKey >= _demoKeys.Count)
+ {
+ return false;
+ }
+
+ Application.RaiseKeyDownEvent (_demoKeys [_currentDemoKey++]);
+
+ return true;
+ });
+
}
// If the scenario doesn't close within the abort time, this will force it to quit
@@ -250,7 +274,7 @@ public class Scenario : IDisposable
}
}
- Debug.WriteLine ($@" Failed to Quit with {Application.QuitKey} after {ABORT_TIME}ms and {BenchmarkResults.IterationCount} iterations. Force quit.");
+ Debug.WriteLine ($@" Failed to Quit with {Application.QuitKey} after {ABORT_TIMEOUT_MS}ms and {BenchmarkResults.IterationCount} iterations. Force quit.");
Application.RequestStop ();
@@ -298,7 +322,7 @@ public class Scenario : IDisposable
(current, attrs) => current
.Union (
attrs.Where (a => a is ScenarioCategory)
- .Select (a => ((Scenario.ScenarioCategory)a).Name))
+ .Select (a => ((ScenarioCategory)a).Name))
.ToList ());
// Sort
@@ -308,75 +332,9 @@ public class Scenario : IDisposable
categories.Insert (0, "All Scenarios");
return categories;
+
}
- /// Defines the category names used to categorize a
- [AttributeUsage (AttributeTargets.Class, AllowMultiple = true)]
- public class ScenarioCategory (string name) : System.Attribute
- {
- /// Static helper function to get the Categories given a Type
- ///
- /// list of category names
- public static List GetCategories (Type t)
- {
- return GetCustomAttributes (t)
- .ToList ()
- .Where (a => a is Scenario.ScenarioCategory)
- .Select (a => ((Scenario.ScenarioCategory)a).Name)
- .ToList ();
- }
+ public virtual List GetDemoKeyStrokes () => new List ();
- /// Static helper function to get the Name given a Type
- ///
- /// Name of the category
- public static string GetName (Type t)
- {
- if (GetCustomAttributes (t).FirstOrDefault (a => a is Scenario.ScenarioMetadata) is Scenario.ScenarioMetadata { } metadata)
- {
- return metadata.Name;
- }
-
- return string.Empty;
- }
-
- /// Category Name
- public string Name { get; set; } = name;
- }
-
- /// Defines the metadata (Name and Description) for a
- [AttributeUsage (AttributeTargets.Class)]
- public class ScenarioMetadata (string name, string description) : System.Attribute
- {
- /// Description
- public string Description { get; set; } = description;
-
- /// Static helper function to get the Description given a Type
- ///
- ///
- public static string GetDescription (Type t)
- {
- if (GetCustomAttributes (t).FirstOrDefault (a => a is Scenario.ScenarioMetadata) is Scenario.ScenarioMetadata { } metadata)
- {
- return metadata.Description;
- }
-
- return string.Empty;
- }
-
- /// Static helper function to get the Name given a Type
- ///
- ///
- public static string GetName (Type t)
- {
- if (GetCustomAttributes (t).FirstOrDefault (a => a is Scenario.ScenarioMetadata) is Scenario.ScenarioMetadata { } metadata)
- {
- return metadata.Name;
- }
-
- return string.Empty;
- }
-
- /// Name
- public string Name { get; set; } = name;
- }
-}
+}
\ No newline at end of file
diff --git a/UICatalog/ScenarioCategory.cs b/UICatalog/ScenarioCategory.cs
new file mode 100644
index 000000000..342974405
--- /dev/null
+++ b/UICatalog/ScenarioCategory.cs
@@ -0,0 +1,39 @@
+#nullable enable
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace UICatalog;
+
+/// Defines the category names used to categorize a
+[AttributeUsage (AttributeTargets.Class, AllowMultiple = true)]
+public class ScenarioCategory (string name) : System.Attribute
+{
+ /// Static helper function to get the Categories given a Type
+ ///
+ /// list of category names
+ public static List GetCategories (Type t)
+ {
+ return GetCustomAttributes (t)
+ .ToList ()
+ .Where (a => a is ScenarioCategory)
+ .Select (a => ((ScenarioCategory)a).Name)
+ .ToList ();
+ }
+
+ /// Static helper function to get the Name given a Type
+ ///
+ /// Name of the category
+ public static string GetName (Type t)
+ {
+ if (GetCustomAttributes (t).FirstOrDefault (a => a is ScenarioMetadata) is ScenarioMetadata { } metadata)
+ {
+ return metadata.Name;
+ }
+
+ return string.Empty;
+ }
+
+ /// Category Name
+ public string Name { get; set; } = name;
+}
diff --git a/UICatalog/ScenarioMetadata.cs b/UICatalog/ScenarioMetadata.cs
new file mode 100644
index 000000000..0e1ef4b16
--- /dev/null
+++ b/UICatalog/ScenarioMetadata.cs
@@ -0,0 +1,42 @@
+#nullable enable
+using System;
+using System.Linq;
+
+namespace UICatalog;
+
+/// Defines the metadata (Name and Description) for a
+[AttributeUsage (AttributeTargets.Class)]
+public class ScenarioMetadata (string name, string description) : System.Attribute
+{
+ /// Description
+ public string Description { get; set; } = description;
+
+ /// Static helper function to get the Description given a Type
+ ///
+ ///
+ public static string GetDescription (Type t)
+ {
+ if (GetCustomAttributes (t).FirstOrDefault (a => a is ScenarioMetadata) is ScenarioMetadata { } metadata)
+ {
+ return metadata.Description;
+ }
+
+ return string.Empty;
+ }
+
+ /// Static helper function to get the Name given a Type
+ ///
+ ///
+ public static string GetName (Type t)
+ {
+ if (GetCustomAttributes (t).FirstOrDefault (a => a is ScenarioMetadata) is ScenarioMetadata { } metadata)
+ {
+ return metadata.Name;
+ }
+
+ return string.Empty;
+ }
+
+ /// Name
+ public string Name { get; set; } = name;
+}
diff --git a/UICatalog/Scenarios/ASCIICustomButton.cs b/UICatalog/Scenarios/ASCIICustomButton.cs
index 2961be329..45889f3e8 100644
--- a/UICatalog/Scenarios/ASCIICustomButton.cs
+++ b/UICatalog/Scenarios/ASCIICustomButton.cs
@@ -7,8 +7,8 @@ using Terminal.Gui;
namespace UICatalog.Scenarios;
-[Scenario.ScenarioMetadata ("ASCIICustomButtonTest", "ASCIICustomButton sample")]
-[Scenario.ScenarioCategory ("Controls")]
+[ScenarioMetadata ("ASCIICustomButtonTest", "ASCIICustomButton sample")]
+[ScenarioCategory ("Controls")]
public class ASCIICustomButtonTest : Scenario
{
private static bool _smallerWindow;
diff --git a/UICatalog/Scenarios/Adornments.cs b/UICatalog/Scenarios/Adornments.cs
index 48746a5ca..1ecbb196a 100644
--- a/UICatalog/Scenarios/Adornments.cs
+++ b/UICatalog/Scenarios/Adornments.cs
@@ -2,9 +2,9 @@
namespace UICatalog.Scenarios;
-[Scenario.ScenarioMetadata ("Adornments Demo", "Demonstrates Margin, Border, and Padding on Views.")]
-[Scenario.ScenarioCategory ("Layout")]
-[Scenario.ScenarioCategory ("Adornments")]
+[ScenarioMetadata ("Adornments Demo", "Demonstrates Margin, Border, and Padding on Views.")]
+[ScenarioCategory ("Layout")]
+[ScenarioCategory ("Adornments")]
public class Adornments : Scenario
{
public override void Main ()
diff --git a/UICatalog/Scenarios/AllViewsTester.cs b/UICatalog/Scenarios/AllViewsTester.cs
index 11e25bb5e..5d378db5e 100644
--- a/UICatalog/Scenarios/AllViewsTester.cs
+++ b/UICatalog/Scenarios/AllViewsTester.cs
@@ -336,4 +336,16 @@ public class AllViewsTester : Scenario
UpdateHostTitle (view);
}
+
+ public override List GetDemoKeyStrokes ()
+ {
+ var keys = new List ();
+
+ for (int i = 0; i < GetAllViewClassesCollection ().Count; i++)
+ {
+ keys.Add (Key.CursorDown);
+ }
+
+ return keys;
+ }
}
diff --git a/UICatalog/Scenarios/AnimationScenario/AnimationScenario.cs b/UICatalog/Scenarios/AnimationScenario/AnimationScenario.cs
index 9a3095964..335afe4c2 100644
--- a/UICatalog/Scenarios/AnimationScenario/AnimationScenario.cs
+++ b/UICatalog/Scenarios/AnimationScenario/AnimationScenario.cs
@@ -10,9 +10,9 @@ using Terminal.Gui;
namespace UICatalog.Scenarios;
-[Scenario.ScenarioMetadata ("Animation", "Demonstration of how to render animated images with threading.")]
-[Scenario.ScenarioCategory ("Threading")]
-[Scenario.ScenarioCategory ("Drawing")]
+[ScenarioMetadata ("Animation", "Demonstration of how to render animated images with threading.")]
+[ScenarioCategory ("Threading")]
+[ScenarioCategory ("Drawing")]
public class AnimationScenario : Scenario
{
private bool _isDisposed;
diff --git a/UICatalog/Scenarios/Arrangement.cs b/UICatalog/Scenarios/Arrangement.cs
index a12c7d5ad..fb4c05f90 100644
--- a/UICatalog/Scenarios/Arrangement.cs
+++ b/UICatalog/Scenarios/Arrangement.cs
@@ -1,4 +1,5 @@
-using Terminal.Gui;
+using System.Collections.Generic;
+using Terminal.Gui;
using Timer = System.Timers.Timer;
namespace UICatalog.Scenarios;
@@ -68,8 +69,10 @@ public class Arrangement : Scenario
View overlappedView1 = CreateOverlappedView (2, 0, 13);
overlappedView1.Title = "Movable _& Sizable";
View tiledSubView = CreateTiledView (4, 0, 2);
+ tiledSubView.Arrangement = ViewArrangement.Fixed;
overlappedView1.Add (tiledSubView);
tiledSubView = CreateTiledView (5, Pos.Right (tiledSubView), Pos.Top (tiledSubView));
+ tiledSubView.Arrangement = ViewArrangement.Fixed;
overlappedView1.Add (tiledSubView);
ProgressBar progressBar = new ()
@@ -242,4 +245,57 @@ public class Arrangement : Scenario
}
private char GetNextHotKey () { return (char)('A' + _hotkeyCount++); }
+
+ public override List GetDemoKeyStrokes ()
+ {
+ var keys = new List ();
+
+ // Select view with progress bar
+ keys.Add ((Key)'&');
+
+ keys.Add (Application.ArrangeKey);
+
+ for (int i = 0; i < 8; i++)
+ {
+ keys.Add (Key.CursorUp);
+ }
+
+ for (int i = 0; i < 25; i++)
+ {
+ keys.Add (Key.CursorRight);
+ }
+
+ keys.Add (Application.ArrangeKey);
+
+ keys.Add (Key.S);
+
+ keys.Add (Application.ArrangeKey);
+
+ for (int i = 0; i < 10; i++)
+ {
+ keys.Add (Key.CursorUp);
+ }
+
+ for (int i = 0; i < 25; i++)
+ {
+ keys.Add (Key.CursorLeft);
+ }
+
+ keys.Add (Application.ArrangeKey);
+
+ // Select view with progress bar
+ keys.Add ((Key)'&');
+
+ keys.Add (Application.ArrangeKey);
+
+ keys.Add (Key.Tab);
+
+ for (int i = 0; i < 10; i++)
+ {
+ keys.Add (Key.CursorRight);
+ keys.Add (Key.CursorDown);
+ }
+
+ return keys;
+ }
}
diff --git a/UICatalog/Scenarios/Bars.cs b/UICatalog/Scenarios/Bars.cs
index 3620050dc..7a4f388b8 100644
--- a/UICatalog/Scenarios/Bars.cs
+++ b/UICatalog/Scenarios/Bars.cs
@@ -8,8 +8,8 @@ using Terminal.Gui;
namespace UICatalog.Scenarios;
-[Scenario.ScenarioMetadata ("Bars", "Illustrates Bar views (e.g. StatusBar)")]
-[Scenario.ScenarioCategory ("Controls")]
+[ScenarioMetadata ("Bars", "Illustrates Bar views (e.g. StatusBar)")]
+[ScenarioCategory ("Controls")]
public class Bars : Scenario
{
public override void Main ()
diff --git a/UICatalog/Scenarios/Buttons.cs b/UICatalog/Scenarios/Buttons.cs
index e7705a7d9..4cafab5be 100644
--- a/UICatalog/Scenarios/Buttons.cs
+++ b/UICatalog/Scenarios/Buttons.cs
@@ -7,9 +7,9 @@ using Terminal.Gui;
namespace UICatalog.Scenarios;
-[Scenario.ScenarioMetadata ("Buttons", "Demonstrates all sorts of Buttons.")]
-[Scenario.ScenarioCategory ("Controls")]
-[Scenario.ScenarioCategory ("Layout")]
+[ScenarioMetadata ("Buttons", "Demonstrates all sorts of Buttons.")]
+[ScenarioCategory ("Controls")]
+[ScenarioCategory ("Layout")]
public class Buttons : Scenario
{
public override void Main ()
diff --git a/UICatalog/Scenarios/CharacterMap.cs b/UICatalog/Scenarios/CharacterMap.cs
index b1d5ae75f..b68d738de 100644
--- a/UICatalog/Scenarios/CharacterMap.cs
+++ b/UICatalog/Scenarios/CharacterMap.cs
@@ -21,12 +21,12 @@ namespace UICatalog.Scenarios;
/// "Character Map" application (like Windows' charmap.exe). - Helps test unicode character rendering in Terminal.Gui -
/// Illustrates how to do infinite scrolling
///
-[Scenario.ScenarioMetadata ("Character Map", "Unicode viewer demonstrating infinite content, scrolling, and Unicode.")]
-[Scenario.ScenarioCategory ("Text and Formatting")]
-[Scenario.ScenarioCategory ("Drawing")]
-[Scenario.ScenarioCategory ("Controls")]
-[Scenario.ScenarioCategory ("Layout")]
-[Scenario.ScenarioCategory ("Scrolling")]
+[ScenarioMetadata ("Character Map", "Unicode viewer demonstrating infinite content, scrolling, and Unicode.")]
+[ScenarioCategory ("Text and Formatting")]
+[ScenarioCategory ("Drawing")]
+[ScenarioCategory ("Controls")]
+[ScenarioCategory ("Layout")]
+[ScenarioCategory ("Scrolling")]
public class CharacterMap : Scenario
{
@@ -306,9 +306,33 @@ public class CharacterMap : Scenario
return item;
}
+ public override List GetDemoKeyStrokes ()
+ {
+ var keys = new List ();
+
+ for (int i = 0; i < 200; i++)
+ {
+ keys.Add (Key.CursorDown);
+ }
+
+ // Category table
+ keys.Add (Key.Tab.WithShift);
+
+ // Block elements
+ keys.Add (Key.B);
+ keys.Add (Key.L);
+
+ keys.Add (Key.Tab);
+
+ for (int i = 0; i < 200; i++)
+ {
+ keys.Add (Key.CursorLeft);
+ }
+ return keys;
+ }
}
-internal class CharMap : View
+internal class CharMap : View, IDesignable
{
private const int COLUMN_WIDTH = 3;
diff --git a/UICatalog/Scenarios/ChineseUI.cs b/UICatalog/Scenarios/ChineseUI.cs
index f7b783cb5..0cc91ca4f 100644
--- a/UICatalog/Scenarios/ChineseUI.cs
+++ b/UICatalog/Scenarios/ChineseUI.cs
@@ -2,8 +2,8 @@
namespace UICatalog.Scenarios;
-[Scenario.ScenarioMetadata ("ChineseUI", "Chinese UI")]
-[Scenario.ScenarioCategory ("Text and Formatting")]
+[ScenarioMetadata ("ChineseUI", "Chinese UI")]
+[ScenarioCategory ("Text and Formatting")]
public class ChineseUI : Scenario
{
public override void Main ()
diff --git a/UICatalog/Scenarios/ClassExplorer.cs b/UICatalog/Scenarios/ClassExplorer.cs
index 7859c0966..0bfd4e9fd 100644
--- a/UICatalog/Scenarios/ClassExplorer.cs
+++ b/UICatalog/Scenarios/ClassExplorer.cs
@@ -7,9 +7,9 @@ using Terminal.Gui;
namespace UICatalog.Scenarios;
-[Scenario.ScenarioMetadata ("Class Explorer", "Tree view explorer for classes by namespace based on TreeView.")]
-[Scenario.ScenarioCategory ("Controls")]
-[Scenario.ScenarioCategory ("TreeView")]
+[ScenarioMetadata ("Class Explorer", "Tree view explorer for classes by namespace based on TreeView.")]
+[ScenarioCategory ("Controls")]
+[ScenarioCategory ("TreeView")]
public class ClassExplorer : Scenario
{
private MenuItem _highlightModelTextOnly;
diff --git a/UICatalog/Scenarios/Clipping.cs b/UICatalog/Scenarios/Clipping.cs
index 21807d42e..3e866023d 100644
--- a/UICatalog/Scenarios/Clipping.cs
+++ b/UICatalog/Scenarios/Clipping.cs
@@ -1,11 +1,12 @@
-using Terminal.Gui;
+using System.Collections.Generic;
+using Terminal.Gui;
namespace UICatalog.Scenarios;
-[Scenario.ScenarioMetadata ("Clipping", "Used to test that things clip correctly")]
-[Scenario.ScenarioCategory ("Tests")]
-[Scenario.ScenarioCategory ("Drawing")]
-[Scenario.ScenarioCategory ("Scrolling")]
+[ScenarioMetadata ("Clipping", "Used to test that things clip correctly")]
+[ScenarioCategory ("Tests")]
+[ScenarioCategory ("Drawing")]
+[ScenarioCategory ("Scrolling")]
public class Clipping : Scenario
{
public override void Main ()
@@ -82,4 +83,31 @@ public class Clipping : Scenario
win.Dispose ();
Application.Shutdown ();
}
+
+ public override List GetDemoKeyStrokes ()
+ {
+ var keys = new List ();
+
+ for (int i = 0; i < 25; i++)
+ {
+ keys.Add (Key.CursorDown);
+ }
+
+ for (int i = 0; i < 25; i++)
+ {
+ keys.Add (Key.CursorRight);
+ }
+
+ for (int i = 0; i < 25; i++)
+ {
+ keys.Add (Key.CursorLeft);
+ }
+
+ for (int i = 0; i < 25; i++)
+ {
+ keys.Add (Key.CursorUp);
+ }
+
+ return keys;
+ }
}
diff --git a/UICatalog/Scenarios/CollectionNavigatorTester.cs b/UICatalog/Scenarios/CollectionNavigatorTester.cs
index 5b0f79d0d..650e5e180 100644
--- a/UICatalog/Scenarios/CollectionNavigatorTester.cs
+++ b/UICatalog/Scenarios/CollectionNavigatorTester.cs
@@ -6,15 +6,15 @@ using Terminal.Gui;
namespace UICatalog.Scenarios;
-[Scenario.ScenarioMetadata (
+[ScenarioMetadata (
"Collection Navigator",
"Demonstrates keyboard navigation in ListView & TreeView (CollectionNavigator)."
)]
-[Scenario.ScenarioCategory ("Controls")]
-[Scenario.ScenarioCategory ("ListView")]
-[Scenario.ScenarioCategory ("TreeView")]
-[Scenario.ScenarioCategory ("Text and Formatting")]
-[Scenario.ScenarioCategory ("Mouse and Keyboard")]
+[ScenarioCategory ("Controls")]
+[ScenarioCategory ("ListView")]
+[ScenarioCategory ("TreeView")]
+[ScenarioCategory ("Text and Formatting")]
+[ScenarioCategory ("Mouse and Keyboard")]
public class CollectionNavigatorTester : Scenario
{
private ObservableCollection _items = new ObservableCollection (new ObservableCollection ()
diff --git a/UICatalog/Scenarios/ColorPicker.cs b/UICatalog/Scenarios/ColorPicker.cs
index 962a3171f..cd0789d60 100644
--- a/UICatalog/Scenarios/ColorPicker.cs
+++ b/UICatalog/Scenarios/ColorPicker.cs
@@ -1,11 +1,12 @@
using System;
+using System.Collections.Generic;
using Terminal.Gui;
namespace UICatalog.Scenarios;
-[Scenario.ScenarioMetadata ("Color Picker", "Color Picker.")]
-[Scenario.ScenarioCategory ("Colors")]
-[Scenario.ScenarioCategory ("Controls")]
+[ScenarioMetadata ("ColorPicker", "Color Picker.")]
+[ScenarioCategory ("Colors")]
+[ScenarioCategory ("Controls")]
public class ColorPickers : Scenario
{
/// Background color Label.
@@ -270,4 +271,40 @@ public class ColorPickers : Scenario
)
};
}
+
+ public override List GetDemoKeyStrokes ()
+ {
+ var keys = new List ();
+
+ keys.Add (Key.B.WithAlt);
+
+ for (int i = 0; i < 200; i++)
+ {
+ keys.Add (Key.CursorRight);
+ }
+
+ keys.Add (Key.Tab);
+ keys.Add (Key.Tab);
+
+ for (int i = 0; i < 200; i++)
+ {
+ keys.Add (Key.CursorLeft);
+ }
+
+ keys.Add (Key.Tab);
+ keys.Add (Key.Tab);
+
+ for (int i = 0; i < 200; i++)
+ {
+ keys.Add (Key.CursorLeft);
+ }
+
+ keys.Add (Key.N.WithAlt);
+ keys.Add (Key.R.WithAlt);
+ keys.Add (Key.H.WithAlt);
+ keys.Add (Key.S.WithAlt);
+ keys.Add (Key.D1.WithAlt);
+
+ return keys;
+ }
}
diff --git a/UICatalog/Scenarios/CombiningMarks.cs b/UICatalog/Scenarios/CombiningMarks.cs
index 40dabace1..51a467a33 100644
--- a/UICatalog/Scenarios/CombiningMarks.cs
+++ b/UICatalog/Scenarios/CombiningMarks.cs
@@ -2,8 +2,8 @@ using Terminal.Gui;
namespace UICatalog.Scenarios;
-[Scenario.ScenarioMetadata ("Combining Marks", "Illustrates how Unicode Combining Marks work (or don't).")]
-[Scenario.ScenarioCategory ("Text and Formatting")]
+[ScenarioMetadata ("Combining Marks", "Illustrates how Unicode Combining Marks work (or don't).")]
+[ScenarioCategory ("Text and Formatting")]
public class CombiningMarks : Scenario
{
public override void Main ()
diff --git a/UICatalog/Scenarios/ComboBoxIteration.cs b/UICatalog/Scenarios/ComboBoxIteration.cs
index 23ec180dd..a0201daf6 100644
--- a/UICatalog/Scenarios/ComboBoxIteration.cs
+++ b/UICatalog/Scenarios/ComboBoxIteration.cs
@@ -4,9 +4,9 @@ using Terminal.Gui;
namespace UICatalog.Scenarios;
-[Scenario.ScenarioMetadata ("ComboBoxIteration", "ComboBox iteration.")]
-[Scenario.ScenarioCategory ("Controls")]
-[Scenario.ScenarioCategory ("ComboBox")]
+[ScenarioMetadata ("ComboBoxIteration", "ComboBox iteration.")]
+[ScenarioCategory ("Controls")]
+[ScenarioCategory ("ComboBox")]
public class ComboBoxIteration : Scenario
{
public override void Main ()
diff --git a/UICatalog/Scenarios/ComputedLayout.cs b/UICatalog/Scenarios/ComputedLayout.cs
index 630417d18..c27eabdb3 100644
--- a/UICatalog/Scenarios/ComputedLayout.cs
+++ b/UICatalog/Scenarios/ComputedLayout.cs
@@ -9,8 +9,8 @@ namespace UICatalog.Scenarios;
///
/// This Scenario demonstrates how to use Terminal.Gui's Dim and Pos Layout System.
///
-[Scenario.ScenarioMetadata ("Computed Layout", "Demonstrates the Computed (Dim and Pos) Layout System.")]
-[Scenario.ScenarioCategory ("Layout")]
+[ScenarioMetadata ("Computed Layout", "Demonstrates the Computed (Dim and Pos) Layout System.")]
+[ScenarioCategory ("Layout")]
public class ComputedLayout : Scenario
{
public override void Main ()
diff --git a/UICatalog/Scenarios/ConfigurationEditor.cs b/UICatalog/Scenarios/ConfigurationEditor.cs
index 37eaedc09..5f40f51dd 100644
--- a/UICatalog/Scenarios/ConfigurationEditor.cs
+++ b/UICatalog/Scenarios/ConfigurationEditor.cs
@@ -6,11 +6,11 @@ using Terminal.Gui;
namespace UICatalog.Scenarios;
-[Scenario.ScenarioMetadata ("Configuration Editor", "Edits Terminal.Gui Config Files.")]
-[Scenario.ScenarioCategory ("TabView")]
-[Scenario.ScenarioCategory ("Colors")]
-[Scenario.ScenarioCategory ("Files and IO")]
-[Scenario.ScenarioCategory ("TextView")]
+[ScenarioMetadata ("Configuration Editor", "Edits Terminal.Gui Config Files.")]
+[ScenarioCategory ("TabView")]
+[ScenarioCategory ("Colors")]
+[ScenarioCategory ("Files and IO")]
+[ScenarioCategory ("TextView")]
public class ConfigurationEditor : Scenario
{
private static ColorScheme _editorColorScheme = new ()
diff --git a/UICatalog/Scenarios/ContentScrolling.cs b/UICatalog/Scenarios/ContentScrolling.cs
index bbe672693..82f161f32 100644
--- a/UICatalog/Scenarios/ContentScrolling.cs
+++ b/UICatalog/Scenarios/ContentScrolling.cs
@@ -5,10 +5,10 @@ using Terminal.Gui;
namespace UICatalog.Scenarios;
-[Scenario.ScenarioMetadata ("Content Scrolling", "Demonstrates using View.Viewport and View.GetContentSize () to scroll content.")]
-[Scenario.ScenarioCategory ("Layout")]
-[Scenario.ScenarioCategory ("Drawing")]
-[Scenario.ScenarioCategory ("Scrolling")]
+[ScenarioMetadata ("Content Scrolling", "Demonstrates using View.Viewport and View.GetContentSize () to scroll content.")]
+[ScenarioCategory ("Layout")]
+[ScenarioCategory ("Drawing")]
+[ScenarioCategory ("Scrolling")]
public class ContentScrolling : Scenario
{
private ViewDiagnosticFlags _diagnosticFlags;
@@ -425,4 +425,31 @@ public class ContentScrolling : Scenario
app.Dispose ();
Application.Shutdown ();
}
+
+ public override List GetDemoKeyStrokes ()
+ {
+ var keys = new List ();
+
+ for (int i = 0; i < 50; i++)
+ {
+ keys.Add (Key.CursorRight);
+ }
+
+ for (int i = 0; i < 25; i++)
+ {
+ keys.Add (Key.CursorLeft);
+ }
+
+ for (int i = 0; i < 50; i++)
+ {
+ keys.Add (Key.CursorDown);
+ }
+
+ for (int i = 0; i < 25; i++)
+ {
+ keys.Add (Key.CursorUp);
+ }
+
+ return keys;
+ }
}
diff --git a/UICatalog/Scenarios/ContextMenus.cs b/UICatalog/Scenarios/ContextMenus.cs
index 1961406d0..f609f3562 100644
--- a/UICatalog/Scenarios/ContextMenus.cs
+++ b/UICatalog/Scenarios/ContextMenus.cs
@@ -5,11 +5,11 @@ using Terminal.Gui;
namespace UICatalog.Scenarios;
-[Scenario.ScenarioMetadata ("ContextMenus", "Context Menu Sample.")]
-[Scenario.ScenarioCategory ("Menus")]
+[ScenarioMetadata ("ContextMenus", "Context Menu Sample.")]
+[ScenarioCategory ("Menus")]
public class ContextMenus : Scenario
{
- private readonly List _cultureInfos = Application.SupportedCultures;
+ private List _cultureInfos = null;
private ContextMenu _contextMenu = new ();
private bool _forceMinimumPosToZero = true;
private MenuItem _miForceMinimumPosToZero;
@@ -22,6 +22,7 @@ public class ContextMenus : Scenario
// Init
Application.Init ();
+ _cultureInfos = Application.SupportedCultures;
// Setup - Create a top-level application window and configure it.
Window appWindow = new ()
{
@@ -110,6 +111,11 @@ public class ContextMenus : Scenario
List