private void btnCompute_Click(object sender, EventArgs e)
        {
            if (!bEditProject)
            {
                txtWeightEstName.Text = txtWeightEstName.Text.Trim();
                if (txtWeightEstName.Text.Length == 0)
                {
                    MessageBox.Show("设计数据名称不能为空!");
                    return;
                }

                if (Verification.IsCheckString(txtWeightEstName.Text))
                {
                    MessageBox.Show("设计数据名称含有非法字符");
                    return;
                }

                curWa.DataName = txtWeightEstName.Text;
            }

            for (int i = 0; i < curWa.FormulaList.Count; ++i)
            {
                CExpression expr = curExprList[2 * i];
                foreach (WeightParameter wp in curWa.FormulaList[i].XFormula.ParaList)
                {
                    expr.SetVariableValue(wp.ParaName, wp.ParaValue);
                }
                curWa.FormulaList[i].XFormula.Value = expr.Run();

                expr = curExprList[2 * i + 1];
                foreach (WeightParameter wp in curWa.FormulaList[i].YFormula.ParaList)
                {
                    expr.SetVariableValue(wp.ParaName, wp.ParaValue);
                }
                curWa.FormulaList[i].YFormula.Value = expr.Run();
            }

            // curWa.WriteArithmeticFile("test.xml", true);

            if (mainForm.designProjectData == null)
            {
                CoreDesignProject coreForm = new CoreDesignProject(mainForm, "new");
                coreForm.ShowDialog();
            }

            if (mainForm.designProjectData.lstCoreEnvelopeDesign == null)
            {
                mainForm.designProjectData.lstCoreEnvelopeDesign = new List <Model.CoreEnvelopeArithmetic>();
            }


            Dictionary <WeightParameter, WeightParameter> wpDict = new Dictionary <WeightParameter, WeightParameter>();

            List <WeightFormula> FormulaList = new List <WeightFormula>();

            foreach (NodeFormula ndformula in curWa.FormulaList)
            {
                for (int i = 0; i < 2; ++i)
                {
                    WeightFormula          formula  = ndformula[i];
                    List <WeightParameter> ParaList = new List <WeightParameter>();
                    foreach (WeightParameter para in formula.ParaList)
                    {
                        WeightParameter tempWp = null;
                        if (!wpDict.ContainsKey(para))
                        {
                            tempWp = new WeightParameter(para);
                            wpDict.Add(para, tempWp);
                        }
                        else
                        {
                            tempWp = wpDict[para];
                        }
                        ParaList.Add(tempWp);
                    }
                    formula.ParaList = ParaList;
                }
            }
            if (!bEditProject)
            {
                mainForm.designProjectData.lstCoreEnvelopeDesign.Add(curWa);
                mainForm.BindProjectTreeData(mainForm.designProjectData);
                mainForm.SetCoreEnvelopeDesignTab(curWa, mainForm.designProjectData.lstCoreEnvelopeDesign.Count - 1);
                XLog.Write("设计数据\"" + txtWeightEstName.Text + "\"计算完成!");
            }
            else
            {
                //设置页面数据
                mainForm.SetCoreEnvelopeDesignResult(curWa);
                XLog.Write("设计数据\"" + txtWeightEstName.Text + "\"重新计算完成!");
            }

            DialogResult = DialogResult.OK;
            Close();
        }
        private void btnCompute_Click(object sender, EventArgs e)
        {
            if (!bEditProject)
            {
                txtWeightEstName.Text = txtWeightEstName.Text.Trim();
                if (txtWeightEstName.Text.Length == 0)
                {
                    MessageBox.Show("设计数据名称不能为空!");
                    return;
                }

                if (Verification.IsCheckString(txtWeightEstName.Text))
                {
                    MessageBox.Show("设计数据名称含有非法字符");
                    return;
                }

                curWa.DataName = txtWeightEstName.Text;
            }

            for (int i = 0; i < curWa.FormulaList.Count; ++i)
            {
                CExpression expr = curExprList[2 * i];
                foreach (ParaData wp in curWa.FormulaList[i].XFormula.ParaList)
                {
                    expr.SetVariableValue(wp.paraName, wp.paraValue);
                }
                double xvalue = expr.Run();
                if (double.IsInfinity(xvalue) || double.IsNaN(xvalue))
                {
                    MessageBox.Show("参数值或公式有误!节点: " + curWa.FormulaList[i].NodeName + ".X");
                    return;
                }

                curWa.FormulaList[i].XFormula.Value = xvalue;

                expr = curExprList[2 * i + 1];
                foreach (ParaData wp in curWa.FormulaList[i].YFormula.ParaList)
                {
                    expr.SetVariableValue(wp.paraName, wp.paraValue);
                }

                double yvalue = expr.Run();
                if (double.IsInfinity(yvalue) || double.IsNaN(yvalue))
                {
                    MessageBox.Show("参数值或公式有误!节点: " + curWa.FormulaList[i].NodeName + ".Y");
                    return;
                }
                curWa.FormulaList[i].YFormula.Value = yvalue;
            }

            // curWa.WriteArithmeticFile("test.xml", true);

            if (mainForm.designProjectData == null)
            {
                CoreDesignProject coreForm = new CoreDesignProject(mainForm, "new");
                coreForm.ShowDialog();
            }

            if (mainForm.designProjectData.lstCoreEnvelopeDesign == null)
            {
                mainForm.designProjectData.lstCoreEnvelopeDesign = new List<XCommon.CoreEnvelopeArithmetic>();
            }

            Dictionary<ParaData, ParaData> wpDict = new Dictionary<ParaData, ParaData>();

            List<WeightFormula> FormulaList = new List<WeightFormula>();
            foreach (NodeFormula ndformula in curWa.FormulaList)
            {
                for (int i = 0; i < 2; ++i)
                {
                    WeightFormula formula = ndformula[i];
                    List<ParaData> ParaList = new List<ParaData>();
                    foreach (ParaData para in formula.ParaList)
                    {
                        ParaData tempWp = null;
                        if (!wpDict.ContainsKey(para))
                        {
                            tempWp = new ParaData(para);
                            wpDict.Add(para, tempWp);
                        }
                        else
                        {
                            tempWp = wpDict[para];
                        }
                        ParaList.Add(tempWp);
                    }
                    formula.ParaList = ParaList;
                }
            }
            if (!bEditProject)
            {
                mainForm.designProjectData.lstCoreEnvelopeDesign.Add(curWa);
                mainForm.BindProjectTreeData(mainForm.designProjectData);
                mainForm.SetCoreEnvelopeDesignTab(curWa, mainForm.designProjectData.lstCoreEnvelopeDesign.Count - 1);
                XLog.Write("设计数据\"" + txtWeightEstName.Text + "\"计算完成!");

            }
            else
            {
                //设置页面数据
                mainForm.SetCoreEnvelopeDesignResult(curWa);
                XLog.Write("设计数据\"" + txtWeightEstName.Text + "\"重新计算完成!");
            }

            DialogResult = DialogResult.OK;
            Close();
        }
        /// <summary>
        /// 确认事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            if (!bEditProject)
            {
                DesignName = txtCutName.Text;
                if (SetDesignName() == false)
                {
                    return;
                }

                data.cutResultName = DesignName;
            }

            if (bPickup)
            {
                CompleteCoreEnvelopePickup();
            }

            data.lstCutEnvelopeCore.Clear();
            for (int i = 0; i < zedCutCoreEnvelopeLine.NPts; ++i)
            {
                data.lstCutEnvelopeCore.Add(new CorePointData(zedCutCoreEnvelopeLine[i].X, zedCutCoreEnvelopeLine[i].Y, (i + 1).ToString()));
            }

            if (mainForm.designProjectData == null)
            {
                CoreDesignProject coreForm = new CoreDesignProject(mainForm, "new");
                coreForm.ShowDialog();
            }

            if (data.lstCutEnvelopeCore.Count > 0)
            {
                // added 2014 9 11
                data.lstCutEnvelopeCore.RemoveAt(data.lstCutEnvelopeCore.Count - 1);
            }

            if (!bEditProject)
            {
                if (mainForm.designProjectData.lstCutResultData == null)
                {
                    mainForm.designProjectData.lstCutResultData = new List<CoreEnvelopeCutResultData>();
                }

                data.nCutType = nSelIndex;
                data.nDiscreteCircularPtCount = discreteset.nCircularPtCount;
                data.nDiscreteRadialPtCount = discreteset.nRadialPtCount;
                data.fDiscreteRadialFirstLen = discreteset.fRadialFirstLen;
                data.fDiscreteRadialRatio = discreteset.fRadialRatio;
                data.fRatioWidthVsHeight = discreteset.fRatioWidthVsHeight;

                mainForm.designProjectData.lstCutResultData.Add(data);
                mainForm.BindProjectTreeData(mainForm.designProjectData);
                mainForm.SetCoreEnvelopeCutTab(data, mainForm.designProjectData.lstCutResultData.Count - 1);

                XLog.Write("设计数据\"" + DesignName + "\"剪裁完成!");
            }
            else
            {
                //设置页面的数据
                olddata.nDiscreteCircularPtCount = discreteset.nCircularPtCount;
                olddata.nDiscreteRadialPtCount = discreteset.nRadialPtCount;
                olddata.fDiscreteRadialFirstLen = discreteset.fRadialFirstLen;
                olddata.fDiscreteRadialRatio = discreteset.fRadialRatio;
                olddata.fRatioWidthVsHeight = discreteset.fRatioWidthVsHeight;
                olddata.lstBasicCoreEnvelope = data.lstBasicCoreEnvelope;
                olddata.lstCoreEvaluation = data.lstCoreEvaluation;
                olddata.lstDiscreteCore = data.lstDiscreteCore;
                olddata.lstFuelCore = data.lstFuelCore;
                olddata.lstCutEnvelopeCore = data.lstCutEnvelopeCore;

                mainForm.SetCoreEnvelopeCutResult(olddata);
                XLog.Write("设计数据\"" + DesignName + "\"重新剪裁完成!");
            }

            DialogResult = DialogResult.OK;
            Close();
        }