Beispiel #1
0
 public static QRCodeReaderViewController Intance()
 {
     if (null == intance)
     {
         intance = new QRCodeReaderViewController();
     }
     return(intance);
 }
Beispiel #2
0
        public QRCodeReaderView(QRCodeReaderViewController _thisController)
        {
            this.thisController = _thisController;

            this.BackgroundColor = UIColor.White;

            scanAnimateView = new ScanAnimateView();
            this.AddSubview(scanAnimateView);

            UIButton btnCancel = new UIButton(UIButtonType.Custom);

            btnCancel.SetTitle("Cancel", UIControlState.Normal);
            btnCancel.SetTitleColor(UIColor.LightGray, UIControlState.Highlighted);
            btnCancel.Frame = new CGRect(20, 40, 80, 20);
            this.Add(btnCancel);
            btnCancel.TouchUpInside += delegate {
                thisController.Close();
            };

            UIButton btnFlash = new UIButton(UIButtonType.Custom);

            btnFlash.SetTitle("Flash", UIControlState.Normal);
            btnFlash.SetTitleColor(UIColor.LightGray, UIControlState.Highlighted);
            btnFlash.Frame = new CGRect(UIScreen.MainScreen.Bounds.Width - 100, 40, 80, 20);
            this.Add(btnFlash);
            btnFlash.TouchUpInside += delegate {
                device.LockForConfiguration(out error);
                if (device.FlashMode == AVCaptureFlashMode.On)
                {
                    device.TorchMode = AVCaptureTorchMode.Off;
                    device.FlashMode = AVCaptureFlashMode.Off;
                }
                else
                {
                    device.TorchMode = AVCaptureTorchMode.On;
                    device.FlashMode = AVCaptureFlashMode.On;
                }
                device.UnlockForConfiguration();
            };

            Setup();
        }
Beispiel #3
0
 public static void ShowQRCodeReaderViewController(this UIViewController controller, QRCodeReaderCallback callback)
 {
     QRCodeReaderViewController.Intance().Show(controller.NavigationController, (result) => {
         callback.Invoke(result);
     });
 }