public void DataSourceConnected(bool isConnected) { _isDataSourceConnected = isConnected; if (isConnected) { DASConfig config = dpe.GetConfig(); PixelsPerColumn = config.PixelsPerColumn; BytesPerPixel = config.BytesPerPixel; //start thread if (_processDataThread == null) { _processDataThread = new Thread(new ThreadStart(ProcessDataThreadMethod)); _processDataThread.Start(); } } else { //stop data acq thread if (_processDataThread != null) { _processDataThread.Abort(); _diplotDataAcess.Close(); _processDataThread.Join(); _processDataThread = null; } } }
public void StartAcq() { try { dpe = new DiPlotEndpoint(_sourceCallback, _hostEndPoint); } catch { } try { _diplotDataAcess = new DiPlotDataAccess(_multicastAddr, _dataPort); } catch { } if (dpe.IsDataSourceConnected()) { DASConfig cfg = dpe.GetConfig(); BytesPerPixel = cfg.BytesPerPixel; PixelsPerColumn = cfg.PixelsPerColumn; if (_processDataThread == null) { _processDataThread = new Thread(new ThreadStart(ProcessDataThreadMethod)); _processDataThread.Start(); } dpe.SendData(true); } else { throw new Exception("Source not connected"); } }