Beispiel #1
0
        private void button25_Click(object sender, EventArgs e)
        {
            try
            {
                OperateResult <byte[]> read = null;
                if (!textBox6.Text.Contains(";"))
                {
                    MessageBox.Show(HslCommunication.BasicFramework.SoftBasic.ByteToHexString(allenBradleyNet.BuildReadCommand(new string[] { textBox6.Text }, new int[] { int.Parse(textBox9.Text) }).Content, ' '));
                    read = allenBradleyNet.Read(textBox6.Text, 0);
                }
                else
                {
                    MessageBox.Show(HslCommunication.BasicFramework.SoftBasic.ByteToHexString(allenBradleyNet.BuildReadCommand(textBox6.Text.Split(';')).Content, ' '));
                    read = allenBradleyNet.Read(textBox6.Text.Split(';'));
                }

                if (read.IsSuccess)
                {
                    textBox10.Text = "结果:" + HslCommunication.BasicFramework.SoftBasic.ByteToHexString(read.Content);
                }
                else
                {
                    MessageBox.Show("读取失败:" + read.ToMessageShowString( ));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("读取失败:" + ex.Message);
            }
        }
Beispiel #2
0
 private void button_read_byte_Click(object sender, EventArgs e)
 {
     MessageBox.Show(HslCommunication.BasicFramework.SoftBasic.ByteToHexString(allenBradleyNet.BuildReadCommand("Start_out").Content, ' '));
     // 读取byte变量
     // readResultRender( allenBradleyNet.ReadByte( textBox3.Text ), textBox3.Text, textBox4 );
 }