Revise helper naming, collapse statements to better convey role
This commit is contained in:
parent
d69dc4e3bc
commit
d2dcf4707b
1 changed files with 33 additions and 39 deletions
|
|
@ -77,7 +77,7 @@ namespace MatterHackers.MatterControl.ContactForm
|
||||||
DoLayout();
|
DoLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
private GuiWidget LabelGenerator(string labelText, int fontSize = 12, int height = 28)
|
private GuiWidget CreateLabelRow(string labelText, int fontSize = 12, int height = 28)
|
||||||
{
|
{
|
||||||
var labelContainer = new GuiWidget
|
var labelContainer = new GuiWidget
|
||||||
{
|
{
|
||||||
|
|
@ -96,7 +96,7 @@ namespace MatterHackers.MatterControl.ContactForm
|
||||||
return labelContainer;
|
return labelContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
private TextWidget ErrorMessageGenerator()
|
private TextWidget CreateErrorRow()
|
||||||
{
|
{
|
||||||
return new TextWidget("", pointSize: 11)
|
return new TextWidget("", pointSize: 11)
|
||||||
{
|
{
|
||||||
|
|
@ -116,52 +116,46 @@ namespace MatterHackers.MatterControl.ContactForm
|
||||||
VAnchor = VAnchor.Stretch
|
VAnchor = VAnchor.Stretch
|
||||||
};
|
};
|
||||||
|
|
||||||
submissionStatus = new TextWidget("Submitting your information...".Localize(), pointSize: 13);
|
submissionStatus = new TextWidget("Submitting your information...".Localize(), pointSize: 13)
|
||||||
submissionStatus.AutoExpandBoundsToText = true;
|
{
|
||||||
submissionStatus.Margin = new BorderDouble(0, 5);
|
AutoExpandBoundsToText = true,
|
||||||
submissionStatus.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
Margin = new BorderDouble(0, 5),
|
||||||
submissionStatus.HAnchor = HAnchor.Left;
|
TextColor = ActiveTheme.Instance.PrimaryTextColor,
|
||||||
|
HAnchor = HAnchor.Left
|
||||||
|
};
|
||||||
|
|
||||||
messageContainer.AddChild(submissionStatus);
|
messageContainer.AddChild(submissionStatus);
|
||||||
|
|
||||||
// Default sizing results in too much top whitespace, revise Subject row to only be as big as content
|
// Default sizing results in too much top whitespace, revise Subject row to only be as big as content
|
||||||
var subjectRow = LabelGenerator("Subject*".Localize());
|
var subjectRow = CreateLabelRow("Subject*".Localize());
|
||||||
subjectRow.VAnchor = VAnchor.Fit;
|
subjectRow.VAnchor = VAnchor.Fit;
|
||||||
contentRow.AddChild(subjectRow);
|
contentRow.AddChild(subjectRow);
|
||||||
|
contentRow.AddChild(questionInput = new MHTextEditWidget("")
|
||||||
|
{
|
||||||
|
HAnchor = HAnchor.Stretch
|
||||||
|
});
|
||||||
|
contentRow.AddChild(questionErrorMessage = CreateErrorRow());
|
||||||
|
|
||||||
questionInput = new MHTextEditWidget("");
|
contentRow.AddChild(CreateLabelRow("Message*".Localize()));
|
||||||
questionInput.HAnchor = HAnchor.Stretch;
|
contentRow.AddChild(detailInput = new MHTextEditWidget("", pixelHeight: 120, multiLine: true)
|
||||||
contentRow.AddChild(questionInput);
|
{
|
||||||
|
HAnchor = HAnchor.Stretch
|
||||||
|
});
|
||||||
|
contentRow.AddChild(detailErrorMessage = CreateErrorRow());
|
||||||
|
|
||||||
questionErrorMessage = ErrorMessageGenerator();
|
contentRow.AddChild(CreateLabelRow("Email Address*".Localize()));
|
||||||
contentRow.AddChild(questionErrorMessage);
|
contentRow.AddChild(emailInput = new MHTextEditWidget
|
||||||
|
{
|
||||||
|
HAnchor = HAnchor.Stretch
|
||||||
|
});
|
||||||
|
contentRow.AddChild(emailErrorMessage = CreateErrorRow());
|
||||||
|
|
||||||
contentRow.AddChild(LabelGenerator("Message*".Localize()));
|
contentRow.AddChild(CreateLabelRow("Name*".Localize()));
|
||||||
|
contentRow.AddChild(nameInput = new MHTextEditWidget
|
||||||
detailInput = new MHTextEditWidget("", pixelHeight: 120, multiLine: true);
|
{
|
||||||
detailInput.HAnchor = HAnchor.Stretch;
|
HAnchor = HAnchor.Stretch
|
||||||
contentRow.AddChild(detailInput);
|
});
|
||||||
|
contentRow.AddChild(nameErrorMessage = CreateErrorRow());
|
||||||
detailErrorMessage = ErrorMessageGenerator();
|
|
||||||
contentRow.AddChild(detailErrorMessage);
|
|
||||||
|
|
||||||
contentRow.AddChild(LabelGenerator("Email Address*".Localize()));
|
|
||||||
|
|
||||||
emailInput = new MHTextEditWidget();
|
|
||||||
emailInput.HAnchor = HAnchor.Stretch;
|
|
||||||
contentRow.AddChild(emailInput);
|
|
||||||
|
|
||||||
emailErrorMessage = ErrorMessageGenerator();
|
|
||||||
contentRow.AddChild(emailErrorMessage);
|
|
||||||
|
|
||||||
contentRow.AddChild(LabelGenerator("Name*".Localize()));
|
|
||||||
|
|
||||||
nameInput = new MHTextEditWidget();
|
|
||||||
nameInput.HAnchor = HAnchor.Stretch;
|
|
||||||
contentRow.AddChild(nameInput);
|
|
||||||
|
|
||||||
nameErrorMessage = ErrorMessageGenerator();
|
|
||||||
contentRow.AddChild(nameErrorMessage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ValidateContactForm()
|
private bool ValidateContactForm()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue