private void page_ValidationStateChanged(object sender, EventArgs args) { if (sender is IDataFlowComponentPage) { IDataFlowComponentPage page = sender as IDataFlowComponentPage; string msg = string.Empty; PageValidationStatus validationStatus = page.ValidatePage(out msg); if (validationStatus == PageValidationStatus.Ok || validationStatus == PageValidationStatus.Warning) { this.btnOK.Enabled = true; } else { this.btnOK.Enabled = false; } MessageBox.Show(msg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } }
private void btnOK_Click(object sender, EventArgs e) { IDataFlowComponentPage page = this.GetActivePage(); if (page != null) { string msg = String.Empty; PageValidationStatus validationStatus = page.ValidatePage(out msg); if (validationStatus == PageValidationStatus.Ok || validationStatus == PageValidationStatus.Warning) { if (!page.SavePage()) { this.canClosed = false; } this.canClosed = true; } else { this.canClosed = false; MessageBox.Show(msg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } } if (this.canClosed) { this.DialogResult = DialogResult.OK; } else { this.DialogResult = DialogResult.None; } }