Clean up old code

This commit is contained in:
Tig Kindel
2022-10-29 17:48:32 -06:00
parent f5bb3552e0
commit 5dc2ec7606
7 changed files with 9 additions and 43 deletions

View File

@@ -77,10 +77,7 @@ namespace UICatalog {
{
Application.Init ();
Top = top;
if (Top == null) {
Top = Application.Top;
}
Top = top != null ? top : Application.Top;
Win = new Window ($"CTRL-Q to Close - Scenario: {GetName ()}") {
X = 0,

View File

@@ -44,10 +44,7 @@ namespace UICatalog.Scenarios {
{
Application.Init ();
Top = top;
if (Top == null) {
Top = Application.Top;
}
Top = top != null ? top : Application.Top;
//Win = new Window ($"CTRL-Q to Close - Scenario: {GetName ()}") {
// X = 0,

View File

@@ -7,7 +7,6 @@ namespace UICatalog.Scenarios {
public class BordersComparisons : Scenario {
public override void Init (Toplevel top, ColorScheme colorScheme)
{
top.Dispose ();
Application.Init ();
top = Application.Top;

View File

@@ -11,19 +11,9 @@ namespace UICatalog.Scenarios {
{
Application.Init ();
Top = top;
if (Top == null) {
Top = Application.Top;
}
Top = top != null ? top : Application.Top;
Top.ColorScheme = Colors.Base;
//Win = new TopLevel($"CTRL-Q to Close - Scenario: {GetName ()}") {
// X = 0,
// Y = 0,
// Width = Dim.Fill (),
// Height = Dim.Fill ()
//};
//Top.Add (Win);
}
public override void Setup ()

View File

@@ -35,10 +35,7 @@ namespace UICatalog.Scenarios {
public override void Init (Toplevel top, ColorScheme colorScheme)
{
Application.Init ();
Top = top;
if (Top == null) {
Top = Application.Top;
}
Top = top != null ? top : Application.Top;
Win = new Window (_fileName ?? "Untitled") {
X = 0,

View File

@@ -10,10 +10,7 @@ namespace UICatalog.Scenarios {
{
Application.Init ();
Top = top;
if (Top == null) {
Top = Application.Top;
}
Top = top != null ? top : Application.Top;
}
public override void RequestStop ()

View File

@@ -57,7 +57,9 @@ namespace UICatalog {
private static StatusItem _numlock;
private static StatusItem _scrolllock;
// If set, holds the scenario the user selected
private static Scenario _selectedScenario = null;
private static bool _useSystemConsole = false;
private static ConsoleDriver.DiagnosticFlags _diagnosticFlags;
private static bool _heightAsBuffer = false;
@@ -140,10 +142,6 @@ namespace UICatalog {
#endif
}
// This call to Application.Shutdown brackets the Application.Init call
// for the main UI Catalog app (in SelectScenario()).
//Application.Shutdown ();
#if DEBUG_IDISPOSABLE
// This proves that when the user exited the UI Catalog app
// it cleaned up properly.
@@ -291,12 +289,9 @@ namespace UICatalog {
_categoryListView.SelectedItem = _cachedCategoryIndex;
_scenarioListView.SelectedItem = _cachedScenarioIndex;
// Run UI Catalog UI. When it exits, if _runningScenario is != null then
// Run UI Catalog UI. When it exits, if _selectedScenario is != null then
// a Scenario was selected. Otherwise, the user wants to exit UI Catalog.
Application.Run (Application.Top);
// BUGBUG: Shouldn't Application.Shutdown() be called here? Why is it currently
// outside of the SelectScenario() loop?
Application.Shutdown ();
return _selectedScenario;
@@ -304,7 +299,7 @@ namespace UICatalog {
/// <summary>
/// Launches the selected scenario, setting the global _runningScenario
/// Launches the selected scenario, setting the global _selectedScenario
/// </summary>
/// <param name="e"></param>
private static void _scenarioListView_OpenSelectedItem (EventArgs e)
@@ -504,12 +499,6 @@ namespace UICatalog {
return menuItems.ToArray ();
}
/// <summary>
/// When Scenarios are running we need to override the behavior of the Menu
/// and Statusbar to enable Scenarios that use those (or related key input)
/// to not be impacted. Same as for tabs.
/// </summary>
/// <param name="ke"></param>
private static void KeyDownHandler (View.KeyEventEventArgs a)
{
if (a.KeyEvent.IsCapslock) {