public void OnBarcodeScan(string barcode) { var item = query.Read(barcode); BarcodeEvent?.Invoke(this, new ScannedBarcodeEventArgs(item)); ScannedItems.Add(item); }
/// <summary> /// Separating data from buffer into barcodes. Invokes BarcodeEvent for every barcode /// </summary> /// <param name="dataToProcess">Data to process</param> private void ProcessData(List <string> dataToProcess) { dataToProcess.ForEach(data => { var barcodes = data.Split(Separators, StringSplitOptions.RemoveEmptyEntries).ToList(); barcodes.ForEach(barcode => { var eventArgs = new BarcodeEventArgs(barcode); BarcodeEvent?.Invoke(this, eventArgs); }); }); }