示例#1
0
        private void StartCapturing()
        {
            //NFingerScanner scanner = scannersListBox.SelectedItem as NFingerScanner;
            _currentScanner = scannersListBox.SelectedItem as NFingerScanner;
            if (_currentScanner == null)
            {
                MessageBox.Show(@"Please select a scanner from the list.");
                return;
            }

            OnIsScanningChanged(true);
            //scanWorker.RunWorkerAsync(_currentScanner);

            // Create a finger
            _subjectFinger = new NFinger();

            // Add finger to the subject and fingerView
            _subject = new NSubject();
            _subject.Fingers.Add(_subjectFinger);
            _subjectFinger.PropertyChanged += OnAttributesPropertyChanged;
            _nfView.Finger     = _subjectFinger;
            _nfView.ShownImage = ShownImage.Original;

            // Begin capturing
            _biometricClient.FingersReturnBinarizedImage = true;
            var task = _biometricClient.CreateTask(NBiometricOperations.Detect | NBiometricOperations.Capture | NBiometricOperations.CreateTemplate | NBiometricOperations.AssessQuality, _subject);

            _biometricClient.BeginPerformTask(task, OnEnrollCompleted, null);
        }
示例#2
0
        private void timerScannerStatus_Tick(object sender, EventArgs e)
        {
            ShowMessage(@"Place your finger on the scanner firmly");
            lblQuality.Text = string.Empty;
            if (scannerStatus)
            {
                try
                {
                    int            selectedScannerIndex = Convert.ToInt32(_AppSettings.ScannerDevice);
                    NFingerScanner scanner = devices[selectedScannerIndex] as NFingerScanner;

                    if (scanner == null)
                    {
                        ShowMessage(@"No Scanner found.");
                        return;
                    }

                    if (scanWorker.IsBusy)
                    {
                        ShowMessage(@"Scan already in progress.");
                        return;
                    }

                    OnIsScanningChanged(true);
                    scanWorker.RunWorkerAsync(scanner);
                }
                catch (Exception ex)
                {
                    Logger.logToFile(ex, AppSettings.ErrorLogPath);
                    ShowMessage(ex.Message);
                }
            }
        }
示例#3
0
        private void ScanWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            timerScannerStatus.Stop();
            NFingerScanner scanner = (NFingerScanner)e.Argument;

            _currentScanner = scanner;

            StartCapturing(scanner);
        }
示例#4
0
        private void ScanWorkerRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            _currentScanner = null;

            if (_nfView.Finger.Image != null)
            {
                _nfView.Finger.Image.Dispose();
                _nfView.Finger.Image = null;
            }
            if (_nfView.Finger.Objects[0].Template != null)
            {
                _nfView.Finger.Objects[0].Template.Dispose();
                _nfView.Finger.Objects[0].Template = null;
            }
            lblQuality.Text = string.Empty;


            if (e.Error != null)
            {
                MessageBox.Show(e.Error.Message);
                Logger.logToFile(e.Error, AppSettings.ErrorLogPath);
                return;
            }

            if (e.Cancelled)
            {
                lblQuality.Text = @"Scanning canceled.";
                return;
            }

            NImage image = e.Result as NImage;

            if (image == null)
            {
                return;
            }

            _nfView.Width  = (int)panelFingerPrint.Width;
            _nfView.Height = (int)panelFingerPrint.Height;


            _nfView.Finger.Image = image;
            _nfView.Refresh();
        }
示例#5
0
        private void ScanWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            NFingerScanner scanner = (NFingerScanner)e.Argument;

            _currentScanner = scanner;

            scanner.Preview += new EventHandler <NFScannerPreviewEventArgs>(ScannerPreview);
            try
            {
                e.Result = scanner.Capture();
            }
            finally
            {
                scanner.Preview -= new EventHandler <NFScannerPreviewEventArgs>(ScannerPreview);
            }

            if (((BackgroundWorker)sender).CancellationPending)
            {
                e.Cancel = true;
            }
        }
示例#6
0
 private void ScanWorkerRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     _currentScanner = null;
 }