//TODO Change error handling so that it stops the user until they correct the error // instead of just warning them //private bool IsTextempty() //{ // if (string.IsNullOrEmpty(title)) // return true; private void SaveHeaderAndFooter_MouseClick(object sender, MouseEventArgs e) { this.Hide(); //Creates a new generic tempate GenericTemplate newGenericTemplate = new GenericTemplate(); //Temporary storing strings set by textboxes string title = TitleTextBox.Text; string header = HeaderTextBox.Text; string footer = FooterTextBox.Text; //Exception Handling for "get" methods if (string.IsNullOrEmpty(title)) { //TODO code for handling here ErrorForm errorForm = new CVFeedbackApp.ErrorForm(); errorForm.Show(); } if (string.IsNullOrEmpty(header)) { //TODO code for handling here ErrorForm errorForm = new CVFeedbackApp.ErrorForm(); errorForm.Show(); } if (string.IsNullOrEmpty(footer)) { //TODO code for handling here ErrorForm errorForm = new CVFeedbackApp.ErrorForm(); errorForm.Show(); } //Using contructors from Generic template to store user input; newGenericTemplate.GetTemplateTitle(title); newGenericTemplate.GetHeader(header); newGenericTemplate.GetFooter(footer); //Creates AddOptionset Template and displays it AddOptionSet Optionset1 = new AddOptionSet(); Optionset1.ShowDialog(); }
private void SaveHeaderAndFooter_MouseClick(object sender, MouseEventArgs e) { this.Hide(); //Creates a new generic tempate GenericTemplate newGenericTemplate = new GenericTemplate(); //Temporary storing strings set by user input into textboxes string title = TitleTextBox.Text; string header = HeaderTextBox.Text; string footer = FooterTextBox.Text; //Exception Handling for "get" //is there text in the field? if (string.IsNullOrWhiteSpace(title)) { //TODO code for handling here //ErrorForm errorForm = new CVFeedbackApp.ErrorForm(); //errorForm.Show(); //trying messagebox instead of a form if (MessageBox.Show("One or more fields contain no text, you must go back.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Stop) == DialogResult.OK) { ; } { //what do do when button pressed this.Hide(); CreateNewTemplateForm NewCreateNewTemplateForm = new CreateNewTemplateForm(); NewCreateNewTemplateForm.ShowDialog(); } } else { //continue } //is there text in the field? if (string.IsNullOrWhiteSpace(header)) { if (MessageBox.Show("One or more fields contain no text, you must go back.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Stop) == DialogResult.OK) { ; } { //what do do when button pressed this.Hide(); CreateNewTemplateForm NewCreateNewTemplateForm = new CreateNewTemplateForm(); NewCreateNewTemplateForm.ShowDialog(); } } else { //continue } //is there text in the field? if (string.IsNullOrWhiteSpace(footer)) { if (MessageBox.Show("One or more fields contain no text, you must go back.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Stop) == DialogResult.OK) { ; } { //what do do when button pressed this.Hide(); CreateNewTemplateForm NewCreateNewTemplateForm = new CreateNewTemplateForm(); NewCreateNewTemplateForm.ShowDialog(); } } else { //continue } //Using contructors from Generic template to store user input; newGenericTemplate.GetTemplateTitle(title); newGenericTemplate.GetHeader(header); newGenericTemplate.GetFooter(footer); //Creates AddOptionset Template and displays it AddOptionSet Optionset1 = new AddOptionSet(); Optionset1.ShowDialog(); }