コード例 #1
0
        private void button19_Click(object sender, EventArgs e)
        {
            frmC密码输入 nFrm = new frmC密码输入(CMach.Password);

            CTran.SendHandAODO("RQ STN 1 ARM A ALL\r\n");
            CTran.SendHandAODO("RQ STN 2 ARM A ALL\r\n");
            CTran.SendHandAODO("RQ STN 3 ARM A ALL\r\n");
            CTran.SendHandAODO("RQ STN 4 ARM A ALL\r\n");
            nFrm.ShowDialog(this);
            if (nFrm.DialogResult == DialogResult.OK)
            {
                frmC机械手设置 nFrm1 = new frmC机械手设置(CTran);
                nFrm1.ShowDialog(this);
            }
        }
コード例 #2
0
        private void button8_Click(object sender, EventArgs e)//保存PID设置
        {
            frmC密码输入 nFrm = new frmC密码输入(Password);

            nFrm.ShowDialog();
            if (nFrm.DialogResult != DialogResult.OK)
            {
                return;
            }

            try
            {
                int[,] xy = new int[dGV8.RowCount, 7];
                for (int i = 0; i < dGV8.RowCount; i++)
                {
                    string   str1 = dGV8.Rows[i].Cells[0].Value.ToString();
                    string[] str2 = str1.Substring(0, 4).Split('.');
                    xy[i, 0] = Convert.ToInt32(str2[0]) - 1;
                    xy[i, 1] = Convert.ToInt32(str2[1]) - 1;
                    for (int j = 1; j < dGV8.ColumnCount; j++)
                    {
                        xy[i, j + 1] = Convert.ToInt32(dGV8.Rows[i].Cells[j].Value.ToString());
                    }
                }
                for (int i = 0; i < dGV8.RowCount; i++)
                {
                    frmMain.nMainVar.ListPID[xy[i, 0]][xy[i, 1]].Min = xy[i, 2];
                    frmMain.nMainVar.ListPID[xy[i, 0]][xy[i, 1]].Max = xy[i, 3];
                    frmMain.nMainVar.ListPID[xy[i, 0]][xy[i, 1]].P   = xy[i, 4];
                    frmMain.nMainVar.ListPID[xy[i, 0]][xy[i, 1]].I   = xy[i, 5];
                    frmMain.nMainVar.ListPID[xy[i, 0]][xy[i, 1]].D   = xy[i, 6];
                }
                FillGrid8();
                frmMain.nMainVar.SaveToXml();
                MessageBox.Show("保存PID设置成功!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }