Sorted catagories, renamed ListAndCombos, tweaked Progress UI

This commit is contained in:
Charlie Kindel
2020-05-23 13:53:56 -06:00
parent c5cb08b77f
commit ea2b973fd6
3 changed files with 18 additions and 12 deletions

View File

@@ -31,7 +31,7 @@ namespace UICatalog {
if (Debugger.IsAttached)
CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.GetCultureInfo ("en-US");
_scenarios = Scenario.GetDerivedClassesCollection ().ToList ();
_scenarios = Scenario.GetDerivedClassesCollection ().OrderBy (t => Scenario.ScenarioMetadata.GetName (t)).ToList();
if (args.Length > 0) {
var item = _scenarios.FindIndex (t => Scenario.ScenarioMetadata.GetName (t).Equals (args [0], StringComparison.OrdinalIgnoreCase));
@@ -75,7 +75,7 @@ namespace UICatalog {
};
_categories = Scenario.GetAllCategories ();
_categories = Scenario.GetAllCategories ().OrderBy(c => c).ToList();
_categoryListView = new ListView (_categories) {
X = 1,
Y = 0,

View File

@@ -6,7 +6,7 @@ using Terminal.Gui;
using NStack;
namespace UICatalog.Scenarios {
[ScenarioMetadata (Name: "Lists", Description: "Demonstrates list selections")]
[ScenarioMetadata (Name: "ListView & ComboBox", Description: "Demonstrates a ListView populating a ComboBox that acts as a filter.")]
[ScenarioCategory ("Controls")]
class ListsAndCombos : Scenario {

View File

@@ -6,8 +6,9 @@ namespace UICatalog {
//
// This would be a great scenario to show of threading (Issue #471)
//
[ScenarioMetadata (Name: "Progress", Description: "Shows off ProgressBar.")]
[ScenarioMetadata (Name: "Progress", Description: "Shows off ProgressBar and Threading")]
[ScenarioCategory ("Controls")]
[ScenarioCategory ("Threading")]
class Progress : Scenario {
private ProgressBar _activityProgressBar;
@@ -19,23 +20,28 @@ namespace UICatalog {
{
var pulseButton = new Button ("Pulse") {
X = Pos.Center (),
Y = Pos.Center () - 5,
Y = Pos.Center () - 3,
Clicked = () => Pulse ()
};
Win.Add (new Button ("Start Timer") {
X = Pos.Left(pulseButton) - 20,
var startButton = new Button ("Start Timer") {
Y = Pos.Y(pulseButton),
Clicked = () => Start ()
});
};
Win.Add (new Button ("Stop Timer") {
X = Pos.Right (pulseButton) + 20, // BUGBUG: Right is somehow adding additional width
var stopbutton = new Button ("Stop Timer") {
Y = Pos.Y (pulseButton),
Clicked = () => Stop()
});
};
// Center three buttons with 5 spaces between them
// TODO: Use Pos.Width instead of (Right-Left) when implemented (#502)
startButton.X = Pos.Left (pulseButton) - (Pos.Right (startButton) - Pos.Left (startButton)) - 5;
stopbutton.X = Pos.Right (pulseButton) + 5;
Win.Add (startButton);
Win.Add (pulseButton);
Win.Add (stopbutton);
_activityProgressBar = new ProgressBar () {
X = Pos.Center (),
@@ -86,7 +92,7 @@ namespace UICatalog {
_timer = new Timer ((o) => {
// BUGBUG: #409 - Invoke does not cause Wakeup as it should
Application.MainLoop.Invoke (() => Pulse ());
}, null, 0, 250);
}, null, 0, 20);
}
private void Stop ()