/***************************************Abort/Error Functions***************************************/ public void doAbort() { BeginInvoke((MethodInvoker) delegate { //Enable the GUI components. btnSweepTest.Text = "Start Linear Sweep Test"; testStarted = false; enableGUI(); //Enable the GUI addListeners(); //Add listeners back onto the charts. hidePlotter(); //Remove plots. //Stop test timer and hide it. timer.Enabled = false; timer.Dispose(); updateTimer.Stop(); aq.lblTestTime.Text = " "; aq.lblTestType.Text = ""; aq.lblTestTime.Visible = false; aq.lblTestType.Visible = false; //Allow waveform image to be displayed. aq.wfHelper.dataLoaded = false; //Abort test. aq.rxState = rxStates.RX_IDLE; sweepTimer.setTimer(200, timerTypes.TIMER_SWP_ABORT, this.btnSweepTest); }); }
//Puts the device into binary mode and retreives the settings. public void validateDevice(Control c) { //Save object which called this function to return focus to later. control = c; //Put console window into binary mode. aqCon.consoleToBinary(); aqCon.rbtBinary_Checked(true); //Activate rx state machine. rxState = rxStates.RX_COM_VAL; //Prepare to send 'X' to stop any running processes. byte[] bArray = new byte[8]; bArray[0] = (byte)'X'; bArray[1] = (byte)'\r'; try//Send data to device. { sp.Write(bArray, 0, 2); } catch (Exception err) { comCloser(); comErrorHandler(err.ToString()); } //Set timer to wait for next step in validation process. aqTimer.setTimer(20, timerTypes.TIMER_COM_VAL2, control); }