void SubmitContactForm(object sender, MouseEventArgs mouseEvent) { if (ValidateContactForm()) { ContactFormRequest postRequest = new ContactFormRequest(questionInput.Text, detailInput.Text, emailInput.Text, nameInput.Text, ""); formContainer.Visible = false; messageContainer.Visible = true; centerContainer.RemoveAllChildren(); centerContainer.AddChild(messageContainer); cancelButton.Visible = false; submitButton.Visible = false; postRequest.RequestSucceeded += new EventHandler(onPostRequestSucceeded); postRequest.RequestFailed += new EventHandler(onPostRequestFailed); postRequest.Request(); } }
public ContactFormPage() { this.WindowTitle = "MatterControl : " + "Submit Feedback".Localize(); this.HeaderText = "How can we improve?".Localize(); contentRow.Padding = theme.DefaultContainerPadding; submitButton = theme.CreateDialogButton("Submit".Localize()); submitButton.Click += (sender, eventArgs) => { if (ValidateContactForm()) { ContactFormRequest postRequest = new ContactFormRequest(questionInput.Text, detailInput.Text, emailInput.Text, nameInput.Text, ""); contentRow.RemoveChildren(); contentRow.AddChild(messageContainer); submitButton.Visible = false; postRequest.RequestSucceeded += (s, e) => { submissionStatus.Text = "Thank you! Your information has been submitted.".Localize(); this.SetCancelButtonText("Done".Localize()); }; postRequest.RequestFailed += (s, e) => { submissionStatus.Text = "Sorry! We weren't able to submit your request.".Localize(); }; postRequest.Request(); } }; this.AddPageAction(submitButton); messageContainer = new FlowLayoutWidget(FlowDirection.TopToBottom) { HAnchor = HAnchor.Stretch, VAnchor = VAnchor.Stretch }; submissionStatus = new TextWidget("Submitting your information...".Localize(), pointSize: 13) { AutoExpandBoundsToText = true, Margin = new BorderDouble(0, 5), TextColor = theme.TextColor, HAnchor = HAnchor.Left }; messageContainer.AddChild(submissionStatus); // Default sizing results in too much top whitespace, revise Subject row to only be as big as content var subjectRow = CreateLabelRow("Subject".Localize()); subjectRow.VAnchor = VAnchor.Fit; contentRow.AddChild(subjectRow); contentRow.AddChild(questionInput = new MHTextEditWidget("", theme) { HAnchor = HAnchor.Stretch }); contentRow.AddChild(questionErrorMessage = CreateErrorRow()); contentRow.AddChild(CreateLabelRow("Message".Localize())); contentRow.AddChild(detailInput = new MHTextEditWidget("", theme, pixelHeight: 120, multiLine: true) { HAnchor = HAnchor.Stretch }); contentRow.AddChild(detailErrorMessage = CreateErrorRow()); contentRow.AddChild(CreateLabelRow("Email Address".Localize())); contentRow.AddChild(emailInput = new MHTextEditWidget("", theme) { HAnchor = HAnchor.Stretch }); contentRow.AddChild(emailErrorMessage = CreateErrorRow()); contentRow.AddChild(CreateLabelRow("Name".Localize())); contentRow.AddChild(nameInput = new MHTextEditWidget("", theme) { HAnchor = HAnchor.Stretch }); contentRow.AddChild(nameErrorMessage = CreateErrorRow()); }