コード例 #1
0
        private void DeviceSelected(object sender, RoutedEventArgs e)
        {
            RadioButton rb = (sender as RadioButton);

            try
            {
                checkFinger.SetText("");
                arrowClicked = true;
                // If Provider has an active device
                if (rb.Content is IFingerDevice)
                {
                    Ambassador.SetCallback(DispatchMessage);
                    _currDevice = rb.Content as IFingerDevice;
                    _currDevice.Dispatch(COMMAND.SINGLECAPTURE_START);
                    checkFinger.IsDeviceConnected = true;
                }
                else
                {
                    checkFinger.IsDeviceConnected = false;
                }
                ShowState();
            }
            catch (Exception ex)
            {
                Auxiliary.Logger._log.Error(ex);
            }
        }
コード例 #2
0
        private void fetchImage(object sender,DoWorkEventArgs e)
        {
            var    image = e.Argument as FingerImage;
            String type,data;

            Dispatcher.Invoke(new Action(() => currDevice.Dispatch(COMMAND.SINGLECAPTURE_STOP)));
            Thread.Sleep(250); // it's magic!

            image.Serialize(out type,out data);
            var bioData = new BioData(type,data);

            Dispatcher.Invoke(new Action(() => SendBio(bioData)));
            FingerPicture pic = image.MakePicture();

            Dispatcher.Invoke(new Action(() => showImage(pic)));
        }
コード例 #3
0
        private void ImageProcessed(BiosecLibClient.BiometricProcessingRes res)
        {
            switch (res)
            {
            case BiosecLibClient.BiometricProcessingRes.BiometricAccepted:
                _username = _libClient.getUserName().ToString();
                // Show biometrics accepted
                _currState = CollectorDialogState.GOOD_BIOMETRICS;
                ShowMessage(false);
                if (_options.IsUnsecure)
                {
                    _result = ResultState.SHOW_FILECHOOSER;
                }
                if (_options.IsSecure)
                {
                    _result = ResultState.SHOW_PB_ENC;
                }
                HideWindowAfter(2000);
                return;

            case BiosecLibClient.BiometricProcessingRes.BiometricMatchNotFound:
                _currState = CollectorDialogState.BAD_BIOMETRICS;
                ShowMessage(false);
                break;

            case BiosecLibClient.BiometricProcessingRes.BiometricNotBelongsToUser:
                _username  = _libClient.getUserName().ToString();
                _currState = CollectorDialogState.NOT_IDENTIFIED_AS_CURRENT_USER;
                ShowMessage(false);
                break;

            case BiosecLibClient.BiometricProcessingRes.BiometricInvalidEncryptionKey:
                _currState = CollectorDialogState.BAD_ENCRYTPION_KEY;
                ShowMessage(false);
                break;

            case BiosecLibClient.BiometricProcessingRes.BiometricInternalError:
            case BiosecLibClient.BiometricProcessingRes.BiometricUnknowEnrror:
            default:
                Auxiliary.Logger._log.Error("Biosecure library thrown " + res.ToString());
                break;
            }
            if (_currDevice != null)
            {
                _currDevice.Dispatch(COMMAND.SINGLECAPTURE_START);
            }
        }
コード例 #4
0
        /// <summary>
        /// Call this function to end / abort enrollment process
        /// </summary>
        public void endEnrollment()
        {
            EnrollmentProgress.Value = 0;

            currentDevice.Dispatch(COMMAND.ENROLLMENT_STOP);
            Ambassador.ClearCallback();

            //currentDevice.StopEnrollment();
            UpdateFingers();
            isBusy = false;
            if (_controlType == ControlTypeEnum.FINGERPRINT_CONTROL_TYPE)
            {
                fingerDisplay.ClearImage();
                fingerChooser.DeSelectFinger(fingerNum);
            }
            else if (_controlType == ControlTypeEnum.PALM_CONTROL_TYPE)
            {
                palmEnrollControl.SetOriginalColor();
            }
            Cancel.Visibility            = Visibility.Collapsed;
            UpdateBtn.Visibility         = Visibility.Visible;
            ProviderBox.IsEnabled        = true;
            EnrollmentProgress.IsEnabled = false;

            Ambassador.SetCallback(DispatchMessage);
            currentDevice.Dispatch(COMMAND.SINGLECAPTURE_START);
            //showMessageBase("Please, select finger to enroll or touch the scanner to verify it");
            switch (_controlType)
            {
            case ControlTypeEnum.FINGERPRINT_CONTROL_TYPE:
                forceShowMessageBase(baseHint);
                break;

            case ControlTypeEnum.PALM_CONTROL_TYPE:
                forceShowMessageBase(baseHint);
                break;

            default:
                break;
            }
        }
コード例 #5
0
        private void DeviceDeselected(object sender, RoutedEventArgs e)
        {
            RadioButton radioButton = (sender as RadioButton);

            try
            {
                // If Provider has an active device
                if (radioButton.Content is IFingerDevice)
                {
                    IFingerDevice device = (sender as RadioButton).Content as IFingerDevice;
                    Ambassador.ClearCallback();

                    device.Dispatch(COMMAND.LIVECAPTURE_STOP);
                    (sender as RadioButton).IsEnabled = true;
                }
            }
            catch (Exception ex)
            {
                Auxiliary.Logger._log.Error(ex);
            }
        }
コード例 #6
0
        void TestPageDeviceSelected(object sender, RoutedEventArgs e)
        {
            RadioButton radioButton = (sender as RadioButton);

            try
            {
                // If Provider has an active device
                if (radioButton.Content is IFingerDevice)
                {
                    currentTestDevice           = (sender as RadioButton);
                    currentTestDevice.IsEnabled = false;
                    IFingerDevice device = (sender as RadioButton).Content as IFingerDevice;

                    TestScannerPage.Children.Clear();
                    checkFinger = new FingerDisplay();
                    TestScannerPage.Children.Add(checkFinger);

                    //checkFinger.SetText("Please, touch the scanner");
                    Ambassador.SetCallback(DispatchMessage);
                    device.Dispatch(COMMAND.LIVECAPTURE_START);
                    imageReseter.Start();
                }
                else
                {
                    Ambassador.ClearCallback();
                    if (checkFinger != null)
                    {
                        TestScannerPage.Children.Clear();
                        checkFinger = null;
                    }
                    checkFinger = new FingerDisplay(Properties.Resources.no_device);
                    TestScannerPage.Children.Add(checkFinger);
                    checkFinger.SetText("Connect device and press refresh");
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex);
            }
        }
コード例 #7
0
        private void ProviderBox_SelectionChanged(object sender,SelectionChangedEventArgs e)
        {
            if (currentCredential != null)
            {
                UpdateCredential();
            }
            currentCredential        = null;
            EnrollmentProgress.Value = 0;
            IFingerDevice device = (sender as ComboBox).SelectedItem as IFingerDevice;

            //if (currentDevice != null)
            if (isOnline)
            {
                Ambassador.ClearCallback();
                currentDevice.Dispatch(COMMAND.SINGLECAPTURE_STOP);
            }

            currentDevice = device;
            isOnline      = true;
            if (device.BSPCode == 24)
            {
                _controlType                 = ControlTypeEnum.PALM_CONTROL_TYPE;
                fingerChooser.Visibility     = Visibility.Collapsed;
                palmEnrollControl.Visibility = Visibility.Visible;
            }
            else
            {
                _controlType                 = ControlTypeEnum.FINGERPRINT_CONTROL_TYPE;
                fingerChooser.Visibility     = Visibility.Visible;
                palmEnrollControl.Visibility = Visibility.Collapsed;
            }

            Ambassador.SetCallback(DispatchMessage);
            currentDevice.Dispatch(COMMAND.SINGLECAPTURE_START);



            foreach (var iface in currentDevice.GetType().GetInterfaces())
            {
                foreach (var fingerCred in Owner.Credentials.OfType <FingerCredential>())
                {
                    if (fingerCred.device.Equals(currentDevice.ToString()))
                    {
                        currentCredential = new FingerCredential(fingerCred);
                    }
                }
            }

            if (currentCredential == null)
            {
                currentCredential            = new FingerCredential();
                currentCredential.device     = currentDevice.ToString();
                currentCredential.deviceName = currentDevice.ToString();
                //Owner.Credentials.Add(currentCredential);
            }

            fingerDisplay = new FingerDisplay();
            Scanner.Children.Clear();
            Scanner.Children.Add(fingerDisplay);
            fingerDisplay.ClearImage();
            Cancel.Visibility            = Visibility.Collapsed;
            UpdateBtn.Visibility         = Visibility.Visible;
            ProviderBox.IsEnabled        = true;
            EnrollmentProgress.IsEnabled = false;

            UpdateFingers();
//            showMessageBase("Please, select finger to enroll or touch the scanner to verify it");
            switch (_controlType)
            {
            case ControlTypeEnum.FINGERPRINT_CONTROL_TYPE:
                baseHint = "Please, select finger to enroll or touch the scanner to verify it";    //
                showMessageBase(baseHint);
                break;

            case ControlTypeEnum.PALM_CONTROL_TYPE:
                baseHint = "Please, select palm to enroll or place your hand above the scanner to verify it";    //
                showMessageBase(baseHint);
                break;

            default:
                break;
            }
        }