public override void ViewDidDisappear(bool animated)
        {
            base.ViewDidDisappear(animated);

            //un-register any event handlers here, if you have any

            //we have to erase the scan view so that there are no dependencies for the viewcontroller left.
            anylineBarcodeView.RemoveFromSuperview();
            anylineBarcodeView.Dispose();
            anylineBarcodeView = null;

            base.Dispose();
        }
        new void Dispose()
        {
            //un-register any event handlers here, if you have any

            //we have to erase the scan view so that there are no dependencies for the viewcontroller left.

            _anylineBarcodeView?.RemoveFromSuperview();
            _anylineBarcodeView?.Dispose();
            _anylineBarcodeView = null;

            GC.Collect(GC.MaxGeneration);

            base.Dispose();
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Initializing the barcode module.
            _frame = UIScreen.MainScreen.ApplicationFrame;
            _frame = new CGRect(_frame.X,
                                _frame.Y + NavigationController.NavigationBar.Frame.Size.Height,
                                _frame.Width,
                                _frame.Height - NavigationController.NavigationBar.Frame.Size.Height);

            _anylineBarcodeView = new AnylineBarcodeModuleView(_frame);

            _error   = null;
            _success = _anylineBarcodeView.SetupWithLicenseKey(_licenseKey, Self, out _error);

            if (!_success)
            {
                (Alert = new UIAlertView("Error", _error.DebugDescription, (IUIAlertViewDelegate)null, "OK", null)).Show();
            }

            // Anyline will stop searching for new results once it found a valid code. Here we tell it to continue scanning
            // after it found and reported the result.
            _anylineBarcodeView.CancelOnResult = false;

            _anylineBarcodeView.BeepOnResult = true;

            // After setup is complete we add the module to the view of this view controller
            View.AddSubview(_anylineBarcodeView);

            // The resultLabel is used as a debug view to see the scanned results. We set its text
            // in anylineBarcodeModuleView:didFindScanResult:atImage below
            _resultLabel = new UILabel(new CGRect(0, View.Frame.Size.Height - 100, View.Frame.Size.Width, 50));

            _resultLabel.TextAlignment             = UITextAlignment.Center;
            _resultLabel.TextColor                 = UIColor.White;
            _resultLabel.Font                      = UIFont.FromName(@"HelveticaNeue-UltraLight", 22);
            _resultLabel.AdjustsFontSizeToFitWidth = true;

            View.AddSubview(_resultLabel);
        }
 /*
  * This is the main delegate method Anyline uses to report its scanned codes
  */
 void IAnylineBarcodeModuleDelegate.DidFindResult(AnylineBarcodeModuleView anylineBarcodeModuleView, ALBarcodeResult scanResult)
 {
     _resultLabel.Text = scanResult.Result.ToString();
 }
 /*
  * This is the main delegate method Anyline uses to report its scanned codes
  */
 public void DidFindScanResult(AnylineBarcodeModuleView anylineBarcodeModuleView, string scanResult, string barcodeFormat, UIImage image)
 {
     resultLabel.Text = scanResult;
 }