public override bool Equals(Object obj) { DecodeResult other = obj as DecodeResult; if (other == null) { return(false); } return((Symbology == other.Symbology) && (Text == other.Text)); }
private async void FrameReader_FrameArrived(BarcodeScannerFrameReader sender, BarcodeScannerFrameReaderFrameArrivedEventArgs args) { if (!scannerEnabled) { // Return immediately if decoder is not enabled return; } using (args.GetDeferral()) { SoftwareBitmap bitmap = null; using (BarcodeScannerVideoFrame frame = await sender.TryAcquireLatestFrameAsync()) { if (frame != null) { // Build software bitmap from pixel data bitmap = SoftwareBitmap.CreateCopyFromBuffer(frame.PixelData, frame.Format, (int)frame.Width, (int)frame.Height); } } if (bitmap != null) { DecodeResult decodeResult = await decodeEngine.DecodeAsync(bitmap); bitmap.Dispose(); bitmap = null; // Report only if we have a result that is different from previous one. if (decodeResult != null && !decodeResult.Equals(previousDecodeResult)) { previousDecodeResult = decodeResult; await connection.ReportScannedDataAsync(CreateBarcodeScannerReportFromString(decodeResult.Text, decodeResult.Symbology)); } } } }