示例#1
0
        void _fpScanner_OnFingerprintsDetected_new(List <Fingerprint> fingerprints)
        {
            #region GUI - Display Fingerprints
            fingerprints_new = fingerprints;


            #endregion


            Dictionary <long, LocalUser> userList = _afis.GetUserList();
            xamlListBoxUsers.Items.Clear();
            foreach (LocalUser user in userList.Values)
            {
                //xamlListBoxUsers.Items.Add(user);
                // }

                _selectedUser = user;


                // xamlStackPanelFingerprints.Controls.Add(fl);
                if (_selectedUser != null)
                {
                    try
                    {
                        //Verify User
                        DisplayMessage("Verifying Templates");
                        AFISVerificationResult result = _afis.VerifyUser(_selectedUser.ID, fingerprints, Properties.Settings.Default.VerificationThreshold);
                        String scoreString            = String.Format("{0:0.00}", result.Score);

                        if (result.Score > maxMatch)
                        {
                            maxMatch = result.Score;
                        }

                        if (result.Hit)
                        {
                            displayMessage(String.Format("User verified ({0})", scoreString), Utils.COLOR_DERMALOG_GREEN);
                            //label2.Text = String.Format("User verified ({0}%)", scoreString);
                            //aGauge1.Value = (float)result.Score;

                            break;
                        }
                        else
                        {
                            displayMessage(String.Format("User not verified ({0})", scoreString), Utils.COLOR_DERMALOG_RED);
                            //label2.Text = String.Format("User verified ({0}%)", scoreString);
                            //aGauge1.Value = (float)result.Score;
                        }
                        String bestscoreString = String.Format("{0:0.00}", maxMatch);
                        label2.Text   = String.Format("Best User verified ({0}%) username= {1}", bestscoreString, _selectedUser.Name);
                        aGauge1.Value = (float)maxMatch;

                        showAnimation(aGauge1);
                        //StopCapturing();
                        //NewMethod();
                    }
                    catch (Exception e)
                    {
                        DisplayError(e.Message);
                        //StopCapturing();
                    }
                }

                {
                    //this.BeginInvoke((MethodInvoker)delegate ()
                    //{
                    //    NewMethod();

                    //    Label l = new Label(); l.Location = new Point(12, 10);
                    //    l.Text = "Some Text";
                    //    this.Controls.Add(l);
                    //}
                    //);

                    //var resp;
                    //Task.Factory.StartNew(()=>NewMethod_new()).
                }
            }

            //dispose allocated fingerprint templates
            foreach (Fingerprint fingerprint in fingerprints)
            {
                fingerprint.Dispose();
            }

            _fpScanner.Freeze(false);
        }