private void button14_Click(object sender, EventArgs e) { OperateResult <int> command = DemoUtils.ParseInt(textBox_command.Text); if (!command.IsSuccess) { MessageBox.Show("Command input wrong: " + command.Message); return; } OperateResult <int> dataAddress = DemoUtils.ParseInt(textBox_dataAddress.Text); if (!dataAddress.IsSuccess) { MessageBox.Show("Data Address input wrong: " + dataAddress.Message); return; } OperateResult <int> dataAttribute = DemoUtils.ParseInt(textBox_dataAttribute.Text); if (!dataAttribute.IsSuccess) { MessageBox.Show("单元编号输入错误:" + dataAttribute.Message); return; } OperateResult <int> handle = DemoUtils.ParseInt(textBox_dataHandle.Text); if (!handle.IsSuccess) { MessageBox.Show("处理请求输入错误:" + dataAttribute.Message); return; } byte[] dataPart = string.IsNullOrEmpty(textBox_dataPart.Text) ? new byte[0] : textBox_dataPart.Text.ToHexBytes( ); OperateResult <byte[]> read = YRC1000Tcp.ReadCommand((ushort)command.Content, (ushort)dataAddress.Content, (byte)dataAttribute.Content, (byte)handle.Content, dataPart); if (!read.IsSuccess) { MessageBox.Show("Read failed: " + read.Message); return; } if (radioButton1.Checked) { textBox7.Text = read.Content.ToHexString( ); } else { textBox7.Text = HslCommunication.BasicFramework.SoftBasic.GetAsciiStringRender(read.Content); } }