HtmlUtility: Helper functions for Html text building.

This commit is contained in:
2019-05-04 11:00:51 +02:00
parent 33ee2d4a47
commit 37025d7c07
3 changed files with 204 additions and 2 deletions

View File

@@ -30,9 +30,38 @@ namespace VAR.HttpServer.MiniServerTest
{
public void HandleRequest(HttpProcessor p)
{
Console.WriteLine("Responding to {0}", p.Socket.Client.RemoteEndPoint);
Console.WriteLine("Responding to {0} requesting: {1}", p.Socket.Client.RemoteEndPoint, p.HttpResource);
// Process
string greetedName = "World";
if (p.HttpParams.ContainsKey("txtName"))
{
greetedName = p.HttpParams["txtName"];
}
if (p.HttpParams.ContainsKey("btnReset"))
{
greetedName = "World";
}
string strGreeting = string.Format("Hello {0}!", greetedName);
// Render
p.ResponseSuccess();
p.OutputStream.WriteLine("Hello World!");
p.WriteDocument(strGreeting, writeBody: () =>
{
p.WriteHeading2(strGreeting);
p.WriteForm("post", "", () =>
{
p.WriteParagraph(null, writeBody: () =>
{
p.WriteTextbox("txtName", greetedName);
});
p.WriteParagraph(null, writeBody: () =>
{
p.WriteButton("btnRefresh", "Refresh");
p.WriteButton("btnReset", "Reset");
});
});
});
}
}
}