Example #1
0
        private async Task ReadFromGallery(FileResult qr)
        {
            SharedZXingNet::ZXing.Result result = null;
            var qr_file = await qr.LoadPhotoAsync();

            using (MemoryStream memory = new MemoryStream())
            {
                using (FileStream file = new FileStream(qr_file.FullName, FileMode.Open, FileAccess.Read))
                {
                    await file.CopyToAsync(memory);
                }
                BarcodeDecoding reader = new BarcodeDecoding();

                result = reader.Decode(memory, SharedZXingNet::ZXing.BarcodeFormat.QR_CODE
                                       , new[]
                {
                    new KeyValuePair <SharedZXingNet::ZXing.DecodeHintType, object>(SharedZXingNet::ZXing.DecodeHintType.TRY_HARDER, null)
                });
            }
            await Deserialize(result?.Text);
        }