HtmlUtility: Helper functions for Html text building.
This commit is contained in:
@@ -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");
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user