private void OnCurWaChanged()
        {
            curExprList = new List <CExpression>();

            treeViewClass.Nodes[0].Nodes.Clear();

            string errmsg;

            foreach (NodeFormula nf in curWa.FormulaList)
            {
                treeViewClass.Nodes[0].Nodes.Add(nf.NodeName);

                for (int i = 0; i < 2; ++i)
                {
                    WeightFormula wf   = nf[i];
                    CExpression   expr = CExpression.Parse(wf.Formula, out errmsg);
                    if (expr == null)
                    {
                        string outmsg = "公式\"" + wf.Formula + "\"错误:" + errmsg;
                        XLog.Write(outmsg);
                        MessageBox.Show(outmsg);
                        return;
                    }
                    curExprList.Add(expr);
                }
            }

            treeViewClass.Nodes[0].Expand();

            curWaParas = curWa.GetParaList();

            dataGridViewParaInput.Rows.Clear();

            foreach (WeightParameter wp in curWaParas)
            {
                dataGridViewParaInput.Rows.Add(new object[] { wp.ParaName, wp.ParaValue, wp.ParaUnit, WeightParameter.ParaTypeList[wp.ParaType], wp.ParaRemark });
            }

            btnCompute.Enabled = true;
            flowLayoutPanelParaImport.Enabled = true;
            flowLayoutPanelParaExport.Enabled = true;
        }
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            //System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex("[\\*\\\\/:?<>|\"]");

            if (txtName.Text == string.Empty)
            {
                MessageBox.Show("算法名称不能为空!");
                return;
            }
            else
            {
                if (Verification.IsCheckSignleString(txtName.Text))
                {
                    MessageBox.Show("算法名称包含非法字符!");
                    txtName.Focus();
                    return;
                }
            }

            if (txtRemark.Text != string.Empty)
            {
                if (Verification.IsCheckRemarkString(txtRemark.Text))
                {
                    MessageBox.Show("算法备注包含非法字符!");
                    return;
                }
            }

            //更新节点
            waData.FormulaList.Clear();
            foreach (TreeNode node in treeViewWeightSortNode.Nodes[0].Nodes)
            {
                waData.FormulaList.Add((NodeFormula)node.Tag);
            }

            List <WeightParameter> templistpara = waData.GetParaList();
            bool bParaPrompt = false;

            foreach (WeightParameter wp in templistpara)
            {
                //if (wp.ParaType == 10 && wp.ParaUnit.Length == 0 && wp.ParaRemark.Length == 0)
                if (wp.ParaType == 10)
                {
                    bParaPrompt = true;
                    break;
                }
            }

            if (bParaPrompt)
            {
                if (MessageBox.Show("算法中含有未定义参数(临时参数)!\r\n保存算法前是否对这些参数进行设定?", "参数定义", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    List <WeightParameter> listparaforset = new List <WeightParameter>();
                    foreach (WeightParameter wp in templistpara)
                    {
                        // if (wp.ParaType == 10 && wp.ParaUnit.Length == 0 && wp.ParaRemark.Length == 0)
                        if (wp.ParaType == 10)
                        {
                            listparaforset.Add(wp);
                        }
                    }
                    TempWeightParaSet form = new TempWeightParaSet(listparaforset);
                    form.ShowDialog();
                }
            }

            bool bprompt = (strType == "edit") ? false : true;

            waData.Name           = txtName.Text;
            waData.CreateTime     = dateTimePickerCreateTime.Text;
            waData.LastModifyTime = dateTimePickerLastModifyTime.Text;
            waData.Remark         = txtRemark.Text;

            if (WriteArithmeticFile(waData, bprompt) == false)
            {
                return;
            }

            strCoreEnvelopeArithmeticFileName = waData.Name;

            this.DialogResult = DialogResult.OK;
            this.Close();
        }