private void btnInit_Click(object sender, EventArgs e) { pgrInterval.Value = 0; timeOutnter = 0; CommPort Port = new CommPort(cmbPorts.Text); try { if (_dongle == null) { _dongle = new TiDongle(Port, this); } } catch { MessageBox.Show("Can't open Comm Port, Please select other", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } _dongle.OnHardwareInitComplite += HardwareInitComplite; _dongle.OnSerchComplite += ScanComplite; _dongle.Init(); btnScan.Enabled = false; btnStart.Enabled = false; btnStop.Enabled = false; }
private void btnStop_Click(object sender, EventArgs e) { logger.Info("Test stoped"); tmrDiscover.Stop(); _dongle.TiDisconnectAll(); _dongle.TerminateLinkRequest(); _dongle.HardReset(); Thread.Sleep(500); _dongle.Close(); _dongle = null; _in_test = false; btnInit.Enabled = true; btnScan.Enabled = false; btnStart.Enabled = false; btnStop.Enabled = false; btnClear.Enabled = true; chkCheckAll.Enabled = true; chkCheckConnection.Enabled = true; }