Inheritance: System.EventArgs
        public void BarCodeScanned(Result result)
        {
            if (OverlayView != null)
                OverlayView.StopWorker();

            if(_imageView!=null)
            {
                _imageView.RemoveFromSuperview();
            }

            if(result!=null)
            {
                    BarCodeEventArgs eventArgs = new BarCodeEventArgs(result);
                    BarCodeEventHandler handler  = BarCodeEvent;
                    if (handler != null)
                    {
                        // Invokes the delegates.
                        handler(eventArgs);
                        BarCodeEvent = null;
                    }

            }
        }
        void Handle_pickerBarCodeEvent(BarCodeEventArgs evs)
        {
            CameraPicker.DismissViewController();

            //Need this, just in case if it's called more than once...
            TimeSpan span = DateTime.Now.Subtract(_lastPicked);

            if (span.TotalSeconds > 2)
            {
                _currentBarCode     = evs.BarcodeResult.Text;
                _currentBarCodeType = evs.BarcodeResult.BarcodeFormat.Name;

                //Show the result
                AppDelegate.MainAppDelegate.ShowPopUp("Barcode scanned", String.Format("Barcode type:{0}   Barcode:{1}", _currentBarCodeType, _currentBarCode), 10, false, AppDelegate.MainAppDelegate.MainView);
                _lastPicked = DateTime.Now;
            }
            else
            {
                return;
            }

            if (CameraPicker.OverlayView == null)
            {
                return;
            }

            if (CameraPicker.OverlayView.WorkerTimer != null)
            {
                CameraPicker.OverlayView.WorkerTimer.Invalidate();
                CameraPicker.OverlayView.WorkerTimer.Dispose();
                CameraPicker.OverlayView.WorkerTimer = null;
            }

            CameraPicker.OverlayView.Dispose();
            CameraPicker.OverlayView   = null;
            CameraPicker.BarCodeEvent -= Handle_pickerBarCodeEvent;
        }
示例#3
0
        public void BarCodeScanned(Result result)
        {
            if (OverlayView != null)
            {
                OverlayView.StopWorker();
            }

            if (_imageView != null)
            {
                _imageView.RemoveFromSuperview();
            }

            if (result != null)
            {
                BarCodeEventArgs    eventArgs = new BarCodeEventArgs(result);
                BarCodeEventHandler handler   = BarCodeEvent;
                if (handler != null)
                {
                    // Invokes the delegates.
                    handler(eventArgs);
                    BarCodeEvent = null;
                }
            }
        }