public Element CreateElement() { var heading = new Heading("Upload Files"); var subtitle = new Paragraph("Upload files to the app"); var uploadForm = new Form(); uploadForm.Action = "/files/upload"; uploadForm.Method = "POST"; uploadForm.EncodingType = "multipart/form-data"; uploadForm.AppendChild(new Input(InputType.File) { Name = "file" }); uploadForm.AppendChild(new Input(InputType.Submit) { Value = "Upload" }); var app = new Div(); app.AppendChild(heading); app.AppendChild(subtitle); app.AppendChild(uploadForm); return(app); }
static void Main() { //Start Game var io = new SimpleInputOutput(); var machine = new Machine(Zork1.GetData(), io); _area = new Span(); var frm = new Form(); var textInput = new TextInput(); _area.Text = ""; frm.Submit += (sender, eventArgs) => { DisplayOutput(ProcessCommand(machine, io, textInput.Value)); textInput.Value = ""; //DOESN'T WORK RIGHT //value doesn't change so... var js = string.Format("document.getElementById(\"{0}\").value = \"\";window.scrollTo(0,document.body.scrollHeight);", textInput.Id); Runtime.InvokeJS(js); }; var container = new Paragraph(); var p1 = new Paragraph(); var p2 = new Paragraph(); p1.AppendChild(_area); frm.AppendChild(textInput); p2.AppendChild(frm); container.AppendChild(p1); container.AppendChild(p2); // Publish a root element to be displayed UI.Publish("/", container); DisplayOutput(WaitForOutput(machine, io)); }