private void DownButton_Click(object sender, EventArgs e)
 {
     DisableButtons();
     if (I2CTestsDataGridView.CurrentRow.Index < (I2CTestArray.Count - 1))
     {
         int         SelectIndex = I2CTestsDataGridView.CurrentRow.Index + 1;
         UnitI2CTest temp        = I2CTestArray[I2CTestsDataGridView.CurrentRow.Index];
         I2CTestArray.RemoveAt(I2CTestsDataGridView.CurrentRow.Index);
         I2CTestArray.Insert(I2CTestsDataGridView.CurrentRow.Index + 1, temp);
         RefreshTable();
         I2CTestsDataGridView.ClearSelection();
         int i = 0;
         foreach (DataGridViewRow row in I2CTestsDataGridView.Rows)
         {
             if (i == SelectIndex)
             {
                 row.Selected = true;
                 I2CTestsDataGridView.CurrentCell = row.Cells[0];
                 break;
             }
             i++;
         }
     }
     EnableButtons();
 }
        private void AddButton_Click(object sender, EventArgs e)
        {
            DisableButtons();

            byte[] temp = AddressHexadecimalTextBox.ToByteArray();
            I2CTest.Address = Convert.ToInt32(temp[0]);

            if ((string)ActionComboBox.SelectedItem == "Read")
            {
                I2CTest.Action = MTKI2CTestType.Read;
            }
            else if ((string)ActionComboBox.SelectedItem == "Write")
            {
                I2CTest.Action = MTKI2CTestType.Write;
            }

            I2CTest.DataBuffer = DataHexadecimalTextBox.ToByteArray();
            I2CTest.NumRxBytes = I2CTest.DataBuffer.Count();

            I2CTest.ValidateRxData = VerifyCheckBox.Checked;

            if ((I2CTest.Action != MTKI2CTestType.Write) && (I2CTest.Action != MTKI2CTestType.Read))
            {
                MessageBox.Show("Action not configured correctly", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            I2CTestArray.Add(I2CTest);
            I2CTest = new UnitI2CTest();
            RefreshTable();

            EnableButtons();
        }
 public MTKTestI2CDialog()
 {
     InitializeComponent();
     I2CTests     = new MTKTestI2C();
     I2CTest      = new UnitI2CTest();
     I2CTestArray = new List <UnitI2CTest>();
 }