Inheritance: ZXing.Mobile.MobileBarcodeScannerBase
Ejemplo n.º 1
13
		void buttonSample1_Click (object sender, EventArgs e)
		{
			var scanner = new MobileBarcodeScanner(this);
			scanner.Scan().ContinueWith((t) => {
				ShowMessage(t.Result != null ? "Scanned: " + t.Result.Text : "No Barcode Scanned");
			});
		}
Ejemplo n.º 2
3
        public void Scan()
        {
            var options = new ZXing.Mobile.MobileBarcodeScanningOptions();
            options.PossibleFormats = new List<ZXing.BarcodeFormat>() {
                ZXing.BarcodeFormat.PDF_417
            };
            options.TryHarder = true;
            options.AutoRotate = true;
            options.TryInverted = true;

            
            var scanner = new ZXing.Mobile.MobileBarcodeScanner(this);
            //Tell our scanner to use the default overlay
            scanner.UseCustomOverlay = false;
            scanner.CameraUnsupportedMessage = "This Device's Camera is not supported.";
            
            //We can customize the top and bottom text of the default overlay
            scanner.TopText = "Hold the camera up to the barcode\nAbout 6 inches away";
            scanner.BottomText = "Wait for the barcode to automatically scan!";
            scanner.Scan(options).ContinueWith(t => {   
                if (t.Result != null)
                {
                    System.Console.WriteLine("Scanned Barcode: " + t.Result.Text);
                    Toast.MakeText(this, t.Result.Text, ToastLength.Short);
                }
            });
        }
Ejemplo n.º 3
1
        public async Task<BarCodeResult> ReadAsync(BarCodeScannerOptions options) {
#if __IOS__
            var scanner = new MobileBarcodeScanner { UseCustomOverlay = false };
#elif ANDROID
            var scanner = new MobileBarcodeScanner(Forms.Context) { UseCustomOverlay = false };
#elif WINDOWS_PHONE
            var scanner = new MobileBarcodeScanner(System.Windows.Deployment.Current.Dispatcher) { UseCustomOverlay = false };
#endif
            options = options ?? this.DefaultOptions;
            if (!String.IsNullOrWhiteSpace(options.TopText)) 
                scanner.TopText = options.TopText;
            
            if (!String.IsNullOrWhiteSpace(options.BottomText)) 
                scanner.BottomText = options.BottomText;
            
            if (!String.IsNullOrWhiteSpace(options.FlashlightText)) 
                scanner.FlashButtonText = options.FlashlightText;
            
            if (!String.IsNullOrWhiteSpace(options.CancelText)) 
                scanner.CancelButtonText = options.CancelText;

            var cfg = GetXingConfig(options);
            var result = await scanner.Scan(cfg);
            return (result == null || String.IsNullOrWhiteSpace(result.Text)
                ? BarCodeResult.Fail
                : new BarCodeResult(result.Text, FromXingFormat(result.BarcodeFormat))
            );
        }
        public async Task ScanCode()
        {
            MobileBarcodeScanner scanner;
            scanner = new MobileBarcodeScanner();
            

            

  
                       
            //scannerO.TryHarder = true;
            
            //Tell our scanner to use the default overlay
            scanner.UseCustomOverlay = false;
            //We can customize the top and bottom text of our default overlay
            scanner.TopText = "Hold camera up to barcode";
            scanner.BottomText = "Camera will automatically scan barcode\r\n\r\nPress the 'Back' button to Cancel";
           

            var options = new MobileBarcodeScanningOptions();
            //options.CameraResolutionSelector = ;
            //options.PossibleFormats = new List<ZXing.BarcodeFormat>() {ZXing.BarcodeFormat.Ean8, ZXing.BarcodeFormat.Ean13};



            //options.PossibleFormats = new List<ZXing.BarcodeFormat>() { ZXing.BarcodeFormat.PDF_417 };
            //options.TryHarder = false;
           
            //options.UseNativeScanning = true;

 
            var result = await scanner.Scan(options);
            HandleScanResult(result);
        }
Ejemplo n.º 5
0
        async void ScanButton_Click(object sender, EventArgs e)
        {
            //let's see if this works first
            MobileBarcodeScanner.Initialize(Application);
            var scanner    = new ZXing.Mobile.MobileBarcodeScanner();
            var scanResult = await scanner.Scan();

            if (scanResult != null)
            {
                string        walmartComQuery = "http://api.walmartlabs.com/v1/items?apiKey=6rukyx4ykumu8xncm5b4f2xc&format=xml&upc=" + scanResult.Text;
                XmlTextReader reader          = new XmlTextReader(walmartComQuery);
                try
                {
                    reader.ReadToFollowing("salePrice");
                    string walmartComResult = reader.ReadElementContentAsString();
                    Toast.MakeText(this, "Walmart.Com price: $" + walmartComResult, ToastLength.Long).Show();
                    StickerPriceEditText.Text = walmartComResult;
                }
                catch {
                    Toast.MakeText(this, "UPC not found!", ToastLength.Long).Show();
                }
                finally {
                    reader.Close();
                }
            }
        }
Ejemplo n.º 6
0
        override async public void ViewDidAppear(bool animated)
        {
            this.TabBarController.SelectedIndex = 1;
            if (ParentViewController != null)
            {
                CustomOverlayView customOverlay = new CustomOverlayView();
                var scanner = new ZXing.Mobile.MobileBarcodeScanner(this);

                customOverlay.ButtonCancel.TouchUpInside += delegate {
                    Console.WriteLine("cancelpresssed");
                    this.NavigationController.TabBarController.SelectedIndex = 0;
                };

                //Tell our scanner to use our custom overlay
                scanner.UseCustomOverlay = true;
                //We can customize the top and bottom text of the default overlay
                scanner.TopText    = "Hold camera up to barcode to scan";
                scanner.BottomText = "Barcode will automatically scan";

                //Start scanning
                var result = await scanner.Scan(true);

                HandleScanResult(result);
            }
        }
Ejemplo n.º 7
0
        private async void startScanning()
        {
            _scanning = true;
            Core.ViewModels.CheckInViewModel viewModel = (this.ViewModel as Core.ViewModels.CheckInViewModel);
            viewModel.IsBusy = true;

            var scanner = new ZXing.Mobile.MobileBarcodeScanner(this.Activity);
            scanner.UseCustomOverlay = true;
            scanner.CustomOverlay = LayoutInflater.FromContext(this.Activity).Inflate(Resource.Layout.ZXingCustomLayout, null);
            var options = new ZXing.Mobile.MobileBarcodeScanningOptions();
            options.PossibleFormats = new List<ZXing.BarcodeFormat>() { ZXing.BarcodeFormat.QR_CODE };
            await scanner.Scan(options).ContinueWith(t =>
            {
                if (t.Result != null)
                {
                    viewModel.ScannedQRCode = t.Result.Text;
                }
                else
                {
                    viewModel.Message = "The Check In QR code could not be scanned. Please go back and try again.";
                    Task.Delay(500).ContinueWith(async dummy => await viewModel.OnBackButtonPressedAsync());
                }
            });
            viewModel.IsBusy = false;
            _scanning = false;
        }
Ejemplo n.º 8
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            lblResult.Text = "";

            txInput.Text = "http://thinkpower.info/xamarin/cn/";

            //扫描条码
            btnScan.TouchUpInside += async(sender, e) => {
                var scanner = new ZXing.Mobile.MobileBarcodeScanner();
                var result  = await scanner.Scan();

                if (result != null)
                {
                    this.lblResult.Text = result.Text;
                }
            };

            //产生条码
            btnGenerateBarCode.TouchUpInside += (sender, e) => {
                txInput.ResignFirstResponder();
                var writer = new BarcodeWriter
                {
                    Format = BarcodeFormat.QR_CODE
                };
                var bitmap = writer.Write(txInput.Text);
                this.img_code.Image = bitmap;
            };
        }
Ejemplo n.º 9
0
		public async Task<ScanResult> Scan()
		{
			var context = Forms.Context;
			var scanner = new MobileBarcodeScanner()
			{
				UseCustomOverlay = false,
				BottomText = "Scanning will happen automatically",
				TopText = "Hold your camera about \n6 inches away from the barcode",
			};
			try
			{
				var result = await scanner.Scan();
				return new ScanResult
				{
					Text = result.Text,
				};
			}
			catch (System.Exception)
			{
				return new ScanResult
				{
					Text = string.Empty,
				};
			}
		}
Ejemplo n.º 10
0
        private void BarcodeScan()
        {
            scanner = new MobileBarcodeScanner(this.NavigationController);
            //buttonDefaultScan = new UIButton(UIButtonType.RoundedRect);
            //buttonDefaultScan.Frame = new RectangleF(40, 150, 280, 40);

            //			buttonDefaultScan = new UIButton(UIButtonType.Custom) {
            //				Frame = new CGRect(View.Center.X - (View.Bounds.Width - 40) / 2, View.Center.Y - 50,  View.Bounds.Width - 40, 100),
            //				BackgroundColor = UIColor.FromRGB(0, 0.5f, 0),
            //			};
            UIButton buttonDefaultScan = new UIButton (
                new CoreGraphics.CGRect (20, View.Center.Y - 100, View.Bounds.Width - 40, 250));
            UIImage roundImage = new UIImage ("RoundButton60.png");
            buttonDefaultScan.SetImage (roundImage, UIControlState.Normal);
            buttonDefaultScan.BackgroundColor = UIColor.Clear;
            //			BizappTheme.Apply (buttonDefaultScan);

            //buttonDefaultScan.Frame = new RectangleF(40, View.Bounds.Height/2.0f, 280, 40);
            //			buttonDefaultScan.SetTitle("Scan Barcode", UIControlState.Normal);

            buttonDefaultScan.TouchUpInside += async (sender, e) =>
            {
                //Tell our scanner to use the default overlay
                scanner.UseCustomOverlay = false;
                //We can customize the top and bottom text of the default overlay
                scanner.TopText = "Hold camera up to barcode to scan";
                scanner.BottomText = "Barcode will automatically scan";

                //Start scanning
                var result = await scanner.Scan ();

                HandleScanResult(result);
            };
            this.View.AddSubview (buttonDefaultScan);
        }
Ejemplo n.º 11
0
        public BarCodeScan()
        {
            Context s = null; //定义为全局变量

            //scanner = new ZXing.Mobile.MobileBarcodeScanner(s);
            scanner = new MobileBarcodeScanner(s);
        }
		public ZXingDefaultOverlayView (MobileBarcodeScanner scanner, RectangleF frame, Action onCancel, Action onTorch) : base(frame)
		{
			OnCancel = onCancel;
			OnTorch = onTorch;
			Scanner = scanner;
			Initialize();
		}
Ejemplo n.º 13
0
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            //Create a new instance of our scanner
            scanner = new MobileBarcodeScanner(this.Dispatcher);
        }
Ejemplo n.º 14
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.QRScannen);
            TextView output = FindViewById <TextView>(Resource.Id.txt_output);


            // Initialize the scanner first so it can track the current context
            MobileBarcodeScanner.Initialize(Application);
            var scanner = new ZXing.Mobile.MobileBarcodeScanner();

            //Tell our scanner to use the default overlay
            scanner.UseCustomOverlay = false;

            //We can customize the top and bottom text of the default overlay
            scanner.TopText    = "Houd de camera op korte afstand van de QR-code";
            scanner.BottomText = "Wacht tot de code automatisch gescand wordt!";
            var result = await scanner.Scan();

            HandleScanResult(result);


            //if (result != null)
            //    {
            //        output.Text = ("Scannen voltooid: " + result.Text);
            //    }
        }
Ejemplo n.º 15
0
        private void TxtCodigo_Click(object sender, EventArgs e)
        {
            var scanner = new ZXing.Mobile.MobileBarcodeScanner()
            {
                UseCustomOverlay = false,
                BottomText       = GetString(Resource.String.MENSAJE_SCAN)
            };

            try
            {
                scanner.Scan().ContinueWith(t =>
                                            RunOnUiThread(
                                                () =>
                {
                    if (t.Result != null)
                    {
                        var result = t.Result;
                        Negocio.Elemento _elemento = new Negocio.Elemento();
                        _elemento.CodigoBarras     = result.Text;
                        EditText txtCodigo         = FindViewById <EditText>(Resource.Id.txtCodigoBarras);
                        txtCodigo.Text             = _elemento.CodigoBarras;
                    }
                }));
            }
            catch (ZXing.ReaderException ex)
            {
            };
        }
Ejemplo n.º 16
0
        public ZxingCameraViewController(MobileBarcodeScanningOptions options, MobileBarcodeScanner scanner)
            : base()
        {
			this.ScanningOptions = options;
			this.Scanner = scanner;
            Initialize();
        }
Ejemplo n.º 17
0
        public async Task <BarcodeScanReturn> StartBarcodeScanner()
        {
            MobileBarcodeScanner.Initialize(Application);

            var scanner = new ZXing.Mobile.MobileBarcodeScanner();
            var result  = await scanner.Scan();

            try
            {
                string[] Results = result.ToString().Split('*');
                Console.WriteLine("Returned Data " + Results[1]);
                string            Contra  = (string)MainActivity.MakeRequest3("data", Results[1]);
                string            Name    = Contra.GetStringOut("lastfirst");
                string            Email1  = Contra.GetStringOut("guardianemail");
                string            Email2  = Contra.GetStringOut("guardianemail_2");
                string            Email3  = Contra.GetStringOut("stud_email");
                BarcodeScanReturn Student = new BarcodeScanReturn(Name, Results[1], Email1, Email2, Email3);
                AllReturned.Add(Student);
                return(Student);
            }
            catch
            {
                string[]          Results = result.ToString().Split(' ');
                BarcodeScanReturn Staff   = new BarcodeScanReturn((Results[2] + ", " + Results[1]), " ", null, null, null);
                AllReturned.Add(Staff);
                return(Staff);
            }
        }
Ejemplo n.º 18
0
        public async Task <string> ScanAsync()
        {
            var app = new Android.App.Application();

            MobileBarcodeScanner.Initialize(app);

            var options = new ZXing.Mobile.MobileBarcodeScanningOptions();

            options.PossibleFormats = new List <ZXing.BarcodeFormat>()
            {
                ZXing.BarcodeFormat.QR_CODE
            };

            var scanner = new ZXing.Mobile.MobileBarcodeScanner();
            var result  = await scanner.Scan(options);

            if (result != null)
            {
                return(result.Text);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 19
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            MobileBarcodeScanner.Initialize(Application);

            var button = FindViewById <Button>(Resource.Id.btn);

            tv = FindViewById <TextView>(Resource.Id.tv);


            button.Click += async delegate
            {
                var scanner = new ZXing.Mobile.MobileBarcodeScanner();
                var result  = await scanner.Scan();

                if (result == null)
                {
                    return;
                }
                else
                {
                    if (!string.IsNullOrEmpty(result.Text))
                    {
                        ScanResultHandler(result);
                    }
                }
            };
        }
Ejemplo n.º 20
0
        private void Scan()
        {
            var scanner = new ZXing.Mobile.MobileBarcodeScanner()
            {
                UseCustomOverlay = false,
                BottomText       = GetString(Resource.String.MENSAJE_SCAN)
            };

            try
            {
                scanner.Scan().ContinueWith(t =>
                                            RunOnUiThread(
                                                () =>
                {
                    if (t.Result != null)
                    {
                        var result = t.Result;
                        Negocio.Elemento _elemento   = new Negocio.Elemento();
                        Intent IntentDetalleElemento = new Intent(this, typeof(ElementoActivity));
                        _elemento.CodigoBarras       = result.Text;
                        IntentDetalleElemento.PutExtra(Negocio.Constantes.MENSAJE_CODIGOBARRAS, _elemento.CodigoBarras);
                        IntentDetalleElemento.PutExtra(Negocio.Constantes.MENSAJE_MODO, Negocio.Constantes.MENSAJE_MODO);
                        StartActivityForResult(IntentDetalleElemento, 0);
                    }
                }));
            }
            catch (ZXing.ReaderException ex)
            {
            };
        }
Ejemplo n.º 21
0
        private async Task scanBarcode()
        {
            //Creates the barcode scanner and adds camera
            var options = new ZXing.Mobile.MobileBarcodeScanningOptions
            {
                CameraResolutionSelector = HandleCameraResolutionSelectorDelegate
            };

            options.PossibleFormats = new List <ZXing.BarcodeFormat>()
            {
                ZXing.BarcodeFormat.EAN_8, ZXing.BarcodeFormat.EAN_13
            };

            var scanner = new ZXing.Mobile.MobileBarcodeScanner(this);

            scanner.AutoFocus();

            //Grabs the scanner result and displays it in the new page
            //The new page is the itemController
            var result = await scanner.Scan(options, true);

            string code = result.Text;

            if (result != null)
            {
                ItemController controller = new ItemController();
                this.NavigationController.PushViewController(controller, true);
                controller.barCodeLableText = code;
                controller.itemNameText     = "Bandage, Adhsv Shr Strp 1x3 (100/bx 24bx/cs) Mgm16";
                controller.itemNumberText   = "15";
                //controller.addLabelText = query;

                Console.WriteLine("Scanned Barcode: " + result.Text);
            }
        }
Ejemplo n.º 22
0
        public async Task <string> ScanAsync()
        {
            var scanner     = new ZXing.Mobile.MobileBarcodeScanner();
            var scanResults = await scanner.Scan();

            return(scanResults != null ? scanResults.Text : "");
        }
Ejemplo n.º 23
0
		override async public void ViewDidAppear (bool animated)
		{
			base.ViewDidAppear (animated);
			if (ParentViewController != null) 
			{
				CustomOverlayView customOverlay = new CustomOverlayView();
				var scanner = new ZXing.Mobile.MobileBarcodeScanner (this);

				customOverlay.ButtonCancel.TouchUpInside += delegate {
					Console.WriteLine("cancelpresssed");
					this.TabBarController.SelectedIndex = 1;
				};

				//Tell our scanner to use our custom overlay
				scanner.UseCustomOverlay = true;
				//We can customize the top and bottom text of the default overlay
				scanner.TopText = "Hold camera up to barcode to scan";
				scanner.BottomText = "Barcode will automatically scan";

				//Start scanning
				var result = await scanner.Scan (true);
				HandleScanResult (result);  

			}
		}
Ejemplo n.º 24
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            lblResult.Text = "";

            txInput.Text = "http://thinkpower.info/xamarin/cn/";

            //扫描条码
            btnScan.TouchUpInside += async (sender, e) => {
                var scanner = new ZXing.Mobile.MobileBarcodeScanner();
                var result = await scanner.Scan();

                if (result != null)
                    this.lblResult.Text = result.Text;
            };

            //产生条码
            btnGenerateBarCode.TouchUpInside += (sender, e) => {
                txInput.ResignFirstResponder();
                var writer = new BarcodeWriter
                {
                    Format = BarcodeFormat.QR_CODE

                };
                var bitmap = writer.Write(txInput.Text);
                this.img_code.Image = bitmap;
            };
        }
        public async Task <string> Scan()
        {
            var scanner = new ZXing.Mobile.MobileBarcodeScanner();

            var result = await scanner.Scan();

            return(result?.Text);
        }
Ejemplo n.º 26
0
		async public void Scannit()
        {
			var scanner = new MobileBarcodeScanner ();
            var opt = new MobileBarcodeScanningOptions();
            opt.PossibleFormats.Clear();
            opt.PossibleFormats.Add(ZXing.BarcodeFormat.QR_CODE);
            var result = await scanner.Scan(opt);
            HandleResult(result);
        }
Ejemplo n.º 27
0
		public async Task OpenScanner() {
			var scanner = new ZXing.Mobile.MobileBarcodeScanner();
			resultText = String.Empty;
			await scanner.Scan().ContinueWith(t =>
				{
					if (t.Result != null)
						resultText = t.Result.Text;
				}); 
		}
Ejemplo n.º 28
0
        private async Task QRReader()
        {
            try
            {
                MobileBarcodeScanner.Initialize(Application);
                var scanner = new ZXing.Mobile.MobileBarcodeScanner();
                var result  = await scanner.Scan();

                if (result != null)
                {
                    /* This piece of code controls the visiblity of the View materials
                     *  of the main screen, cartImage,cartEmpty and cartEmptyDescription
                     *  are the items visible when the view launched and there is nothing
                     *  in the cart.
                     *  itemName, itemPrice and itemShopName are visible when the QR Scanner
                     *  detects some item and add it in list. This replaces the cartItem layout
                     *  with Item Description.*/
                    //cartImage.Visibility = ViewStates.Gone;
                    //cartEmpty.Visibility = ViewStates.Gone;
                    //cartEmptyDescription.Visibility = ViewStates.Gone;
                    //itemName.Visibility = ViewStates.Visible;
                    //itemPrice.Visibility = ViewStates.Visible;
                    //itemShopName.Visibility = ViewStates.Visible;


                    Console.WriteLine("Scanned Barcode: " + result.Text);
                    string   QR_Text     = result.Text;
                    string[] QrTextSplit = QR_Text.Split(':');
                    //QR Code Content : Store Name : Product Name : Product Price
                    storeName = QrTextSplit[0];
                    itemNameList.Add(Convert.ToString(QrTextSplit[1]));
                    itemPriceList.Add(Convert.ToDouble(QrTextSplit[2]));

                    foreach (var itemsName in itemNameList)
                    {
                        Console.WriteLine("Name of Item : " + itemsName);
                        //itemName.Text = itemsName;
                    }

                    foreach (var itemsPrice in itemPriceList)
                    {
                        Console.WriteLine("Price of Item : " + itemsPrice);
                        //itemPrice.Text = Convert.ToString(itemsPrice);
                    }

                    //foreach(var nameStore in storeName)
                    //{
                    //    itemShopName.Text = Convert.ToString(nameStore);
                    //}
                }
            }
            catch (Exception ExCam)
            {
                Console.WriteLine("ExCam : " + ExCam);
                throw;
            }
        }
Ejemplo n.º 29
0
        public async Task <string> ScanAsync()
        {
            // https://forums.xamarin.com/discussion/comment/284749/#Comment_284749
            var optionsCustom = new MobileBarcodeScanningOptions()
            {
                AutoRotate      = false,
                TryInverted     = true,
                TryHarder       = true,
                PossibleFormats = new List <BarcodeFormat> {
                    BarcodeFormat.QR_CODE
                },
                // CharacterSet = "ISO-8859-1",
                CameraResolutionSelector = HandleCameraResolutionSelectorDelegate
                                           // DisableAutofocus = false
            };

            var scanner = new ZXing.Mobile.MobileBarcodeScanner()
            {
                TopText          = "QR Code scannen",
                BottomText       = "Bitte warten",
                CancelButtonText = "Abbrechen"
            };

            ZXing.Result scanResult = null;

            // https://forums.xamarin.com/discussion/72077/zxing-barcode-reader-autofocus
            Thread autofocusThread = new Thread(new ThreadStart(delegate
            {
                while (scanResult == null)
                {
                    scanner.AutoFocus();
                    Thread.Sleep(2000);
                }
            }));

            autofocusThread.Start();

            // scanner.AutoFocus();
            try
            {
                scanResult = await scanner.Scan(optionsCustom);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (autofocusThread.IsAlive)
                {
                    autofocusThread.Abort();
                }
            }

            return(scanResult.Text);
        }
Ejemplo n.º 30
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// Set our view from the "main" layout resource
			SetContentView (Resource.Layout.Main);

			//Create a new instance of our Scanner
			scanner = new MobileBarcodeScanner(this);

			buttonScanDefaultView = this.FindViewById<Button>(Resource.Id.buttonScanDefaultView);
			buttonScanDefaultView.Click += async delegate {
				
				//Tell our scanner to use the default overlay
				scanner.UseCustomOverlay = false;

				//We can customize the top and bottom text of the default overlay
				scanner.TopText = "Hold the camera up to the barcode\nAbout 6 inches away";
				scanner.BottomText = "Wait for the barcode to automatically scan!";

				//Start scanning
				var result = await scanner.Scan();

				HandleScanResult(result);
			};

			Button flashButton;
			View zxingOverlay;

			buttonScanCustomView = this.FindViewById<Button>(Resource.Id.buttonScanCustomView);
			buttonScanCustomView.Click += async delegate {

				//Tell our scanner we want to use a custom overlay instead of the default
				scanner.UseCustomOverlay = true;

				//Inflate our custom overlay from a resource layout
				zxingOverlay = LayoutInflater.FromContext(this).Inflate(Resource.Layout.ZxingOverlay, null);

				//Find the button from our resource layout and wire up the click event
				flashButton = zxingOverlay.FindViewById<Button>(Resource.Id.buttonZxingFlash);
				flashButton.Click += (sender, e) => scanner.ToggleTorch();

				//Set our custom overlay
				scanner.CustomOverlay = zxingOverlay;

				//Start scanning!
				var result = await scanner.Scan();

				HandleScanResult(result);
			};

			buttonFragmentScanner = FindViewById<Button> (Resource.Id.buttonFragment);
			buttonFragmentScanner.Click += delegate {
				StartActivity (typeof (FragmentActivity));	
			};
		}
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.SendActivity);
            Button   scanButton       = FindViewById <Button>(Resource.Id.ScanButton);
            Button   sendEOTButton    = FindViewById <Button>(Resource.Id.SendEOTButton);
            TextView receiverAddress  = FindViewById <TextView>(Resource.Id.ReceiverAddress);
            TextView AmountEOTtextbox = FindViewById <TextView>(Resource.Id.AmountEOT);
            TextView MinerFeesTextBox = FindViewById <TextView>(Resource.Id.MiningFee);
            TextView PasswordTextBox  = FindViewById <TextView>(Resource.Id.SendEOTPasswordText);

            MobileBarcodeScanner.Initialize(Application);

            scanButton.Click += async(sender, e) => {
                var scanner = new ZXing.Mobile.MobileBarcodeScanner();
                var result  = await scanner.Scan();

                if (result != null)
                {
                    receiverAddress.Text = result.Text;
                }
                // Console.WriteLine("Scanned Barcode: " + result.Text);
            };

            sendEOTButton.Click += (sender, e) =>
            {
                if (receiverAddress.Text != "" && receiverAddress != null)
                {
                    if (AmountEOTtextbox.Text != "" && AmountEOTtextbox.Text != " " && AmountEOTtextbox.Text != null) //check if amount and miner fees are numeric
                    {
                        if (MinerFeesTextBox.Text != "" && MinerFeesTextBox.Text != null)
                        {
                            if (PasswordTextBox.Text != "" && PasswordTextBox.Text != null)
                            {
                                Send(PasswordTextBox.Text, receiverAddress.Text, AmountEOTtextbox.Text, MinerFeesTextBox.Text);
                            }
                        }
                        else
                        {
                            Toast.MakeText(this.ApplicationContext, "You must enter an amount of miner fees to send!", ToastLength.Short).Show();
                            //System.Windows.Forms.MessageBox.Show("You must enter an amount of miner fees to send!");
                        }
                    }
                    else
                    {
                        Toast.MakeText(this.ApplicationContext, "You must enter an amount of EOT coins to send!", ToastLength.Short).Show();
                        //System.Windows.Forms.MessageBox.Show("You must enter an amount of EOT coins to send!");
                    }
                }
                else
                {
                    Toast.MakeText(this.ApplicationContext, "Receiving address must not be empty!", ToastLength.Short).Show();
                    //System.Windows.Forms.MessageBox.Show("Receiving address must not be empty!");
                }
            };
        }
		public override void ViewDidLoad ()
		{
			//Create a new instance of our scanner
			scanner = new MobileBarcodeScanner(this.NavigationController);

			//Setup our button
			buttonDefaultScan = new UIButton(UIButtonType.RoundedRect);
			buttonDefaultScan.Frame = new RectangleF(20, 80, 280, 40);
			buttonDefaultScan.SetTitle("Scan with Default View", UIControlState.Normal);
			buttonDefaultScan.TouchUpInside += (sender, e) => 
			{
				//Tell our scanner to use the default overlay
				scanner.UseCustomOverlay = false;
				//We can customize the top and bottom text of the default overlay
				scanner.TopText = "Hold camera up to barcode to scan";
				scanner.BottomText = "Barcode will automatically scan";

				//Start scanning
				scanner.Scan ().ContinueWith((t) => 
				                             {
					//Our scanning finished callback
					if (t.Status == System.Threading.Tasks.TaskStatus.RanToCompletion)
						HandleScanResult(t.Result);
				});
			};

			buttonCustomScan = new UIButton(UIButtonType.RoundedRect);
			buttonCustomScan.Frame = new RectangleF(20, 20, 280, 40);
			buttonCustomScan.SetTitle("Scan with Custom View", UIControlState.Normal);
			buttonCustomScan.TouchUpInside += (sender, e) =>
			{
				//Create an instance of our custom overlay
				customOverlay = new CustomOverlayView();
				//Wireup the buttons from our custom overlay
				customOverlay.ButtonTorch.TouchUpInside += delegate {
					scanner.ToggleTorch();		
				};
				customOverlay.ButtonCancel.TouchUpInside += delegate {
					scanner.Cancel();
				};

				//Tell our scanner to use our custom overlay
				scanner.UseCustomOverlay = true;
				scanner.CustomOverlay = customOverlay;

				scanner.Scan ().ContinueWith((t) => 
				{
					//Our scanning finished callback
					if (t.Status == System.Threading.Tasks.TaskStatus.RanToCompletion)
						HandleScanResult(t.Result);
				});
			};

			this.View.AddSubview(buttonDefaultScan);
			this.View.AddSubview(buttonCustomScan);
		}
		public AVCaptureScannerViewController(MobileBarcodeScanningOptions options, MobileBarcodeScanner scanner)
		{
			this.ScanningOptions = options;
			this.Scanner = scanner;

			var appFrame = UIScreen.MainScreen.ApplicationFrame;

			View.Frame = new CGRect(0, 0, appFrame.Width, appFrame.Height);
			View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
		}
Ejemplo n.º 34
0
 public Task<Result> Scan()
 {
     #if MONOANDROID
     var activity = this.GetService<Cirrious.MvvmCross.Droid.Interfaces.IMvxAndroidCurrentTopActivity>();
     var scanner = new MobileBarcodeScanner(activity.Activity);
     #else
     var scanner = new MobileBarcodeScanner();
     #endif
     return scanner.Scan();
 }
Ejemplo n.º 35
0
        public async Task ScanCode()
        {
            var scanner = new MobileBarcodeScanner();
            scanner.UseCustomOverlay = false;
            scanner.TopText = "Scan barcode";
            scanner.BottomText = "Back to cancel";

            var result = await scanner.Scan();
            ScanResultHandler(result);
        }
Ejemplo n.º 36
0
		async public Task<string> Scan ()
		{
			//NOTE: On Android you MUST pass a Context into the Constructor!
			var scanner = new ZXing.Mobile.MobileBarcodeScanner(WinPhone.App.RootFrame.Dispatcher);
			var result = await scanner.Scan();

			//if (result != null)
			//	Console.WriteLine("Scanned Barcode: " + result.Text);

		    return result.Text;
		}
Ejemplo n.º 37
0
        private async void buttonBarcode_Clicked(object sender, EventArgs e)
        {
            var scanner = new ZXing.Mobile.MobileBarcodeScanner();

            var result = await scanner.Scan();

            if (result != null)
            {
                await DisplayAlert("Barcode", result.Text, "Ok");
            }
        }
Ejemplo n.º 38
0
        public async void btnReadCode_Click(object sender, EventArgs e)
        {
            //NOTE: On Android, you MUST pass a Context into the Constructor!
            var scanner = new MobileBarcodeScanner();
            var result = await scanner.Scan();

            if (result != null)
            {
                await Navigation.PushAsync(new ListStopLinesPage(new ListStopLinesPageViewModel(result)));
            }
        }
Ejemplo n.º 39
0
 protected override MobileBarcodeScanner GetInstance() {
     var scanner = new MobileBarcodeScanner(Deployment.Current.Dispatcher);
     if (BarCodes.CustomOverlayFactory != null) {
         var overlay = BarCodes.CustomOverlayFactory();
         if (overlay != null) {
             scanner.UseCustomOverlay = true;
             scanner.CustomOverlay = overlay;
         }
     }
     return scanner;
 }
Ejemplo n.º 40
0
 protected override MobileBarcodeScanner GetInstance() {
     var scanner = new MobileBarcodeScanner(this.getTopActivity());
     if (BarCodes.CustomOverlayFactory != null) {
         var overlay = BarCodes.CustomOverlayFactory();
         if (overlay != null) {
             scanner.UseCustomOverlay = true;
             scanner.CustomOverlay = overlay;
         }
     }
     return scanner;
 }
        async public Task <string> Scan()
        {
            //NOTE: On Android you MUST pass a Context into the Constructor!
            var scanner = new ZXing.Mobile.MobileBarcodeScanner(WinPhone.App.RootFrame.Dispatcher);
            var result  = await scanner.Scan();

            //if (result != null)
            //	Console.WriteLine("Scanned Barcode: " + result.Text);

            return(result.Text);
        }
Ejemplo n.º 42
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// Set our view from the "main" layout resource
			SetContentView (Resource.Layout.Main);

			//Create a new instance of our Scanner
			scanner = new MobileBarcodeScanner(this);

			buttonScanDefaultView = this.FindViewById<Button>(Resource.Id.buttonScanDefaultView);
			buttonScanDefaultView.Click += delegate {
				
				//Tell our scanner to use the default overlay
				scanner.UseCustomOverlay = false;

				//We can customize the top and bottom text of the default overlay
				scanner.TopText = "Hold the camera up to the barcode\nAbout 6 inches away";
				scanner.BottomText = "Wait for the barcode to automatically scan!";

				//Start scanning
				scanner.Scan().ContinueWith((t) => {
					if (t.Status == System.Threading.Tasks.TaskStatus.RanToCompletion)
						HandleScanResult(t.Result);
				});
			};

			buttonScanCustomView = this.FindViewById<Button>(Resource.Id.buttonScanCustomView);
			buttonScanCustomView.Click += delegate {

				//Tell our scanner we want to use a custom overlay instead of the default
				scanner.UseCustomOverlay = true;

				//Inflate our custom overlay from a resource layout
				var zxingOverlay = LayoutInflater.FromContext(this).Inflate(Resource.Layout.ZxingOverlay, null);

				//Find the button from our resource layout and wire up the click event
				var flashButton = zxingOverlay.FindViewById<Button>(Resource.Id.buttonZxingFlash);
				flashButton.Click += (sender, e) => {
					//Tell our scanner to toggle the torch/flash
					scanner.ToggleTorch();
				};

				//Set our custom overlay
				scanner.CustomOverlay = zxingOverlay;

				//Start scanning!
				scanner.Scan().ContinueWith((t) => {
					if (t.Status == System.Threading.Tasks.TaskStatus.RanToCompletion)
						HandleScanResult(t.Result);
				});
			};
		}
Ejemplo n.º 43
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.Conseil);


            MobileBarcodeScanner.Initialize(Application);

            var menuProfil        = FindViewById <ImageView>(Resource.Id.imageViewConseilProfil);
            var menuHistorique    = FindViewById <ImageView>(Resource.Id.imageViewConseilHistorique);
            var menuScanner       = FindViewById <ImageView>(Resource.Id.imageViewConseilScann);
            var menuConseil       = FindViewById <ImageView>(Resource.Id.imageViewConseilConseil);
            var menuAvertissement = FindViewById <ImageView>(Resource.Id.imageViewConseilAvertissement);


            menuProfil.Click += delegate
            {
                StartActivity(typeof(Profil));
            };
            menuHistorique.Click += delegate
            {
                StartActivity(typeof(Historique));
            };

            menuConseil.Click += delegate
            {
                StartActivity(typeof(Conseil));
            };

            //Clik sur le bouton scanner
            menuScanner.Click += async(sender, e) =>
            {
                var scanner = new ZXing.Mobile.MobileBarcodeScanner();
                var result  = await scanner.Scan();

                if (result != null)
                {
                    //Intent garde la variable ID Produit et la transmet à l'activité Produit
                    Intent produit = new Intent(this, typeof(Produit));
                    produit.PutExtra("IDproduit", result.Text);
                    StartActivity(produit);
                }
                else
                {
                }
            };

            menuAvertissement.Click += delegate
            {
                StartActivity(typeof(Avertissement));
            };
        }
Ejemplo n.º 44
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            View.BackgroundColor = UIColor.White;

            webView = new UIWebView(View.Bounds);
            View.AddSubview(webView);
            webView.ShouldStartLoad = (webView, request, navType) =>
            {
//                System.Console.WriteLine("###" + request.Url.AbsoluteString);
                if (request.Url.AbsoluteString == "myapp://scan")
                {
                    var options = new ZXing.Mobile.MobileBarcodeScanningOptions
                    {
                        PossibleFormats = new List <ZXing.BarcodeFormat>()
                        {
                            ZXing.BarcodeFormat.EAN_8, ZXing.BarcodeFormat.EAN_13, ZXing.BarcodeFormat.CODE_128
                        }
                    };

                    var scanner = new ZXing.Mobile.MobileBarcodeScanner
                    {
                        //                    scanner.ScanContinuously(HandleScanResult);
                        TopText    = "Поднесите камеру к штрих-коду для сканирования",
                        BottomText = "Штрих-код будет автоматически отсканирован"
                    };
                    scanner.Scan(options).ContinueWith(t => {
                        var result = t.Result;

                        var format = result?.BarcodeFormat.ToString() ?? string.Empty;
                        var value  = result?.Text ?? string.Empty;

                        BeginInvokeOnMainThread(() => {
                            if (value != null && !string.IsNullOrEmpty(value))
                            {
                                webView.EvaluateJavascript("location.href = '/search?q=" + value + "';");
                            }
//                            var av = UIAlertController.Create("Barcode Result", format + "|" + value, UIAlertControllerStyle.Alert);
//                            av.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Cancel, null));
//                            PresentViewController(av, true, null);
                        });
                    });
                }
                return(true);
            };
            var url = "https://mobile.kcentr.ru";

            webView.LoadRequest(new NSUrlRequest(new NSUrl(url)));

            // if this is false, page will be 'zoomed in' to normal size
            webView.ScalesPageToFit = false;
        }
Ejemplo n.º 45
0
		void Handle_buttonScanSample1_Click(object sender, EventArgs e)
		{
			var scanner = new MobileBarcodeScanner();

			scanner.UseCustomOverlay = true;

			//var result = await scanner.Scan();
			scanner.Scan().ContinueWith((t) => 
			{
				ShowMessage(t.Result != null ? 
				                  t.Result.Text : "Canceled / No Barcode");
			});
		}
        public ZxingCameraViewController(MobileBarcodeScanningOptions options, MobileBarcodeScanner scanner)
            : base()
        {
			this.ScanningOptions = options;
			this.Scanner = scanner;

			_observer = NSNotificationCenter.DefaultCenter.AddObserver(
				UIApplication.DidEnterBackgroundNotification, n => {
				DismissViewController();
			});

            Initialize();
        }
Ejemplo n.º 47
0
        public async Task<BarCodeResult> ReadAsync() {
#if __IOS__
            var scanner = new MobileBarcodeScanner { UseCustomOverlay = false };
#elif ANDROID
            var scanner = new MobileBarcodeScanner(Forms.Context) { UseCustomOverlay = false };
#elif WINDOWS_PHONE
            var scanner = new MobileBarcodeScanner(System.Windows.Deployment.Current.Dispatcher) { UseCustomOverlay = false };
#endif
            var result = await scanner.Scan(this.GetXingConfig());
            return (result == null || String.IsNullOrWhiteSpace(result.Text)
                ? BarCodeResult.Fail
                : new BarCodeResult(result.Text, FromXingFormat(result.BarcodeFormat))
            );
        }
Ejemplo n.º 48
0
        public async Task <string> Scan()
        {
            var scanner = new ZXing.Mobile.MobileBarcodeScanner();

            var result = await scanner.Scan(new MobileBarcodeScanningOptions()
            {
                PossibleFormats = new List <BarcodeFormat>()
                {
                    BarcodeFormat.QR_CODE
                }
            }, true);

            return(result.Text);
        }
Ejemplo n.º 49
0
        public WordsTalkerPage() : base()
        {
            sendEditor = new Editor();
            Button sendButton = new Button()
            {
                Text = "Send",
            };

            sendButton.Clicked += onSendBtnClicked;

            Button scanQRCode = new Button();

            sendButton.Clicked += async(sender, e) =>
            {
                try
                {
                    //MobileBarcodeScanner.Initialize (Application);
                    var scanner = new ZXing.Mobile.MobileBarcodeScanner();
                    var result  = await scanner.Scan();

                    if (result != null)
                    {
                        Console.WriteLine("Scanned Barcode: " + result.Text);
                    }
                }
                catch (Exception exce)
                {
                }
            };

            StackLayout senderLayout = new StackLayout()
            {
                Orientation = StackOrientation.Vertical,
                Children    =
                {
                    sendEditor,
                    sendButton
                }
            };

            Content = new StackLayout
            {
                Orientation     = StackOrientation.Vertical,
                VerticalOptions = LayoutOptions.End,
                Children        =
                {
                    senderLayout
                }
            };
        }
Ejemplo n.º 50
0
        //public void CheckScannerAvailability() {
        //    var frontCamera = UIImagePickerController.IsCameraDeviceAvailable(UIImagePickerControllerCameraDevice.Front);
        //    var rearCamera = UIImagePickerController.IsCameraDeviceAvailable(UIImagePickerControllerCameraDevice.Rear);
        //    if (!frontCamera && !rearCamera)
        //        throw;
        //    return await AVCaptureDevice.RequestAccessForMediaTypeAsync(AVMediaType.Video);
        //}
        protected override MobileBarcodeScanner GetInstance()
        {
            var controller = this.GetTopViewController();
            var scanner = new MobileBarcodeScanner(controller);

            if (BarCodes.CustomOverlayFactory != null) {
                var overlay = BarCodes.CustomOverlayFactory();
                if (overlay != null) {
                    scanner.UseCustomOverlay = true;
                    scanner.CustomOverlay = overlay;
                }
            }
            return scanner;
        }
Ejemplo n.º 51
0
        public async void ScanQRCode()
        {
            // Initialize the scanner first so it can track the current context
            MobileBarcodeScanner.Initialize(Application);

            var scanner = new ZXing.Mobile.MobileBarcodeScanner();

            var result = await scanner.Scan();

            if (result != null)
            {
                System.Diagnostics.Debug.WriteLine("Scanned Barcode: " + result.Text);
            }
        }
Ejemplo n.º 52
0
        public async Task <string> ScanAsync()
        {
            var scanner    = new ZXing.Mobile.MobileBarcodeScanner();
            var scanResult = await scanner.Scan();

            if (scanResult != null)
            {
                return(scanResult.Text);
            }
            else
            {
                return("");
            }
        }
Ejemplo n.º 53
0
        public void ScanQRCodeContinuously(Func <IMobileBarcodeScanner, ZXing.Result, bool> action)
        {
            var scanner = new ZXing.Mobile.MobileBarcodeScanner();

            scanner.ScanContinuously((result) =>
            {
                //scanner.Torch(true);
                var url = result.Text;
                if (action == null || action(scanner, result))
                {
                    scanner.Cancel();
                }
            });
            //scanner.Torch(true);
        }
Ejemplo n.º 54
0
        public async void ReadCode_Command()
        {
            #if __ANDROID__
            // Initialize the scanner first so it can track the current context
            // MobileBarcodeScanner.Initialize(Application);
            #endif           
            var scanner = new MobileBarcodeScanner();

            var result = await scanner.Scan();

            if (result != null)
            {
                Debug.WriteLine("Result: " + result.ToString());
            }
        }
Ejemplo n.º 55
0
		public async Task<BarCodeResult> Read(BarCodeReadConfiguration config, CancellationToken cancelToken) 
		{
			config = config ?? BarCodeReadConfiguration.Default;

			var scanner = new MobileBarcodeScanner(Forms.Context) { UseCustomOverlay = false };

			cancelToken.Register(scanner.Cancel);

			var result = await scanner.Scan(this.GetXingConfig(config));

			return (result == null || String.IsNullOrWhiteSpace(result.Text)
				? BarCodeResult.Fail
				: new BarCodeResult(result.Text, FromXingFormat(result.BarcodeFormat))
			);
		}
Ejemplo n.º 56
0
        //has the user scan a barcode and returns the code
        public async static Task <string> ScanBarcode()
        {
            var scanner = new ZXing.Mobile.MobileBarcodeScanner();

            var result = await scanner.Scan();

            if (result == null)
            {
                return(null);
            }
            else
            {
                return(result.Text);
            }
        }
Ejemplo n.º 57
0
        private async void ElectricityScanLink_ClickAsync(object sender, EventArgs e)
        {
            var    StoredElectricitySettings = Application.Context.GetSharedPreferences("StoredMeterNumber", FileCreationMode.Private);
            string MeterNumber = StoredElectricitySettings.GetString("MeterNumber", null);



            if (MeterNumber == null)
            {
                AlertDialog.Builder Alert = new AlertDialog.Builder(this);
                Alert.SetTitle("Meter number");
                Alert.SetMessage("Please enter your meter number under settings");
                Alert.SetPositiveButton("Ok", delegate { Alert.Dispose(); });
                Alert.Show();
            }
            else
            {
                if (ActivityCompat.CheckSelfPermission(this, Manifest.Permission.CallPhone) != (int)Permission.Granted)
                {
                    AlertDialog.Builder Alert = new AlertDialog.Builder(this);
                    Alert.SetTitle("Meter number");
                    Alert.SetMessage("Allow permission and click once more");
                    Alert.SetPositiveButton("Ok", delegate { Alert.Dispose(); });
                    Alert.Show();

                    int REQUEST_CALLPHONE = 0;
                    ActivityCompat.RequestPermissions(this, new String[] { Manifest.Permission.CallPhone }, REQUEST_CALLPHONE);
                }
                else
                {
                    Toast.MakeText(this, "Loading...", ToastLength.Long).Show();

                    var scanner = new ZXing.Mobile.MobileBarcodeScanner();
                    var result  = await scanner.Scan();

                    if (result != null)
                    {
                        string end    = "%23";
                        string Begin  = "*120*41589";
                        var    uri    = Android.Net.Uri.Parse("tel:" + Begin + "*" + result + "*" + MeterNumber + end);
                        var    intent = new Intent(Intent.ActionCall, uri);
                        StartActivity(intent);
                    }
                }
            }
        }
Ejemplo n.º 58
0
        private async void Button2_Clicked(object sender, EventArgs e)
        {
            try
            {
                var scanner = new ZXing.Mobile.MobileBarcodeScanner();

                var result = await scanner.Scan();

                if (result != null)
                {
                    await Navigation.PushAsync(new Details(result.Text));
                }
            } catch (Exception err)
            {
                await DisplayAlert("Erro", err.Message, "OK");
            }
        }
Ejemplo n.º 59
0
        public async Task <string> ScanAsync()
        {
            var scanner = new ZXing.Mobile.MobileBarcodeScanner
            {
                UseCustomOverlay = true
            };

            var options = new ZXing.Mobile.MobileBarcodeScanningOptions()
            {
                TryHarder  = true,
                AutoRotate = false,
                UseFrontCameraIfAvailable = false,
                CameraResolutionSelector  = new CameraResolutionSelectorDelegate(SelectLowestResolutionMatchingDisplayAspectRatio),
                PossibleFormats           = new List <ZXing.BarcodeFormat>()
                {
                    ZXing.BarcodeFormat.QR_CODE
                }
            };

            View      scanView = LayoutInflater.From(Application.Context).Inflate(Resource.Layout.ScanView, null);
            ImageView imgLine  = scanView.FindViewById <ImageView>(Resource.Id.imgLine);
            ImageView imgClose = scanView.FindViewById <ImageView>(Resource.Id.imgClose);

            imgClose.Click += delegate
            {
                scanner.Cancel();
            };
            scanner.CustomOverlay = scanView;

            ObjectAnimator objectAnimator = ObjectAnimator.OfFloat(imgLine, "Y", 0, DpToPixels(240));

            objectAnimator.SetDuration(2500);
            objectAnimator.RepeatCount = -1;
            objectAnimator.SetInterpolator(new LinearInterpolator());
            objectAnimator.RepeatMode = ValueAnimatorRepeatMode.Restart;
            objectAnimator.Start();

            ZXing.Result scanResults = await scanner.Scan(CrossCurrentActivity.Current.Activity, options);

            if (scanResults != null)
            {
                return(scanResults.Text);
            }
            return(string.Empty);
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            SetContentView (Resource.Layout.activity_def_ov);
            scanCode = FindViewById<Button> (Resource.Id.btn_scan);
            scannedResult = FindViewById<TextView> (Resource.Id.tv_scanned_code);
            //Create a new instance of our Scanner
            mobileScanner = new MobileBarcodeScanner(this);
            scanCode.Click += delegate {
                //Tell our scanner we want to use a custom overlay instead of the default
                mobileScanner.UseCustomOverlay = true;

                //Inflate our custom overlay from a resource layout
                customView = LayoutInflater.FromContext(this).Inflate(Resource.Layout.zxing_custom_ov, null);
                //Find the button from our resource layout and wire up the click event
                flashButton = customView.FindViewById<Button> (Resource.Id.buttonFlashOn);
                flashButton.Click += (sender, e) => mobileScanner.ToggleTorch();
                //Set our custom overlay
                mobileScanner.CustomOverlay = customView;
                //Start scanning!
                mobileScanner.Scan().ContinueWith((t) => {
                    if (t.Status == System.Threading.Tasks.TaskStatus.RanToCompletion)
                        HandleScanResult(t.Result);
                });

            };
        }