private bool ValidateForm() { if (!MaskValidation.ValidateMaskName(txtName, Mask)) { return(false); } if (!MaskValidation.ValidateShapeFile(ucPolygon) || !MaskValidation.ValidateShapefileProjection(ucPolygon)) { return(false); } if (!MaskValidation.ValidateField(cboField)) { return(false); } if (MaskItems.Count < 1) { MessageBox.Show(string.Format("The ShapeFile selected does not contain any valid string values in the {0} field. Please choose a different field or ShapeFile.", cboField.Text), "No Field Values", MessageBoxButtons.OK, MessageBoxIcon.Information); cboField.Select(); return(false); } if (MaskItems.Count(x => x.Include) < 1) { MessageBox.Show("You must check the box beside at least one field value.", "No Field Values Included", MessageBoxButtons.OK, MessageBoxIcon.Information); grdData.Select(); return(false); } return(true); }
private bool ValidateForm() { if (!MaskValidation.ValidateMaskName(txtName, AOIMask)) { return(false); } if (AOIMask == null) { if (!MaskValidation.ValidateShapeFile(ucPolygon) || !MaskValidation.ValidateShapefileProjection(ucPolygon)) { return(false); } } return(true); }
private bool ValidateForm() { if (!MaskValidation.ValidateMaskName(txtName, Mask)) { return(false); } if (Mask == null) { if (!MaskValidation.ValidateShapeFile(ucPolygon) || !MaskValidation.ValidateShapefileProjection(ucPolygon)) { return(false); } } if (!MaskValidation.ValidateField(cboField)) { return(false); } if (chkLabel.Checked) { if (cboLabel.SelectedIndex < 0) { MessageBox.Show("You must select a text field in the ShapeFile that provides mask labels or uncheck the label checkbox.", "Missing Label Field", MessageBoxButtons.OK, MessageBoxIcon.Information); cboLabel.Select(); return(false); } if (string.Compare(cboLabel.Text, cboField.Text, true) == 0) { MessageBox.Show("You cannot select the same ShapeFile field for both the mask field and label." + " Please choose different fields or uncheck the label checkbox to proceed with just mask field values as the mask definition.", "Duplicate Field Selection", MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } } if (chkDistance.Checked) { if (cboDistance.SelectedIndex < 0) { MessageBox.Show("You must select a floating point field in the ShapeFile that provides distance values or uncheck the distance checkbox.", "Missing Distance Field", MessageBoxButtons.OK, MessageBoxIcon.Information); cboDistance.Select(); return(false); } if (Mask == null) { if (ucPolygon.SelectedItem.Features.Values.Any(x => x.IsNull(cboDistance.Text))) { MessageBox.Show(string.Format("One or more features in the ShapeFile have null or invalid values in the {0} field. A valid distance field must possess valid floating point values for all features.", cboDistance.Text), "Invalid Distance Values", MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } } } if (cboDirection.SelectedIndex < 0) { MessageBox.Show("Directional masks require an integer direction field that specifies how the features are ordered from top to bottom of the reach. " + DirectionFieldInfo, "Missing Direction Field", MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } if (Mask == null) { if (ucPolygon.SelectedItem.Features.Values.Any(x => x.IsNull(cboDirection.Text))) { MessageBox.Show(string.Format("One or more features in the ShapeFile have null or invalid values in the {0} field. {1}", cboDistance.Text, DirectionFieldInfo), "Invalid Direction Values", MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } } if (!ValidateDirectionFieldValues()) { return(false); } return(true); }