using System;
|
using System.Drawing;
|
using System.IO;
|
|
|
//namespace Shared
|
//{
|
// public static class QRCode
|
// {
|
// static ZXing.Mobile.MobileBarcodeScanner scanner;
|
// public static void ScanQRcode(Action<string> action)
|
// {
|
// ((BaseActivity)Shared.Application.Activity).SetCamera(async (obj) => {
|
// if (obj)
|
// {
|
// if (scanner == null)
|
// {
|
// MobileBarcodeScanner.Initialize(Shared.Application.Activity.Application);
|
// scanner = new ZXing.Mobile.MobileBarcodeScanner();
|
// }
|
|
// var result = await scanner.Scan();
|
|
// if (result != null)
|
// action?.Invoke(result.Text);
|
// else
|
// action?.Invoke(null);
|
|
// }
|
// else {
|
// action?.Invoke(null);
|
// }
|
// });
|
|
|
// }
|
|
// public static byte[] BytesFromText(string text, int width = 300, int height = 300)
|
// {
|
// var barcodeWriter = new ZXing.Mobile.BarcodeWriter
|
// {
|
// Format = ZXing.BarcodeFormat.QR_CODE,
|
// Options = new ZXing.Common.EncodingOptions
|
// {
|
// Width = width,
|
// Height = height,
|
// Margin = 10
|
// }
|
// };
|
|
// barcodeWriter.Renderer = new ZXing.Mobile.BitmapRenderer();
|
// var bitmap = barcodeWriter.Write(text);
|
// using (var stream = new MemoryStream())
|
// {
|
// bitmap.Compress(Android.Graphics.Bitmap.CompressFormat.Png, 100, stream); // this is the diff between iOS and Android
|
// stream.Position = 0;
|
// return stream.ToArray();
|
// }
|
// }
|
// }
|
//}
|