private void Form9_Load(object sender, EventArgs e) { ComPorts.size_Off = 3; ComPorts.ComInitializ(); ComPorts.posilca[0] = 170; XMLW.XmlCenterRead(); if (Convert.ToInt16(XMLW.DZcenter) == 0) { textBox1.Text = Convert.ToString(XMLW.DZcom); } if (Convert.ToInt16(XMLW.DZcenter) == 16) { textBox1.Text = "-" + Convert.ToString(XMLW.DZcom); } if (Convert.ToInt16(XMLW.DYcenter) == 64) { textBox2.Text = Convert.ToString(XMLW.DYcom); } if (Convert.ToInt16(XMLW.DYcenter) == 80) { textBox2.Text = "-" + Convert.ToString(XMLW.DYcom); } if (Convert.ToInt16(XMLW.DYcenter) == 0) { textBox2.Text = Convert.ToString(XMLW.DYcom); } }
private void button_number_product_Click(object sender, EventArgs e) { if (comboBox1.Text == "") { MessageBox.Show("Введите номер прибора", "Ошибка", MessageBoxButtons.OK); } else { XMLW.XmlCenterRead(); ComPorts.ComInitializ(); ComPorts.posilca[1] = 41; ComPorts.posilca[2] = XMLW.DZcom; ComPorts.posilca[3] = XMLW.DZcenter; ComPorts.posilca[4] = (byte)(ComPorts.posilca[0] ^ ComPorts.posilca[1] ^ ComPorts.posilca[2] ^ ComPorts.posilca[3]); ComPorts.Poket_Write(); System.Threading.Thread.Sleep(8); ComPorts.posilca[1] = 41; ComPorts.posilca[2] = XMLW.DYcom; ComPorts.posilca[3] = XMLW.DYcenter; ComPorts.posilca[4] = (byte)(ComPorts.posilca[0] ^ ComPorts.posilca[1] ^ ComPorts.posilca[2] ^ ComPorts.posilca[3]); ComPorts.Poket_Write(); System.Threading.Thread.Sleep(8); ComPorts.port.Close(); this.Hide(); form6.form1 = this; form6.NumberProduct = comboBox1.Text; form6.ShowDialog(); } }