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

            string errmsg;

            foreach (WeightFormula wf in curWa.FormulaList)
            {
                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);
            }

            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)
        {
            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;
                }
            }

            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.SortName       = comboBoxWeightSort.Text;
            waData.Name           = txtName.Text;
            waData.CreateTime     = dateTimePickerCreateTime.Text;
            waData.LastModifyTime = dateTimePickerLastModifyTime.Text;
            waData.Remark         = txtRemark.Text;

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

            strWeightSortName           = waData.SortName;
            strWeightArithmeticFileName = waData.Name;

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