|
@@ -1,7 +1,9 @@
|
|
|
|
+using NStack;
|
|
using System;
|
|
using System;
|
|
using System.Reflection.Emit;
|
|
using System.Reflection.Emit;
|
|
using Terminal.Gui;
|
|
using Terminal.Gui;
|
|
using Terminal.Gui.Configuration;
|
|
using Terminal.Gui.Configuration;
|
|
|
|
+using Label = Terminal.Gui.Label;
|
|
|
|
|
|
namespace UICatalog.Scenarios {
|
|
namespace UICatalog.Scenarios {
|
|
[ScenarioMetadata (Name: "Generic", Description: "Generic sample - A template for creating new Scenarios")]
|
|
[ScenarioMetadata (Name: "Generic", Description: "Generic sample - A template for creating new Scenarios")]
|
|
@@ -16,7 +18,8 @@ namespace UICatalog.Scenarios {
|
|
// - Sets the Theme & the ColorScheme property of `this.Win` to `colorScheme`.
|
|
// - Sets the Theme & the ColorScheme property of `this.Win` to `colorScheme`.
|
|
// To override this, implement an override of `Init`.
|
|
// To override this, implement an override of `Init`.
|
|
//base.Init ();
|
|
//base.Init ();
|
|
- // A common, alternate, implementation where `this.Win` is not used:
|
|
|
|
|
|
+ // A common, alternate, implementation where `this.Win` is not used is below. This code
|
|
|
|
+ // leverages ConfigurationManager to borrow the color scheme settings from UICatalog
|
|
Application.Init ();
|
|
Application.Init ();
|
|
ConfigurationManager.Themes.Theme = Theme;
|
|
ConfigurationManager.Themes.Theme = Theme;
|
|
ConfigurationManager.Apply ();
|
|
ConfigurationManager.Apply ();
|
|
@@ -30,35 +33,12 @@ namespace UICatalog.Scenarios {
|
|
// With a Scenario, after UI Catalog calls `Scenario.Setup` it calls
|
|
// With a Scenario, after UI Catalog calls `Scenario.Setup` it calls
|
|
// `Scenario.Run` which calls `Application.Run`.
|
|
// `Scenario.Run` which calls `Application.Run`.
|
|
// Example:
|
|
// Example:
|
|
- //var button = new Button ("Press me!") {
|
|
|
|
- // AutoSize = false,
|
|
|
|
- // X = Pos.Center (),
|
|
|
|
- // Y = Pos.Center (),
|
|
|
|
- //};
|
|
|
|
- //Win.Add (button);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- var root = new View () { Width = 20, Height = 10, ColorScheme = Colors.Base };
|
|
|
|
-
|
|
|
|
- //var v = new Terminal.Gui.Label (new string ('c', 100)) {
|
|
|
|
- // Width = Dim.Fill (),
|
|
|
|
- // //Height =1
|
|
|
|
- //};
|
|
|
|
-
|
|
|
|
- var v = new TextView () {
|
|
|
|
- Height = 1,
|
|
|
|
- Text = new string ('c', 100),
|
|
|
|
- Width = Dim.Fill ()
|
|
|
|
|
|
+ var button = new Button ("Press me!") {
|
|
|
|
+ AutoSize = false,
|
|
|
|
+ X = Pos.Center (),
|
|
|
|
+ Y = Pos.Center (),
|
|
};
|
|
};
|
|
-
|
|
|
|
- root.Add (v);
|
|
|
|
-
|
|
|
|
- Application.Top.Add (root);
|
|
|
|
-
|
|
|
|
- //Application.Top.CanFocus = true;
|
|
|
|
- //v.CanFocus = true;
|
|
|
|
- //v.SetFocus ();
|
|
|
|
-
|
|
|
|
|
|
+ Win.Add (button);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|