コード例 #1
0
        private void treeView_BeforeSelect(object sender, TreeViewCancelEventArgs e)
        {
            if (this.treeView.SelectedNode == null)
            {
                return;
            }

            if (this.treeView.SelectedNode.Tag is IDataFlowComponentPage)
            {
                IDataFlowComponentPage page = this.treeView.SelectedNode.Tag as IDataFlowComponentPage;

                string msg = string.Empty;

                if (page.ValidatePage(out msg) != PageValidationStatus.NoPageLeave)
                {
                    if (!page.HidePage())
                    {
                        e.Cancel = true;
                    }
                }
                else
                {
                    e.Cancel = true;
                }

                if (!string.IsNullOrEmpty(msg))
                {
                    MessageBox.Show(msg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error,
                                    MessageBoxDefaultButton.Button1);
                }
            }
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        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;
            }
        }