Exemple #1
0
        private void btKeyForm_Click(object sender, EventArgs e)
        {
            string str = treeView1.SelectedNode.Text;
            int    i   = Convert.ToInt32(str.Length == 5 ? str.Substring(1, 1) : str.Substring(1, 2));
            double t   = 0.0;
            double d   = 0.0;
            double b   = 0.0;
            double h   = 0.0;
            double l   = 0.0;

            if (i == 1)
            {
                t = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("动力参数").Element("扭矩").Value);
                b = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("键槽b").Value);
                h = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("键槽h").Value); //键宽
                l = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("键槽L").Value); //键长度
                d = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("轴段6直径").Value);
                FrmKeyStrength1 frm = new FrmKeyStrength1(i, t, d, b, h, l);
                frm.Show();
            }
            if (i == 2)
            {
                t = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("动力参数").Element("扭矩").Value);
                b = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("键槽b").Value);
                h = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("键槽h").Value); //键宽
                l = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("键槽L").Value); //键长度
                d = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("轴段5直径").Value);
                FrmKeyStrength1 frm = new FrmKeyStrength1(i, t, d, b, h, l);
                frm.Show();
            }
            if (i == 3)
            {
                t = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("动力参数").Element("扭矩").Value);
                b = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("键槽b").Value);
                h = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("键槽h").Value); //键宽
                l = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("键槽L").Value); //键长度
                d = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("轴段5直径").Value);
                FrmKeyStrength1 frm = new FrmKeyStrength1(i, t, d, b, h, l);
                frm.Show();
            }
            if (i == 4)
            {
                KeyStrength4 frm = new KeyStrength4(i);
                frm.Show();
            }
        }
        private void btKeyForm_Click(object sender, EventArgs e)
        {
            string str = treeView1.SelectedNode.Text;
            int i = Convert.ToInt32(str.Length == 5 ? str.Substring(1, 1) : str.Substring(1, 2));
            double t = 0.0;
            double d = 0.0;
            double b = 0.0;
            double h = 0.0;
            double l = 0.0;

            if (i == 1)
            {
                t = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("动力参数").Element("扭矩").Value);
                b = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("键槽b").Value);
                h = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("键槽h").Value); //键宽
                l = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("键槽L").Value);//键长度
                d = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("轴段6直径").Value);
                FrmKeyStrength1 frm = new FrmKeyStrength1(i, t, d, b, h, l);
                frm.Show();
            }
            if (i == 2)
            {
                t = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("动力参数").Element("扭矩").Value);
                b = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("键槽b").Value);
                h = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("键槽h").Value); //键宽
                l = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("键槽L").Value);//键长度
                d = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("轴段5直径").Value);
                FrmKeyStrength1 frm = new FrmKeyStrength1(i, t, d, b, h, l);
                frm.Show();
            }
            if (i == 3)
            {
                t = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("动力参数").Element("扭矩").Value);
                b = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("键槽b").Value);
                h = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("键槽h").Value); //键宽
                l = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("键槽L").Value);//键长度
                d = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("轴段5直径").Value);
                FrmKeyStrength1 frm = new FrmKeyStrength1(i, t, d, b, h, l);
                frm.Show();
            }
            if (i == 4)
            {
                KeyStrength4 frm = new KeyStrength4(i);
                frm.Show();
            }
        }