//event raised when buffer contains more than 5 elements. RaisedBy ReadBuffer() method private void Port_DataReceivedEvent(object sender, EventArgs e) { _ShortBufferArray = _CurrentBuffer.ToArray(); Info(_ShortBufferArray, null); foreach (byte data in _CurrentBuffer) { _DataBuffer.Enqueue(data); } if (_DataBuffer.Count() > 5 && ScopeConfig != null) { var measurements = Measurements.GetFromBuffer(_DataBuffer.ToArray(), _voltPerDiv, ScopeConfig.PointsPerDiv, (int)_RecordLength.GetParameter, _verticalPosition, ScopeConfig.VerticalPositionChangeableByHost); if (measurements != null) { NewDataInBuffer(measurements, null); } _GetCurrentParameters(); foreach (byte data in _CurrentBuffer) { _DataBuffer.Dequeue(); } } _LongBufferArray = _DataBuffer.ToArray(); }