using Terminal.Gui.ViewBase; using Terminal.Gui.Views; using Terminal.Gui.Drawing; using Terminal.Gui.Input; using Terminal.Gui.Drivers; using Edith.Construction; namespace Edith; internal class MainWindow : Window { private TabView contentView; private FrameView commandView; private TextField command; private List pageTypes = new() { typeof(OverviewPage), typeof(ConstructionHelperPage), }; private List pages = new(); public MainWindow() { Title = "Elite: Dangerous Intelligent Terminal Helper (EDITH)"; BorderStyle = LineStyle.None; commandView = new FrameView() { Title = "Command", //BorderStyle = LineStyle.None, Height = 3, Width = Dim.Fill(), Y = Pos.Bottom(this) - 3, }; command = new TextField() { Caption = "> _", Width = Dim.Fill() }; commandView.Add(command); Add(commandView); contentView = new TabView() { Title = "Elite: Dangerous Intelligent Terminal Helper (EDITH)", BorderStyle = LineStyle.Single, Height = Dim.Fill() - command.Height, Width = Dim.Fill() }; Add(contentView); foreach (Type pageType in pageTypes) { var page = Activator.CreateInstance(pageType) as IPage; if (page != null) { contentView.AddTab(page.View, false); pages.Add(page); } } } public void ShowPage(string name) { int page = pages .IndexOf(x => string.Compare(x.Name, name, StringComparison.InvariantCultureIgnoreCase) == 0) ; if (page < 0) { return; } contentView.SwitchTabBy(page); } }