bool Start(short numScans, uint delay = 0, bool externalTrigger = false) { try { if (_avantes.StartMeasurement(MainWindowHandleForAvantesCallback, IntegrationTime, NumAverages, numScans, delay, externalTrigger)) { ScanParms sp; sp.delay = delay; sp.numScans = numScans; BackgroundWorker bw = new BackgroundWorker(); bw.DoWork += ScanDoWork; bw.RunWorkerCompleted += ScanCompleted; bw.RunWorkerAsync(sp); return(true); } else { throw new Exception("error"); } } catch (Exception ex) { } return(false); }
bool Start(short numScans, uint delay = 0, double integrationTime = 10, uint numAverages = 1, bool externalTrigger = false) { try { { ScanParms sp; sp.delay = delay; sp.numScans = numScans; sp.integrationTime = integrationTime; sp.numAverages = numAverages; BackgroundWorker bw = new BackgroundWorker(); bw.DoWork += ScanDoWork; bw.RunWorkerCompleted += ScanCompleted; bw.RunWorkerAsync(sp); } Thread.Sleep(100); if (_avantes.StartMeasurement(MainWindowHandleForAvantesCallback, integrationTime, numAverages, numScans, delay, externalTrigger)) { return(true); } else { throw new Exception("error"); } } catch (Exception ex) { Console.WriteLine("spectrometer Start exception: " + ex.Message); } return(false); }