Example #1
0
        private void btnImport_Click(object sender, EventArgs e)
        {
            try
            {
                System.Windows.Forms.OpenFileDialog dlg = new OpenFileDialog();
                dlg.RestoreDirectory = true;
                dlg.Filter           = "Wem files (*.wem)|*.wem";
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                List <WeightSortData> wsDataList = WeightSortManageForm.GetListWeightSortData(false);

                WeightArithmetic wa = WeightArithmetic.ReadArithmeticData(dlg.FileName);
                WeightParameter.GetWeightParameterList()[10].Clear();

                if (!QueryWeightSort(wa))
                {
                    return;
                }

                if (!WeightArithmeticOperForm.WriteArithmeticFile(wa, true))
                {
                    return;
                }
                //加节点
                foreach (TreeNode treenode in treeViewArithmeticList.Nodes[0].Nodes)
                {
                    if (treenode.Text == wa.SortName)
                    {
                        string filename = "weightCategory\\" + wa.SortName + "\\" + wa.Name + ".wem";
                        if (!treenode.Nodes.ContainsKey(filename))
                        {
                            treenode.Nodes.Add(filename, wa.Name, 4, 5);
                            if (treenode.IsExpanded == false)
                            {
                                treenode.Expand();
                            }
                        }
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                XCommon.XLog.Write("导入重量算法文件错误");
            }
        }
        private void btnNew_Click(object sender, EventArgs e)
        {
            WeightArithmeticOperForm form = new WeightArithmeticOperForm("new", selNode);
            if (form.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            foreach (TreeNode node in treeViewArithmeticList.Nodes[0].Nodes)
            {
                if (node.Text == form.strWeightSortName)
                {
                    string key = node.Name + "\\" + form.strWeightArithmeticFileName + ".wem";
                    if (!node.Nodes.ContainsKey(key))
                    {
                        node.Nodes.Add(key, form.strWeightArithmeticFileName, 4, 5);
                    }
                    if (node.IsExpanded == false)
                    {
                        node.Expand();
                    }
                    break;
                }
            }

            ParaData.GetWeightParameterList()[10].Clear();
        }
 private void btnEdit_Click(object sender, EventArgs e)
 {
     WeightArithmeticOperForm form = new WeightArithmeticOperForm("edit", selNode);
     if (form.ShowDialog() != DialogResult.OK)
     {
         return;
     }
     ParaData.GetWeightParameterList()[10].Clear();
 }
        private void btnJYNew_Click(object sender, EventArgs e)
        {
            if (treeViewArithmeticList.Nodes.Count > 1 && selNode.Parent == treeViewArithmeticList.Nodes[1])
            {
                WeightArithmetic wa = (WeightArithmetic)selNode.Tag;

                if (!QueryWeightSort(wa))
                {
                    return;
                }
            }

            WeightArithmeticOperForm form = new WeightArithmeticOperForm("jynew", selNode);
            if (form.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            foreach (TreeNode node in treeViewArithmeticList.Nodes[0].Nodes)
            {
                if (node.Text == form.strWeightSortName)
                {
                    node.Nodes.Add(node.Name + "\\" + form.strWeightArithmeticFileName + ".wem", form.strWeightArithmeticFileName, 4, 5);
                    if (node.IsExpanded == false)
                    {
                        node.Expand();
                    }
                    break;
                }
            }
            ParaData.GetWeightParameterList()[10].Clear();
        }