Ooui-tws-port/Example/Program.cs

25 lines
600 B
C#
Raw Normal View History

using Tesses.WebServer;
using Ooui;
UI ui=new UI();
ui.Verbose = false;
Button btn = new Button(){Text = "Click Me"};
int i =0;
btn.Click += (sender,e)=>{
btn.Text = $"Clicked {++i} time(s)";
};
ui.Publish("/",btn);
2024-03-26 17:45:36 +00:00
ui.Publish("/query",(ctx)=>{
Ooui.List list=new List();
foreach(var item in ctx.QueryParams)
{
foreach(var v in item.Value)
{
Ooui.ListItem listItem=new ListItem();
listItem.Text = $"{item.Key}: {v}";
list.AppendChild(listItem);
}
}
return list;
});
ui.StartServer(45252);