コード例 #1
0
        public override void StartScanning(ZxingScanningOptions options, Action <ZxingBarcodeResult> onFinished)
        {
            viewController = new ZxingCameraViewController(options, this);

            viewController.BarCodeEvent += (BarCodeEventArgs e) => {
                viewController.DismissViewController();

                ZxingBarcodeResult result = null;

                if (e.BarcodeResult != null)
                {
                    result = ZxingBarcodeResult.FromZxingResult(e.BarcodeResult);
                }

                if (onFinished != null)
                {
                    onFinished(result);
                }
            };

            viewController.Canceled += (sender, e) => {
                viewController.DismissViewController();

                if (onFinished != null)
                {
                    onFinished(null);
                }
            };

            appController.PresentViewController(viewController, true, () => { });
        }
コード例 #2
0
		public override void StartScanning (ZxingScanningOptions options, Action<ZxingBarcodeResult> onFinished)
		{

			viewController = new ZxingCameraViewController(options, this);

			viewController.BarCodeEvent += (BarCodeEventArgs e) => {

				viewController.DismissViewController();

				ZxingBarcodeResult result = null;

				if (e.BarcodeResult != null)
					result = ZxingBarcodeResult.FromZxingResult(e.BarcodeResult);

				if (onFinished != null)
					onFinished(result);
			};

			viewController.Canceled += (sender, e) => {

				viewController.DismissViewController();

				if (onFinished != null)
					onFinished(null);
			};

			appController.PresentViewController(viewController, true, () => { });
		}
コード例 #3
0
        public ZxingSurfaceView(ZxingCameraViewController parentController, ZxingScanner scanner, ZxingScanningOptions options, UIView overlayView) : base()
        {
			var screenFrame = UIScreen.MainScreen.Bounds;
			var scale = UIScreen.MainScreen.Scale;
			screenFrame = new RectangleF(screenFrame.X, screenFrame.Y, screenFrame.Width * scale, screenFrame.Height * scale);

			var picFrameWidth = Math.Round(screenFrame.Width * 0.90); //screenFrame.Width;
			var picFrameHeight = Math.Round(screenFrame.Height * 0.60);
			var picFrameX = (screenFrame.Width - picFrameWidth) / 2;
			var picFrameY = (screenFrame.Height - picFrameHeight) / 2;

			picFrame = new RectangleF((int)picFrameX, (int)picFrameY, (int)picFrameWidth, (int)picFrameHeight);

			//Console.WriteLine(picFrame.X + ", " + picFrame.Y + " -> " + picFrame.Width + " x " + picFrame.Height);
			this.OverlayView = overlayView;
			this.Scanner = scanner;
			this.Options = options;

            Initialize();
			_parentViewController = parentController;
        }
コード例 #4
0
        public ZxingSurfaceView(ZxingCameraViewController parentController, ZxingScanner scanner, ZxingScanningOptions options, UIView overlayView) : base()
        {
            var screenFrame = UIScreen.MainScreen.Bounds;
            var scale       = UIScreen.MainScreen.Scale;

            screenFrame = new RectangleF(screenFrame.X, screenFrame.Y, screenFrame.Width * scale, screenFrame.Height * scale);

            var picFrameWidth  = Math.Round(screenFrame.Width * 0.90);            //screenFrame.Width;
            var picFrameHeight = Math.Round(screenFrame.Height * 0.60);
            var picFrameX      = (screenFrame.Width - picFrameWidth) / 2;
            var picFrameY      = (screenFrame.Height - picFrameHeight) / 2;

            picFrame = new RectangleF((int)picFrameX, (int)picFrameY, (int)picFrameWidth, (int)picFrameHeight);

            //Console.WriteLine(picFrame.X + ", " + picFrame.Y + " -> " + picFrame.Width + " x " + picFrame.Height);
            this.OverlayView = overlayView;
            this.Scanner     = scanner;
            this.Options     = options;

            Initialize();
            _parentViewController = parentController;
        }