mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-29 01:07:58 +01:00
Change all Scenarios to merge their Init, Setup, and Run overrides into Main.
This commit is contained in:
@@ -34,11 +34,16 @@ public class TreeViewFileSystem : Scenario
|
||||
/// <summary>A tree view where nodes are files and folders</summary>
|
||||
private TreeView<IFileSystemInfo> _treeViewFiles;
|
||||
|
||||
public override void Setup ()
|
||||
public override void Main ()
|
||||
{
|
||||
Win.Title = GetName ();
|
||||
Win.Y = 1; // menu
|
||||
Win.Height = Dim.Fill ();
|
||||
Application.Init ();
|
||||
var win = new Window
|
||||
{
|
||||
Title = GetName (),
|
||||
Y = 1, // menu
|
||||
Height = Dim.Fill ()
|
||||
};
|
||||
var top = new Toplevel ();
|
||||
|
||||
var menu = new MenuBar
|
||||
{
|
||||
@@ -172,7 +177,7 @@ public class TreeViewFileSystem : Scenario
|
||||
)
|
||||
]
|
||||
};
|
||||
Top.Add (menu);
|
||||
top.Add (menu);
|
||||
|
||||
_treeViewFiles = new TreeView<IFileSystemInfo> { X = 0, Y = 0, Width = Dim.Percent (50), Height = Dim.Fill () };
|
||||
_treeViewFiles.DrawLine += TreeViewFiles_DrawLine;
|
||||
@@ -182,14 +187,15 @@ public class TreeViewFileSystem : Scenario
|
||||
X = Pos.Right (_treeViewFiles), Y = 0, Width = Dim.Fill (), Height = Dim.Fill ()
|
||||
};
|
||||
|
||||
Win.Add (_detailsFrame);
|
||||
win.Add (_detailsFrame);
|
||||
_treeViewFiles.MouseClick += TreeViewFiles_MouseClick;
|
||||
_treeViewFiles.KeyDown += TreeViewFiles_KeyPress;
|
||||
_treeViewFiles.SelectionChanged += TreeViewFiles_SelectionChanged;
|
||||
|
||||
SetupFileTree ();
|
||||
|
||||
Win.Add (_treeViewFiles);
|
||||
win.Add (_treeViewFiles);
|
||||
top.Add (win);
|
||||
_treeViewFiles.GoToFirst ();
|
||||
_treeViewFiles.Expand ();
|
||||
|
||||
@@ -198,6 +204,10 @@ public class TreeViewFileSystem : Scenario
|
||||
_treeViewFiles.SetFocus ();
|
||||
|
||||
UpdateIconCheckedness ();
|
||||
|
||||
Application.Run (top);
|
||||
top.Dispose ();
|
||||
Application.Shutdown ();
|
||||
}
|
||||
|
||||
private string AspectGetter (IFileSystemInfo f) { return (_iconProvider.GetIconWithOptionalSpace (f) + f.Name).Trim (); }
|
||||
|
||||
Reference in New Issue
Block a user