public override void ViewDidAppear(bool animated)
        {
            scannerView.OnScannerSetupComplete += HandleOnScannerSetupComplete;

            originalStatusBarStyle = UIApplication.SharedApplication.StatusBarStyle;

            if (UIDevice.CurrentDevice.CheckSystemVersion(7, 0))
            {
                UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.Default;
                SetNeedsStatusBarAppearanceUpdate();
            }
            else
            {
                UIApplication.SharedApplication.SetStatusBarStyle(UIStatusBarStyle.LightContent, false);
            }

            // Start scanning
            Task.Factory.StartNew(() =>
            {
                BeginInvokeOnMainThread(() => scannerView.StartScanning(result =>
                {
                    // If scanner stop the scanning
                    if (!ContinuousScanning)
                    {
                        scannerView.StopScanning();
                    }

                    this.OnScannedResult?.Invoke(result);
                }, this.ScanningOptions));
            });
        }
예제 #2
0
        public override void ViewDidAppear(bool animated)
        {
            _scannerView.OnScannerSetupComplete += HandleOnScannerSetupComplete;

            _originalStatusBarStyle = UIApplication.SharedApplication.StatusBarStyle;

            if (UIDevice.CurrentDevice.CheckSystemVersion(7, 0))
            {
                UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.Default;
                SetNeedsStatusBarAppearanceUpdate();
            }
            else
            {
                UIApplication.SharedApplication.SetStatusBarStyle(UIStatusBarStyle.BlackTranslucent, false);
            }
            Task.Factory.StartNew(() =>
            {
                BeginInvokeOnMainThread(() => _scannerView.StartScanning(result => {
                    Console.WriteLine(result);
                    if (!ContinuousScanning)
                    {
                        _scannerView.StopScanning();
                    }

                    var evt = OnScannedResult;
                    evt?.Invoke(result);
                }, ScanningOptions));
            });
        }