private void OKButton_Click(object sender, EventArgs e) { if (NameTextBox.Text == "") { MessageBox.Show("'Test Name' cannot be empty.", "Empty Field", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } CustomTest.CustomCommandName = NameTextBox.Text; CustomTest.CustomCommand = (CMDHexadecimalTextBox.ToByteArray())[0]; if (Param1CheckBox.Checked && (Param1HexadecimalTextBox.Text != "")) { CustomTest.CustomCommandParam[0] = (Param1HexadecimalTextBox.ToByteArray())[0]; CustomTest.CustomCommandParamNum = 1; } else { CustomTest.CustomCommandParamNum = 0; CustomTest.CustomCommandParam[0] = 0x00; CustomTest.CustomCommandParam[1] = 0x00; } if (Param2CheckBox.Checked && (Param2HexadecimalTextBox.Text != "")) { CustomTest.CustomCommandParam[1] = (Param2HexadecimalTextBox.ToByteArray())[0]; CustomTest.CustomCommandParamNum = 2; } CustomTest.CommandDelay = (int)CMDDelayNumericUpDown.Value; CustomTest.CustomCommandResultNum = 0; for (int i = 0; i < 20; i++) { CustomTest.CustomCommandResult[i] = 0x00; CustomTest.ResultOperation[i] = CommandResultOperator.NoOperator; } if (ValidateResultCheckBox.Checked == false) { CustomTest.CustomCommandResultNum = -1; } else { if (Byte1CheckBox.Checked && (Byte1HexadecimalTextBox.Text != "")) { CustomTest.CustomCommandResult[0] = (Byte1HexadecimalTextBox.ToByteArray())[0]; CustomTest.ResultOperation[0] = GetOperator(Byte1ComboBox); CustomTest.CustomCommandResultNum = 1; } if (Byte2CheckBox.Checked && (Byte2HexadecimalTextBox.Text != "")) { CustomTest.CustomCommandResult[1] = (Byte2HexadecimalTextBox.ToByteArray())[0]; CustomTest.ResultOperation[1] = GetOperator(Byte2ComboBox); CustomTest.CustomCommandResultNum = 2; } if (Byte3CheckBox.Checked && (Byte3HexadecimalTextBox.Text != "")) { CustomTest.CustomCommandResult[2] = (Byte3HexadecimalTextBox.ToByteArray())[0]; CustomTest.ResultOperation[2] = GetOperator(Byte3ComboBox); CustomTest.CustomCommandResultNum = 3; } if (Byte4CheckBox.Checked && (Byte4HexadecimalTextBox.Text != "")) { CustomTest.CustomCommandResult[3] = (Byte4HexadecimalTextBox.ToByteArray())[0]; CustomTest.ResultOperation[3] = GetOperator(Byte4ComboBox); CustomTest.CustomCommandResultNum = 4; } if (Byte5CheckBox.Checked && (Byte5HexadecimalTextBox.Text != "")) { CustomTest.CustomCommandResult[4] = (Byte5HexadecimalTextBox.ToByteArray())[0]; CustomTest.ResultOperation[4] = GetOperator(Byte5ComboBox); CustomTest.CustomCommandResultNum = 5; } if (Byte6CheckBox.Checked && (Byte6HexadecimalTextBox.Text != "")) { CustomTest.CustomCommandResult[5] = (Byte6HexadecimalTextBox.ToByteArray())[0]; CustomTest.ResultOperation[5] = GetOperator(Byte6ComboBox); CustomTest.CustomCommandResultNum = 6; } if (Byte7CheckBox.Checked && (Byte7HexadecimalTextBox.Text != "")) { CustomTest.CustomCommandResult[6] = (Byte7HexadecimalTextBox.ToByteArray())[0]; CustomTest.ResultOperation[6] = GetOperator(Byte7ComboBox); CustomTest.CustomCommandResultNum = 7; } if (Byte8CheckBox.Checked && (Byte8HexadecimalTextBox.Text != "")) { CustomTest.CustomCommandResult[7] = (Byte8HexadecimalTextBox.ToByteArray())[0]; CustomTest.ResultOperation[7] = GetOperator(Byte8ComboBox); CustomTest.CustomCommandResultNum = 8; } if (Byte9CheckBox.Checked && (Byte9HexadecimalTextBox.Text != "")) { CustomTest.CustomCommandResult[8] = (Byte9HexadecimalTextBox.ToByteArray())[0]; CustomTest.ResultOperation[8] = GetOperator(Byte9ComboBox); CustomTest.CustomCommandResultNum = 9; } if (Byte10CheckBox.Checked && (Byte10HexadecimalTextBox.Text != "")) { CustomTest.CustomCommandResult[9] = (Byte10HexadecimalTextBox.ToByteArray())[0]; CustomTest.ResultOperation[9] = GetOperator(Byte10ComboBox); CustomTest.CustomCommandResultNum = 10; } if (Byte11CheckBox.Checked && (Byte11HexadecimalTextBox.Text != "")) { CustomTest.CustomCommandResult[10] = (Byte11HexadecimalTextBox.ToByteArray())[0]; CustomTest.ResultOperation[10] = GetOperator(Byte11ComboBox); CustomTest.CustomCommandResultNum = 11; } if (Byte12CheckBox.Checked && (Byte12HexadecimalTextBox.Text != "")) { CustomTest.CustomCommandResult[11] = (Byte12HexadecimalTextBox.ToByteArray())[0]; CustomTest.ResultOperation[11] = GetOperator(Byte12ComboBox); CustomTest.CustomCommandResultNum = 12; } if (Byte13CheckBox.Checked && (Byte13HexadecimalTextBox.Text != "")) { CustomTest.CustomCommandResult[12] = (Byte13HexadecimalTextBox.ToByteArray())[0]; CustomTest.ResultOperation[12] = GetOperator(Byte13ComboBox); CustomTest.CustomCommandResultNum = 13; } if (Byte14CheckBox.Checked && (Byte14HexadecimalTextBox.Text != "")) { CustomTest.CustomCommandResult[13] = (Byte14HexadecimalTextBox.ToByteArray())[0]; CustomTest.ResultOperation[13] = GetOperator(Byte14ComboBox); CustomTest.CustomCommandResultNum = 14; } if (Byte15CheckBox.Checked && (Byte15HexadecimalTextBox.Text != "")) { CustomTest.CustomCommandResult[14] = (Byte15HexadecimalTextBox.ToByteArray())[0]; CustomTest.ResultOperation[14] = GetOperator(Byte15ComboBox); CustomTest.CustomCommandResultNum = 15; } if (Byte16CheckBox.Checked && (Byte16HexadecimalTextBox.Text != "")) { CustomTest.CustomCommandResult[15] = (Byte16HexadecimalTextBox.ToByteArray())[0]; CustomTest.ResultOperation[15] = GetOperator(Byte16ComboBox); CustomTest.CustomCommandResultNum = 16; } if (Byte17CheckBox.Checked && (Byte17HexadecimalTextBox.Text != "")) { CustomTest.CustomCommandResult[16] = (Byte17HexadecimalTextBox.ToByteArray())[0]; CustomTest.ResultOperation[16] = GetOperator(Byte17ComboBox); CustomTest.CustomCommandResultNum = 17; } if (Byte18CheckBox.Checked && (Byte18HexadecimalTextBox.Text != "")) { CustomTest.CustomCommandResult[17] = (Byte18HexadecimalTextBox.ToByteArray())[0]; CustomTest.ResultOperation[17] = GetOperator(Byte18ComboBox); CustomTest.CustomCommandResultNum = 18; } if (Byte19CheckBox.Checked && (Byte19HexadecimalTextBox.Text != "")) { CustomTest.CustomCommandResult[18] = (Byte19HexadecimalTextBox.ToByteArray())[0]; CustomTest.ResultOperation[18] = GetOperator(Byte19ComboBox); CustomTest.CustomCommandResultNum = 19; } if (Byte20CheckBox.Checked && (Byte20HexadecimalTextBox.Text != "")) { CustomTest.CustomCommandResult[19] = (Byte20HexadecimalTextBox.ToByteArray())[0]; CustomTest.ResultOperation[19] = GetOperator(Byte20ComboBox); CustomTest.CustomCommandResultNum = 20; } } DialogResult = DialogResult.OK; }