private void btnCloseIMU_Click(object sender, EventArgs e) { mf.CloseIMUPort(); if (mf.spIMU.IsOpen) { cboxIMU.Enabled = false; btnCloseIMU.Enabled = true; btnOpenIMU.Enabled = false; } else { cboxIMU.Enabled = true; btnCloseIMU.Enabled = false; btnOpenIMU.Enabled = true; } }