private void btnIOTriggerConfig_Click(object sender, EventArgs e) { IMessage msg1 = this.scanMsg; IMessage msg2 = new IRP1.PowerOff_800(); msg1.PortType = ""; byte[] msg1Buff = msg1.TransmitterData; msg2.PortType = ""; byte[] msg2Buff = msg2.TransmitterData; byte[] pData = new byte[5 + msg1Buff.Length + msg2Buff.Length]; pData[0] = (byte)(cmbox1.SelectedIndex + 1); pData[1] = (byte)(cmbox2.SelectedIndex); pData[2] = (byte)(radioButton1.Checked ? 0 : 1); pData[3] = (byte)(numTime.Value / 256); pData[4] = (byte)(numTime.Value % 256); Array.Copy(msg1Buff, 0, pData, 5, msg1Buff.Length); Array.Copy(msg2Buff, 0, pData, 5 + msg1Buff.Length, msg2Buff.Length); IRP1.SysConfig_800 msg = new IRP1.SysConfig_800(0xE2, pData); if (reader.Send(msg)) { MessageBox.Show("配置成功"); } else { MessageBox.Show("配置失败"); } }
private void btnIOTriggerConfig_Click(object sender, EventArgs e) { // Brett: This code isn't working yet. can't figure out where IMessage is coming from.// Core.IMessage msg1 = this.msg; Core.IMessage msg2 = new IRP1.PowerOff_800(); msg1.PortType = ""; byte[] msg1Buff = msg1.TransmitterData; msg2.PortType = ""; byte[] msg2Buff = msg2.TransmitterData; byte[] pData = new byte[5 + msg1Buff.Length + msg2Buff.Length]; pData[0] = (byte)(cbGPITrigger.SelectedIndex + 1); pData[1] = (byte)(cbTrigger.SelectedIndex); pData[2] = (byte)(radioButton1.Checked ? 0 : 1); pData[3] = (byte)(numTime.Value / 256); pData[4] = (byte)(numTime.Value % 256); Array.Copy(msg1Buff, 0, pData, 5, msg1Buff.Length); Array.Copy(msg2Buff, 0, pData, 5 + msg1Buff.Length, msg2Buff.Length); IRP1.SysConfig_800 msg = new IRP1.SysConfig_800(0xE2, pData); if (reader.Send(msg)) { MessageBox.Show("Config successful"); } else { MessageBox.Show("Config failed"); } }