Terminal window on Android shows softkeyboard.
White space formating
This commit is contained in:
parent
0af9175f97
commit
f6e243672a
2 changed files with 259 additions and 251 deletions
|
|
@ -48,299 +48,301 @@ using MatterHackers.Localizations;
|
|||
|
||||
namespace MatterHackers.MatterControl.ContactForm
|
||||
{
|
||||
public class ContactFormWidget : GuiWidget
|
||||
{
|
||||
protected TextImageButtonFactory textImageButtonFactory = new TextImageButtonFactory();
|
||||
protected TextImageButtonFactory whiteButtonFactory = new TextImageButtonFactory();
|
||||
Button submitButton;
|
||||
Button cancelButton;
|
||||
Button doneButton;
|
||||
FlowLayoutWidget formContainer;
|
||||
FlowLayoutWidget messageContainer;
|
||||
public class ContactFormWidget : GuiWidget
|
||||
{
|
||||
protected TextImageButtonFactory textImageButtonFactory = new TextImageButtonFactory();
|
||||
protected TextImageButtonFactory whiteButtonFactory = new TextImageButtonFactory();
|
||||
Button submitButton;
|
||||
Button cancelButton;
|
||||
Button doneButton;
|
||||
FlowLayoutWidget formContainer;
|
||||
FlowLayoutWidget messageContainer;
|
||||
|
||||
TextWidget submissionStatus;
|
||||
GuiWidget centerContainer;
|
||||
TextWidget submissionStatus;
|
||||
GuiWidget centerContainer;
|
||||
|
||||
MHTextEditWidget questionInput;
|
||||
TextWidget questionErrorMessage;
|
||||
MHTextEditWidget questionInput;
|
||||
TextWidget questionErrorMessage;
|
||||
|
||||
MHTextEditWidget detailInput;
|
||||
TextWidget detailErrorMessage;
|
||||
MHTextEditWidget detailInput;
|
||||
TextWidget detailErrorMessage;
|
||||
|
||||
MHTextEditWidget emailInput;
|
||||
TextWidget emailErrorMessage;
|
||||
MHTextEditWidget emailInput;
|
||||
TextWidget emailErrorMessage;
|
||||
|
||||
MHTextEditWidget nameInput;
|
||||
TextWidget nameErrorMessage;
|
||||
MHTextEditWidget nameInput;
|
||||
TextWidget nameErrorMessage;
|
||||
|
||||
public ContactFormWidget(string subjectText, string bodyText)
|
||||
{
|
||||
SetButtonAttributes();
|
||||
AnchorAll();
|
||||
public ContactFormWidget(string subjectText, string bodyText)
|
||||
{
|
||||
SetButtonAttributes();
|
||||
AnchorAll();
|
||||
|
||||
cancelButton = textImageButtonFactory.Generate(LocalizedString.Get("Cancel"));
|
||||
submitButton = textImageButtonFactory.Generate(LocalizedString.Get("Submit"));
|
||||
doneButton = textImageButtonFactory.Generate(LocalizedString.Get("Done"));
|
||||
doneButton.Visible = false;
|
||||
cancelButton = textImageButtonFactory.Generate(LocalizedString.Get("Cancel"));
|
||||
submitButton = textImageButtonFactory.Generate(LocalizedString.Get("Submit"));
|
||||
doneButton = textImageButtonFactory.Generate(LocalizedString.Get("Done"));
|
||||
doneButton.Visible = false;
|
||||
|
||||
DoLayout(subjectText, bodyText);
|
||||
AddButtonHandlers();
|
||||
}
|
||||
DoLayout(subjectText, bodyText);
|
||||
AddButtonHandlers();
|
||||
}
|
||||
|
||||
private GuiWidget LabelGenerator(string labelText, int fontSize = 12, int height = 28)
|
||||
{
|
||||
GuiWidget labelContainer = new GuiWidget();
|
||||
labelContainer.HAnchor = HAnchor.ParentLeftRight;
|
||||
private GuiWidget LabelGenerator(string labelText, int fontSize = 12, int height = 28)
|
||||
{
|
||||
GuiWidget labelContainer = new GuiWidget();
|
||||
labelContainer.HAnchor = HAnchor.ParentLeftRight;
|
||||
labelContainer.Height = height * TextWidget.GlobalPointSizeScaleRatio;
|
||||
|
||||
TextWidget formLabel = new TextWidget(labelText, pointSize: fontSize);
|
||||
formLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
formLabel.VAnchor = VAnchor.ParentBottom;
|
||||
formLabel.HAnchor = HAnchor.ParentLeft;
|
||||
formLabel.Margin = new BorderDouble(bottom: 2);
|
||||
TextWidget formLabel = new TextWidget(labelText, pointSize: fontSize);
|
||||
formLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
formLabel.VAnchor = VAnchor.ParentBottom;
|
||||
formLabel.HAnchor = HAnchor.ParentLeft;
|
||||
formLabel.Margin = new BorderDouble(bottom: 2);
|
||||
|
||||
labelContainer.AddChild(formLabel);
|
||||
labelContainer.AddChild(formLabel);
|
||||
|
||||
return labelContainer;
|
||||
}
|
||||
return labelContainer;
|
||||
}
|
||||
|
||||
private TextWidget ErrorMessageGenerator()
|
||||
{
|
||||
TextWidget formLabel = new TextWidget("", pointSize:11);
|
||||
formLabel.AutoExpandBoundsToText = true;
|
||||
formLabel.Margin = new BorderDouble(0, 5);
|
||||
formLabel.TextColor = RGBA_Bytes.Red;
|
||||
formLabel.HAnchor = HAnchor.ParentLeft;
|
||||
formLabel.Visible = false;
|
||||
private TextWidget ErrorMessageGenerator()
|
||||
{
|
||||
TextWidget formLabel = new TextWidget("", pointSize: 11);
|
||||
formLabel.AutoExpandBoundsToText = true;
|
||||
formLabel.Margin = new BorderDouble(0, 5);
|
||||
formLabel.TextColor = RGBA_Bytes.Red;
|
||||
formLabel.HAnchor = HAnchor.ParentLeft;
|
||||
formLabel.Visible = false;
|
||||
|
||||
return formLabel;
|
||||
}
|
||||
return formLabel;
|
||||
}
|
||||
|
||||
private void DoLayout(string subjectText, string bodyText)
|
||||
{
|
||||
FlowLayoutWidget mainContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
||||
mainContainer.AnchorAll();
|
||||
private void DoLayout(string subjectText, string bodyText)
|
||||
{
|
||||
FlowLayoutWidget mainContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
||||
mainContainer.AnchorAll();
|
||||
|
||||
GuiWidget labelContainer = new GuiWidget();
|
||||
labelContainer.HAnchor = HAnchor.ParentLeftRight;
|
||||
labelContainer.Height = 30;
|
||||
GuiWidget labelContainer = new GuiWidget();
|
||||
labelContainer.HAnchor = HAnchor.ParentLeftRight;
|
||||
labelContainer.Height = 30;
|
||||
|
||||
TextWidget formLabel = new TextWidget(LocalizedString.Get("How can we help?"), pointSize: 16);
|
||||
formLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
formLabel.VAnchor = VAnchor.ParentTop;
|
||||
formLabel.HAnchor = HAnchor.ParentLeft;
|
||||
formLabel.Margin = new BorderDouble(6, 3,6,6);
|
||||
labelContainer.AddChild(formLabel);
|
||||
mainContainer.AddChild(labelContainer);
|
||||
TextWidget formLabel = new TextWidget(LocalizedString.Get("How can we help?"), pointSize: 16);
|
||||
formLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
formLabel.VAnchor = VAnchor.ParentTop;
|
||||
formLabel.HAnchor = HAnchor.ParentLeft;
|
||||
formLabel.Margin = new BorderDouble(6, 3, 6, 6);
|
||||
labelContainer.AddChild(formLabel);
|
||||
mainContainer.AddChild(labelContainer);
|
||||
|
||||
centerContainer = new GuiWidget();
|
||||
centerContainer.AnchorAll();
|
||||
centerContainer.Padding = new BorderDouble(3,0,3,3);
|
||||
centerContainer = new GuiWidget();
|
||||
centerContainer.AnchorAll();
|
||||
centerContainer.Padding = new BorderDouble(3, 0, 3, 3);
|
||||
|
||||
messageContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
||||
messageContainer.AnchorAll();
|
||||
messageContainer.Visible = false;
|
||||
messageContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
|
||||
messageContainer.Padding = new BorderDouble(10);
|
||||
messageContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
||||
messageContainer.AnchorAll();
|
||||
messageContainer.Visible = false;
|
||||
messageContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
|
||||
messageContainer.Padding = new BorderDouble(10);
|
||||
|
||||
submissionStatus = new TextWidget(LocalizedString.Get("Submitting your information..."), pointSize: 13);
|
||||
submissionStatus.AutoExpandBoundsToText = true;
|
||||
submissionStatus.Margin = new BorderDouble(0, 5);
|
||||
submissionStatus = new TextWidget(LocalizedString.Get("Submitting your information..."), pointSize: 13);
|
||||
submissionStatus.AutoExpandBoundsToText = true;
|
||||
submissionStatus.Margin = new BorderDouble(0, 5);
|
||||
submissionStatus.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
submissionStatus.HAnchor = HAnchor.ParentLeft;
|
||||
submissionStatus.HAnchor = HAnchor.ParentLeft;
|
||||
|
||||
messageContainer.AddChild(submissionStatus);
|
||||
messageContainer.AddChild(submissionStatus);
|
||||
|
||||
formContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
||||
formContainer.AnchorAll();
|
||||
formContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
|
||||
formContainer.Padding = new BorderDouble(10);
|
||||
formContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
||||
formContainer.AnchorAll();
|
||||
formContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
|
||||
formContainer.Padding = new BorderDouble(10);
|
||||
|
||||
formContainer.AddChild(LabelGenerator(LocalizedString.Get("Question*")));
|
||||
formContainer.AddChild(LabelGenerator(LocalizedString.Get("Briefly describe your question"), 9, 14));
|
||||
formContainer.AddChild(LabelGenerator(LocalizedString.Get("Question*")));
|
||||
formContainer.AddChild(LabelGenerator(LocalizedString.Get("Briefly describe your question"), 9, 14));
|
||||
|
||||
questionInput = new MHTextEditWidget(subjectText);
|
||||
questionInput.HAnchor = HAnchor.ParentLeftRight;
|
||||
formContainer.AddChild(questionInput);
|
||||
questionInput = new MHTextEditWidget(subjectText);
|
||||
questionInput.HAnchor = HAnchor.ParentLeftRight;
|
||||
formContainer.AddChild(questionInput);
|
||||
|
||||
questionErrorMessage = ErrorMessageGenerator();
|
||||
formContainer.AddChild(questionErrorMessage);
|
||||
questionErrorMessage = ErrorMessageGenerator();
|
||||
formContainer.AddChild(questionErrorMessage);
|
||||
|
||||
formContainer.AddChild(LabelGenerator(LocalizedString.Get("Details*")));
|
||||
formContainer.AddChild(LabelGenerator(LocalizedString.Get("Fill in the details here"), 9, 14));
|
||||
formContainer.AddChild(LabelGenerator(LocalizedString.Get("Details*")));
|
||||
formContainer.AddChild(LabelGenerator(LocalizedString.Get("Fill in the details here"), 9, 14));
|
||||
|
||||
detailInput = new MHTextEditWidget(bodyText, pixelHeight: 120, multiLine: true);
|
||||
detailInput.HAnchor = HAnchor.ParentLeftRight;
|
||||
formContainer.AddChild(detailInput);
|
||||
detailInput = new MHTextEditWidget(bodyText, pixelHeight: 120, multiLine: true);
|
||||
detailInput.HAnchor = HAnchor.ParentLeftRight;
|
||||
formContainer.AddChild(detailInput);
|
||||
|
||||
detailErrorMessage = ErrorMessageGenerator();
|
||||
formContainer.AddChild(detailErrorMessage);
|
||||
detailErrorMessage = ErrorMessageGenerator();
|
||||
formContainer.AddChild(detailErrorMessage);
|
||||
|
||||
formContainer.AddChild(LabelGenerator(LocalizedString.Get("Your Email Address*")));
|
||||
formContainer.AddChild(LabelGenerator(LocalizedString.Get("Your Email Address*")));
|
||||
|
||||
emailInput = new MHTextEditWidget();
|
||||
emailInput.HAnchor = HAnchor.ParentLeftRight;
|
||||
formContainer.AddChild(emailInput);
|
||||
emailInput = new MHTextEditWidget();
|
||||
emailInput.HAnchor = HAnchor.ParentLeftRight;
|
||||
formContainer.AddChild(emailInput);
|
||||
|
||||
emailErrorMessage = ErrorMessageGenerator();
|
||||
formContainer.AddChild(emailErrorMessage);
|
||||
emailErrorMessage = ErrorMessageGenerator();
|
||||
formContainer.AddChild(emailErrorMessage);
|
||||
|
||||
formContainer.AddChild(LabelGenerator(LocalizedString.Get("Your Name*")));
|
||||
formContainer.AddChild(LabelGenerator(LocalizedString.Get("Your Name*")));
|
||||
|
||||
nameInput = new MHTextEditWidget();
|
||||
nameInput.HAnchor = HAnchor.ParentLeftRight;
|
||||
formContainer.AddChild(nameInput);
|
||||
nameInput = new MHTextEditWidget();
|
||||
nameInput.HAnchor = HAnchor.ParentLeftRight;
|
||||
formContainer.AddChild(nameInput);
|
||||
|
||||
nameErrorMessage = ErrorMessageGenerator();
|
||||
formContainer.AddChild(nameErrorMessage);
|
||||
nameErrorMessage = ErrorMessageGenerator();
|
||||
formContainer.AddChild(nameErrorMessage);
|
||||
|
||||
centerContainer.AddChild(formContainer);
|
||||
centerContainer.AddChild(formContainer);
|
||||
|
||||
mainContainer.AddChild(centerContainer);
|
||||
|
||||
FlowLayoutWidget buttonBottomPanel = GetButtonButtonPanel();
|
||||
buttonBottomPanel.AddChild(submitButton);
|
||||
buttonBottomPanel.AddChild(cancelButton);
|
||||
buttonBottomPanel.AddChild(doneButton);
|
||||
mainContainer.AddChild(centerContainer);
|
||||
|
||||
mainContainer.AddChild(buttonBottomPanel);
|
||||
FlowLayoutWidget buttonBottomPanel = GetButtonButtonPanel();
|
||||
buttonBottomPanel.AddChild(submitButton);
|
||||
buttonBottomPanel.AddChild(cancelButton);
|
||||
buttonBottomPanel.AddChild(doneButton);
|
||||
|
||||
this.AddChild(mainContainer);
|
||||
}
|
||||
mainContainer.AddChild(buttonBottomPanel);
|
||||
|
||||
private bool ValidateContactForm()
|
||||
{
|
||||
ValidationMethods validationMethods = new ValidationMethods();
|
||||
|
||||
List<FormField> formFields = new List<FormField>{};
|
||||
FormField.ValidationHandler[] stringValidationHandlers = new FormField.ValidationHandler[] { validationMethods.StringIsNotEmpty };
|
||||
FormField.ValidationHandler[] emailValidationHandlers = new FormField.ValidationHandler[] { validationMethods.StringIsNotEmpty, validationMethods.StringLooksLikeEmail };
|
||||
this.AddChild(mainContainer);
|
||||
}
|
||||
|
||||
formFields.Add(new FormField(questionInput, questionErrorMessage, stringValidationHandlers));
|
||||
formFields.Add(new FormField(detailInput, detailErrorMessage, stringValidationHandlers));
|
||||
formFields.Add(new FormField(emailInput, emailErrorMessage, emailValidationHandlers));
|
||||
formFields.Add(new FormField(nameInput, nameErrorMessage, stringValidationHandlers));
|
||||
private bool ValidateContactForm()
|
||||
{
|
||||
ValidationMethods validationMethods = new ValidationMethods();
|
||||
|
||||
bool formIsValid = true;
|
||||
foreach (FormField formField in formFields)
|
||||
{
|
||||
formField.FieldErrorMessageWidget.Visible = false;
|
||||
bool fieldIsValid = formField.Validate();
|
||||
if (!fieldIsValid)
|
||||
{
|
||||
formIsValid = false;
|
||||
}
|
||||
}
|
||||
return formIsValid;
|
||||
}
|
||||
List<FormField> formFields = new List<FormField> { };
|
||||
FormField.ValidationHandler[] stringValidationHandlers = new FormField.ValidationHandler[] { validationMethods.StringIsNotEmpty };
|
||||
FormField.ValidationHandler[] emailValidationHandlers = new FormField.ValidationHandler[] { validationMethods.StringIsNotEmpty, validationMethods.StringLooksLikeEmail };
|
||||
|
||||
private void AddButtonHandlers()
|
||||
{
|
||||
cancelButton.Click += (sender, e) => {
|
||||
UiThread.RunOnIdle((state) =>
|
||||
{
|
||||
Close();
|
||||
});
|
||||
};
|
||||
doneButton.Click += (sender, e) => {
|
||||
UiThread.RunOnIdle((state) =>
|
||||
{
|
||||
Close();
|
||||
});
|
||||
};
|
||||
submitButton.Click += new EventHandler(SubmitContactForm);
|
||||
}
|
||||
formFields.Add(new FormField(questionInput, questionErrorMessage, stringValidationHandlers));
|
||||
formFields.Add(new FormField(detailInput, detailErrorMessage, stringValidationHandlers));
|
||||
formFields.Add(new FormField(emailInput, emailErrorMessage, emailValidationHandlers));
|
||||
formFields.Add(new FormField(nameInput, nameErrorMessage, stringValidationHandlers));
|
||||
|
||||
void SubmitContactForm(object sender, EventArgs mouseEvent)
|
||||
{
|
||||
if (ValidateContactForm())
|
||||
{
|
||||
ContactFormRequest postRequest = new ContactFormRequest(questionInput.Text, detailInput.Text, emailInput.Text, nameInput.Text, "");
|
||||
bool formIsValid = true;
|
||||
foreach (FormField formField in formFields)
|
||||
{
|
||||
formField.FieldErrorMessageWidget.Visible = false;
|
||||
bool fieldIsValid = formField.Validate();
|
||||
if (!fieldIsValid)
|
||||
{
|
||||
formIsValid = false;
|
||||
}
|
||||
}
|
||||
return formIsValid;
|
||||
}
|
||||
|
||||
formContainer.Visible = false;
|
||||
messageContainer.Visible = true;
|
||||
|
||||
centerContainer.RemoveAllChildren();
|
||||
centerContainer.AddChild(messageContainer);
|
||||
private void AddButtonHandlers()
|
||||
{
|
||||
cancelButton.Click += (sender, e) =>
|
||||
{
|
||||
UiThread.RunOnIdle((state) =>
|
||||
{
|
||||
Close();
|
||||
});
|
||||
};
|
||||
doneButton.Click += (sender, e) =>
|
||||
{
|
||||
UiThread.RunOnIdle((state) =>
|
||||
{
|
||||
Close();
|
||||
});
|
||||
};
|
||||
submitButton.Click += new EventHandler(SubmitContactForm);
|
||||
}
|
||||
|
||||
cancelButton.Visible = false;
|
||||
submitButton.Visible = false;
|
||||
void SubmitContactForm(object sender, EventArgs mouseEvent)
|
||||
{
|
||||
if (ValidateContactForm())
|
||||
{
|
||||
ContactFormRequest postRequest = new ContactFormRequest(questionInput.Text, detailInput.Text, emailInput.Text, nameInput.Text, "");
|
||||
|
||||
postRequest.RequestSucceeded += new EventHandler(onPostRequestSucceeded);
|
||||
postRequest.RequestFailed += new EventHandler(onPostRequestFailed);
|
||||
postRequest.Request();
|
||||
}
|
||||
}
|
||||
formContainer.Visible = false;
|
||||
messageContainer.Visible = true;
|
||||
|
||||
void onPostRequestSucceeded(object sender, EventArgs e)
|
||||
{
|
||||
submissionStatus.Text = LocalizedString.Get("Thank you! Your information has been submitted.");
|
||||
doneButton.Visible = true;
|
||||
}
|
||||
centerContainer.RemoveAllChildren();
|
||||
centerContainer.AddChild(messageContainer);
|
||||
|
||||
void onPostRequestFailed(object sender, EventArgs e)
|
||||
{
|
||||
submissionStatus.Text = LocalizedString.Get("Sorry! We weren't able to submit your request.");
|
||||
doneButton.Visible = true;
|
||||
}
|
||||
cancelButton.Visible = false;
|
||||
submitButton.Visible = false;
|
||||
|
||||
private FlowLayoutWidget GetButtonButtonPanel()
|
||||
{
|
||||
FlowLayoutWidget buttonBottomPanel = new FlowLayoutWidget(FlowDirection.LeftToRight);
|
||||
buttonBottomPanel.HAnchor = HAnchor.ParentLeftRight;
|
||||
buttonBottomPanel.Padding = new BorderDouble(3, 3);
|
||||
buttonBottomPanel.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
|
||||
return buttonBottomPanel;
|
||||
}
|
||||
postRequest.RequestSucceeded += new EventHandler(onPostRequestSucceeded);
|
||||
postRequest.RequestFailed += new EventHandler(onPostRequestFailed);
|
||||
postRequest.Request();
|
||||
}
|
||||
}
|
||||
|
||||
private void SetButtonAttributes()
|
||||
{
|
||||
void onPostRequestSucceeded(object sender, EventArgs e)
|
||||
{
|
||||
submissionStatus.Text = LocalizedString.Get("Thank you! Your information has been submitted.");
|
||||
doneButton.Visible = true;
|
||||
}
|
||||
|
||||
void onPostRequestFailed(object sender, EventArgs e)
|
||||
{
|
||||
submissionStatus.Text = LocalizedString.Get("Sorry! We weren't able to submit your request.");
|
||||
doneButton.Visible = true;
|
||||
}
|
||||
|
||||
private FlowLayoutWidget GetButtonButtonPanel()
|
||||
{
|
||||
FlowLayoutWidget buttonBottomPanel = new FlowLayoutWidget(FlowDirection.LeftToRight);
|
||||
buttonBottomPanel.HAnchor = HAnchor.ParentLeftRight;
|
||||
buttonBottomPanel.Padding = new BorderDouble(3, 3);
|
||||
buttonBottomPanel.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
|
||||
return buttonBottomPanel;
|
||||
}
|
||||
|
||||
private void SetButtonAttributes()
|
||||
{
|
||||
textImageButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
textImageButtonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
textImageButtonFactory.disabledTextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
textImageButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
|
||||
whiteButtonFactory.FixedWidth = 138 * TextWidget.GlobalPointSizeScaleRatio;
|
||||
whiteButtonFactory.normalFillColor = RGBA_Bytes.White;
|
||||
whiteButtonFactory.normalTextColor = RGBA_Bytes.Black;
|
||||
whiteButtonFactory.hoverTextColor = RGBA_Bytes.Black;
|
||||
whiteButtonFactory.hoverFillColor = new RGBA_Bytes(255, 255, 255, 200);
|
||||
}
|
||||
}
|
||||
whiteButtonFactory.normalFillColor = RGBA_Bytes.White;
|
||||
whiteButtonFactory.normalTextColor = RGBA_Bytes.Black;
|
||||
whiteButtonFactory.hoverTextColor = RGBA_Bytes.Black;
|
||||
whiteButtonFactory.hoverFillColor = new RGBA_Bytes(255, 255, 255, 200);
|
||||
}
|
||||
}
|
||||
|
||||
public class ContactFormWindow : SystemWindow
|
||||
{
|
||||
static ContactFormWindow contactFormWindow;
|
||||
static bool contactFormIsOpen;
|
||||
public class ContactFormWindow : SystemWindow
|
||||
{
|
||||
static ContactFormWindow contactFormWindow;
|
||||
static bool contactFormIsOpen;
|
||||
|
||||
static public void Open(string subject = "", string bodyText = "")
|
||||
{
|
||||
if (!contactFormIsOpen)
|
||||
{
|
||||
contactFormWindow = new ContactFormWindow(subject, bodyText);
|
||||
contactFormIsOpen = true;
|
||||
contactFormWindow.Closed += (sender, e) => { contactFormIsOpen = false; };
|
||||
}
|
||||
else
|
||||
{
|
||||
if (contactFormWindow != null)
|
||||
{
|
||||
contactFormWindow.BringToFront();
|
||||
}
|
||||
}
|
||||
}
|
||||
static public void Open(string subject = "", string bodyText = "")
|
||||
{
|
||||
if (!contactFormIsOpen)
|
||||
{
|
||||
contactFormWindow = new ContactFormWindow(subject, bodyText);
|
||||
contactFormIsOpen = true;
|
||||
contactFormWindow.Closed += (sender, e) => { contactFormIsOpen = false; };
|
||||
}
|
||||
else
|
||||
{
|
||||
if (contactFormWindow != null)
|
||||
{
|
||||
contactFormWindow.BringToFront();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ContactFormWidget contactFormWidget;
|
||||
ContactFormWidget contactFormWidget;
|
||||
|
||||
private ContactFormWindow(string subject = "", string bodyText = "")
|
||||
: base(500, 550)
|
||||
{
|
||||
AlwaysOnTopOfMain = true;
|
||||
Title = LocalizedString.Get("MatterControl: Submit an Issue");
|
||||
private ContactFormWindow(string subject = "", string bodyText = "")
|
||||
: base(500, 550)
|
||||
{
|
||||
AlwaysOnTopOfMain = true;
|
||||
Title = LocalizedString.Get("MatterControl: Submit an Issue");
|
||||
|
||||
BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
|
||||
BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
|
||||
|
||||
contactFormWidget = new ContactFormWidget(subject, bodyText);
|
||||
contactFormWidget = new ContactFormWidget(subject, bodyText);
|
||||
|
||||
#if __ANDROID__
|
||||
this.AddChild(new SoftKeyboardContentOffset(contactFormWidget, SoftKeyboardContentOffset.AndroidKeyboardOffset));
|
||||
|
|
@ -349,29 +351,29 @@ namespace MatterHackers.MatterControl.ContactForm
|
|||
#endif
|
||||
AddHandlers();
|
||||
|
||||
ShowAsSystemWindow();
|
||||
MinimumSize = new Vector2(500, 550);
|
||||
}
|
||||
ShowAsSystemWindow();
|
||||
MinimumSize = new Vector2(500, 550);
|
||||
}
|
||||
|
||||
event EventHandler unregisterEvents;
|
||||
private void AddHandlers()
|
||||
{
|
||||
ActiveTheme.Instance.ThemeChanged.RegisterEvent(ThemeChanged, ref unregisterEvents);
|
||||
contactFormWidget.Closed += (sender, e) => { Close(); };
|
||||
}
|
||||
event EventHandler unregisterEvents;
|
||||
private void AddHandlers()
|
||||
{
|
||||
ActiveTheme.Instance.ThemeChanged.RegisterEvent(ThemeChanged, ref unregisterEvents);
|
||||
contactFormWidget.Closed += (sender, e) => { Close(); };
|
||||
}
|
||||
|
||||
public override void OnClosed(EventArgs e)
|
||||
{
|
||||
if (unregisterEvents != null)
|
||||
{
|
||||
unregisterEvents(this, null);
|
||||
}
|
||||
base.OnClosed(e);
|
||||
}
|
||||
public override void OnClosed(EventArgs e)
|
||||
{
|
||||
if (unregisterEvents != null)
|
||||
{
|
||||
unregisterEvents(this, null);
|
||||
}
|
||||
base.OnClosed(e);
|
||||
}
|
||||
|
||||
public void ThemeChanged(object sender, EventArgs e)
|
||||
{
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
public void ThemeChanged(object sender, EventArgs e)
|
||||
{
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue