protected override void OnLoad(EventArgs e) { // Byte1ComboBox.SelectedIndex = 0; NameTextBox.Text = CustomTest.CustomCommandName; byte[] temp = new byte[1]; temp[0] = CustomTest.CustomCommand; CMDHexadecimalTextBox.SetTextFromByteArray(temp); if (CustomTest.CustomCommandParamNum >= 1) { temp[0] = CustomTest.CustomCommandParam[0]; Param1HexadecimalTextBox.SetTextFromByteArray(temp); Param1CheckBox.Checked = true; } if (CustomTest.CustomCommandParamNum == 2) { temp[0] = CustomTest.CustomCommandParam[1]; Param2HexadecimalTextBox.SetTextFromByteArray(temp); Param2CheckBox.Checked = true; } CMDDelayNumericUpDown.Value = (decimal)CustomTest.CommandDelay; if (CustomTest.CustomCommandResultNum == -1) { ValidateResultCheckBox.Checked = false; } if (CustomTest.CustomCommandResultNum >= 1) { SetCombo(Byte1ComboBox, CustomTest.ResultOperation[0]); temp[0] = CustomTest.CustomCommandResult[0]; Byte1HexadecimalTextBox.SetTextFromByteArray(temp); Byte1CheckBox.Checked = true; } if (CustomTest.CustomCommandResultNum >= 2) { SetCombo(Byte2ComboBox, CustomTest.ResultOperation[1]); temp[0] = CustomTest.CustomCommandResult[1]; Byte2HexadecimalTextBox.SetTextFromByteArray(temp); Byte2CheckBox.Checked = true; } if (CustomTest.CustomCommandResultNum >= 3) { SetCombo(Byte3ComboBox, CustomTest.ResultOperation[2]); temp[0] = CustomTest.CustomCommandResult[2]; Byte3HexadecimalTextBox.SetTextFromByteArray(temp); Byte3CheckBox.Checked = true; } if (CustomTest.CustomCommandResultNum >= 4) { SetCombo(Byte4ComboBox, CustomTest.ResultOperation[3]); temp[0] = CustomTest.CustomCommandResult[3]; Byte4HexadecimalTextBox.SetTextFromByteArray(temp); Byte4CheckBox.Checked = true; } if (CustomTest.CustomCommandResultNum >= 5) { SetCombo(Byte5ComboBox, CustomTest.ResultOperation[4]); temp[0] = CustomTest.CustomCommandResult[4]; Byte5HexadecimalTextBox.SetTextFromByteArray(temp); Byte5CheckBox.Checked = true; } if (CustomTest.CustomCommandResultNum >= 6) { SetCombo(Byte6ComboBox, CustomTest.ResultOperation[5]); temp[0] = CustomTest.CustomCommandResult[5]; Byte6HexadecimalTextBox.SetTextFromByteArray(temp); Byte6CheckBox.Checked = true; } if (CustomTest.CustomCommandResultNum >= 7) { SetCombo(Byte7ComboBox, CustomTest.ResultOperation[6]); temp[0] = CustomTest.CustomCommandResult[6]; Byte7HexadecimalTextBox.SetTextFromByteArray(temp); Byte7CheckBox.Checked = true; } if (CustomTest.CustomCommandResultNum >= 8) { SetCombo(Byte8ComboBox, CustomTest.ResultOperation[7]); temp[0] = CustomTest.CustomCommandResult[7]; Byte8HexadecimalTextBox.SetTextFromByteArray(temp); Byte8CheckBox.Checked = true; } if (CustomTest.CustomCommandResultNum >= 9) { SetCombo(Byte9ComboBox, CustomTest.ResultOperation[8]); temp[0] = CustomTest.CustomCommandResult[8]; Byte9HexadecimalTextBox.SetTextFromByteArray(temp); Byte9CheckBox.Checked = true; } if (CustomTest.CustomCommandResultNum >= 10) { SetCombo(Byte10ComboBox, CustomTest.ResultOperation[9]); temp[0] = CustomTest.CustomCommandResult[9]; Byte10HexadecimalTextBox.SetTextFromByteArray(temp); Byte10CheckBox.Checked = true; } if (CustomTest.CustomCommandResultNum >= 11) { SetCombo(Byte11ComboBox, CustomTest.ResultOperation[10]); temp[0] = CustomTest.CustomCommandResult[10]; Byte11HexadecimalTextBox.SetTextFromByteArray(temp); Byte11CheckBox.Checked = true; } if (CustomTest.CustomCommandResultNum >= 12) { SetCombo(Byte12ComboBox, CustomTest.ResultOperation[11]); temp[0] = CustomTest.CustomCommandResult[11]; Byte12HexadecimalTextBox.SetTextFromByteArray(temp); Byte12CheckBox.Checked = true; } if (CustomTest.CustomCommandResultNum >= 13) { SetCombo(Byte13ComboBox, CustomTest.ResultOperation[12]); temp[0] = CustomTest.CustomCommandResult[12]; Byte13HexadecimalTextBox.SetTextFromByteArray(temp); Byte13CheckBox.Checked = true; } if (CustomTest.CustomCommandResultNum >= 14) { SetCombo(Byte14ComboBox, CustomTest.ResultOperation[13]); temp[0] = CustomTest.CustomCommandResult[13]; Byte14HexadecimalTextBox.SetTextFromByteArray(temp); Byte14CheckBox.Checked = true; } if (CustomTest.CustomCommandResultNum >= 15) { SetCombo(Byte15ComboBox, CustomTest.ResultOperation[14]); temp[0] = CustomTest.CustomCommandResult[14]; Byte15HexadecimalTextBox.SetTextFromByteArray(temp); Byte15CheckBox.Checked = true; } if (CustomTest.CustomCommandResultNum >= 16) { SetCombo(Byte16ComboBox, CustomTest.ResultOperation[15]); temp[0] = CustomTest.CustomCommandResult[15]; Byte16HexadecimalTextBox.SetTextFromByteArray(temp); Byte16CheckBox.Checked = true; } if (CustomTest.CustomCommandResultNum >= 17) { SetCombo(Byte17ComboBox, CustomTest.ResultOperation[16]); temp[0] = CustomTest.CustomCommandResult[16]; Byte17HexadecimalTextBox.SetTextFromByteArray(temp); Byte17CheckBox.Checked = true; } if (CustomTest.CustomCommandResultNum >= 18) { SetCombo(Byte18ComboBox, CustomTest.ResultOperation[17]); temp[0] = CustomTest.CustomCommandResult[17]; Byte18HexadecimalTextBox.SetTextFromByteArray(temp); Byte18CheckBox.Checked = true; } if (CustomTest.CustomCommandResultNum >= 19) { SetCombo(Byte19ComboBox, CustomTest.ResultOperation[18]); temp[0] = CustomTest.CustomCommandResult[18]; Byte19HexadecimalTextBox.SetTextFromByteArray(temp); Byte19CheckBox.Checked = true; } if (CustomTest.CustomCommandResultNum == 20) { SetCombo(Byte20ComboBox, CustomTest.ResultOperation[19]); temp[0] = CustomTest.CustomCommandResult[19]; Byte20HexadecimalTextBox.SetTextFromByteArray(temp); Byte20CheckBox.Checked = true; } base.OnLoad(e); }
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; }