50 lines
998 B
C#
50 lines
998 B
C#
|
using System.Reflection;
|
||
|
using ImGuiNET;
|
||
|
|
||
|
namespace Shoko;
|
||
|
|
||
|
static class MainUI
|
||
|
{
|
||
|
static string txtURL = "";
|
||
|
|
||
|
public static List<Tab> tabs = new List<Tab>();
|
||
|
|
||
|
public static void NewTab(string url)
|
||
|
{
|
||
|
tabs.Add(new Tab(url));
|
||
|
}
|
||
|
|
||
|
public static bool Render()
|
||
|
{
|
||
|
bool quit = true;
|
||
|
ImGui.DockSpaceOverViewport();
|
||
|
|
||
|
Gui.MainMenuBar(()=>
|
||
|
{
|
||
|
Gui.Menu("File", ()=>
|
||
|
{
|
||
|
Gui.MenuItem("Quit", null, ()=> quit = false);
|
||
|
});
|
||
|
Gui.Menu("Help", ()=>
|
||
|
{
|
||
|
Gui.MenuItem("About", null, ()=> NewTab("about:"));
|
||
|
});
|
||
|
|
||
|
ImGui.InputText("##url", ref txtURL, 1024);
|
||
|
|
||
|
Gui.Button("Go", ()=>{
|
||
|
NewTab(txtURL);
|
||
|
txtURL = "";
|
||
|
});
|
||
|
});
|
||
|
|
||
|
tabs = tabs.Where(x=>x.IsOpen).ToList();
|
||
|
|
||
|
foreach (var tab in tabs)
|
||
|
{
|
||
|
tab.Render();
|
||
|
}
|
||
|
|
||
|
return quit;
|
||
|
}
|
||
|
}
|