|
@@ -36,32 +36,17 @@ public class ConfigurationEditor : Scenario
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // Don't create a Window, just return the top-level view
|
|
|
- public override void Init ()
|
|
|
+ public override void Main ()
|
|
|
{
|
|
|
Application.Init ();
|
|
|
- ConfigurationManager.Themes.Theme = Theme;
|
|
|
- ConfigurationManager.Apply ();
|
|
|
- Top = new ();
|
|
|
- Top.ColorScheme = Colors.ColorSchemes [TopLevelColorScheme];
|
|
|
- }
|
|
|
-
|
|
|
- public void Save ()
|
|
|
- {
|
|
|
- if (_tileView.MostFocused is ConfigTextView editor)
|
|
|
- {
|
|
|
- editor.Save ();
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- public override void Setup ()
|
|
|
- {
|
|
|
+ Toplevel top = new ();
|
|
|
_tileView = new TileView (0)
|
|
|
{
|
|
|
Width = Dim.Fill (), Height = Dim.Fill (1), Orientation = Orientation.Vertical, LineStyle = LineStyle.Single
|
|
|
};
|
|
|
|
|
|
- Top.Add (_tileView);
|
|
|
+ top.Add (_tileView);
|
|
|
|
|
|
_lenStatusItem = new StatusItem (KeyCode.CharMask, "Len: ", null);
|
|
|
|
|
@@ -79,9 +64,9 @@ public class ConfigurationEditor : Scenario
|
|
|
}
|
|
|
);
|
|
|
|
|
|
- Top.Add (statusBar);
|
|
|
+ top.Add (statusBar);
|
|
|
|
|
|
- Top.Loaded += (s, a) => Open ();
|
|
|
+ top.Loaded += (s, a) => Open ();
|
|
|
|
|
|
_editorColorSchemeChanged += () =>
|
|
|
{
|
|
@@ -95,6 +80,18 @@ public class ConfigurationEditor : Scenario
|
|
|
};
|
|
|
|
|
|
_editorColorSchemeChanged.Invoke ();
|
|
|
+
|
|
|
+ Application.Run (top);
|
|
|
+ top.Dispose ();
|
|
|
+
|
|
|
+ Application.Shutdown ();
|
|
|
+ }
|
|
|
+ public void Save ()
|
|
|
+ {
|
|
|
+ if (_tileView.MostFocused is ConfigTextView editor)
|
|
|
+ {
|
|
|
+ editor.Save ();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void Open ()
|
|
@@ -126,7 +123,7 @@ public class ConfigurationEditor : Scenario
|
|
|
textView.Enter += (s, e) => { _lenStatusItem.Title = $"Len:{textView.Text.Length}"; };
|
|
|
}
|
|
|
|
|
|
- Top.LayoutSubviews ();
|
|
|
+ Application.Top.LayoutSubviews ();
|
|
|
}
|
|
|
|
|
|
private void Quit ()
|