Пример #1
0
 private void ProcessImage(Object sender,FingerImage image)
 {
     try
     {
         if (sender == currentDevice)
         {
             FingerPicture pic = image.MakePicture();
             Dispatcher.Invoke(new Action(() => showImage(pic)));
         }
     }
     catch (Exception e)
     {
         //Log.Info(e);
     }
 }
Пример #2
0
        private void ProcessSingle(Object sender,FingerImage image)
        {
            try
            {
                if (isBusy && !isVerifyingPalm)
                {
                    return;
                }
                if (sender == currentDevice)
                {
                    FingerPicture pic = image.MakePicture();
                    showImage(pic);
                    if (isVerifyingPalm)
                    {
                        var verifyList = new List <FingerTemplate>();
                        verifyList.Add(currentDevice.Extract(image));
                        BiometricsEnrolled(this,verifyList);
                        return;
                    }

                    var candidates = new ComparsionCandidates(currentCredential.fingers);

                    /////////////
                    IDeviceControl        currDeviceControl;
                    List <FingerTemplate> matchedTemplates;
                    foreach (var devCtrl in Owner.PluginManager.DeviceControls)
                    {
                        if (devCtrl.ActiveDevices.Contains(currentDevice))
                        {
                            currDeviceControl = devCtrl;
                            int fingerIndex = currDeviceControl.Match(currentDevice.Extract(image),candidates.Candidates.ToArray(),out matchedTemplates);

                            if (fingerIndex == 0)
                            {
                                if (_controlType == ControlTypeEnum.FINGERPRINT_CONTROL_TYPE)
                                {
                                    fingerDisplay.ShowPopUp("Finger is not registered");
                                }
                                else if (_controlType == ControlTypeEnum.PALM_CONTROL_TYPE)
                                {
                                    fingerDisplay.ShowPopUp("Palm is not registered");
                                }
                                UpdateFingers();
                            }
                            else
                            {
                                if (_controlType == ControlTypeEnum.FINGERPRINT_CONTROL_TYPE)
                                {
                                    fingerDisplay.ShowPopUp("Finger is registered as " + FingerCredential.GetFingerName(candidates.PositionOf(matchedTemplates[0])));
                                    fingerChooser.ShowFinger(candidates.PositionOf(matchedTemplates[0]));
                                }
                                else if (_controlType == ControlTypeEnum.PALM_CONTROL_TYPE)
                                {
                                    fingerDisplay.ShowPopUp("Palm is registered as " + FingerCredential.GetFingerName(candidates.PositionOf(matchedTemplates[0])));
                                    if (candidates.PositionOf(matchedTemplates[0]) == 10)
                                    {
                                        if (highlightedPalm == 11)
                                        {
                                            palmEnrollControl.RightStatePalmP = StatePalm.WhiteBlack;
                                        }
                                        if (palmEnrollControl.LeftStatePalmP != StatePalm.Green)
                                        {
                                            palmEnrollControl.LeftStatePalmP = StatePalm.GreenBlack;
                                            highlightedPalm = 10;
                                        }
                                    }
                                    else if (candidates.PositionOf(matchedTemplates[0]) == 11)
                                    {
                                        if (highlightedPalm == 10)
                                        {
                                            palmEnrollControl.LeftStatePalmP = StatePalm.WhiteBlack;
                                        }
                                        if (palmEnrollControl.RightStatePalmP != StatePalm.Green)
                                        {
                                            palmEnrollControl.RightStatePalmP = StatePalm.GreenBlack;
                                            highlightedPalm = 11;
                                        }
                                    }
                                }
                                // Reset fingers after all
                                textReset = RESETER_TEXT_LIFETIME_MS;
                            }
                        }
                    }
                    /////////////
                    currentDevice.Dispatch(COMMAND.SINGLECAPTURE_START);
                }
            }
            catch (Exception ex)
            {
                //Log.Info(ex);
            }
        }