/// <summary>
        /// Open the reader and capture two fingers to compare.
        /// </summary>
        private void VerifyThread()
        {
            Constants.ResultCode result = Constants.ResultCode.DP_DEVICE_FAILURE;
            result = currentinstance.CurrentReader.Open(Constants.CapturePriority.DP_PRIORITY_COOPERATIVE);
            if (result != Constants.ResultCode.DP_SUCCESS)
            {
                MessageBox.Show("Error:  " + result);
                if (currentinstance.CurrentReader != null)
                {
                    currentinstance.CurrentReader.Dispose();
                    currentinstance.CurrentReader = null;
                }
                return;
            }

            Fmd fmd1 = null;

            //  Fmd fmd2 = null;

            SendMessage("Place a finger on the reader.");

            int count = 0;

            while (!reset)
            {
                Fid fid = null;

                if (!currentinstance.CaptureFinger(ref fid))
                {
                    break;
                }

                if (fid == null)
                {
                    continue;
                }

                SendMessage("A finger was captured.");

                DataResult <Fmd> resultConversion = FeatureExtraction.CreateFmdFromFid(fid, Constants.Formats.Fmd.ANSI);

                if (resultConversion.ResultCode != Constants.ResultCode.DP_SUCCESS)
                {
                    break;
                }

                /* if (count == 0)
                 * {
                 *   fmd1 = resultConversion.Data;
                 *   count += 1;
                 *   SendMessage("Now place the same or a different finger on the reader.");
                 * }
                 * else if (count == 1)
                 * {
                 *   fmd2 = resultConversion.Data;
                 *   CompareResult compareResult = Comparison.Compare(fmd1, 0, fmd2, 0);
                 *
                 *   if (compareResult.ResultCode != Constants.ResultCode.DP_SUCCESS)
                 *   {
                 *       break;
                 *   }
                 *
                 *   SendMessage("Comparison resulted in a dissimilarity score of " + compareResult.Score.ToString() + (compareResult.Score < (PROBABILITY_ONE/100000) ? " (fingerprints matched)" : " (fingerprints did not match)"));
                 *   SendMessage("Place a finger on the reader.");
                 *   count = 0;
                 * }*/
                fmd1 = resultConversion.Data;
                bool pass_threshold = false;
                foreach (Fmd fd  in database)
                {
                    CompareResult compareResult = Comparison.Compare(fmd1, 0, fd, 0);
                    if (compareResult.ResultCode != Constants.ResultCode.DP_SUCCESS)
                    {
                        break;
                    }
                    pass_threshold = compareResult.Score < (PROBABILITY_ONE / 100000);
                    SendMessage("Comparison resulted in a dissimilarity score of " + compareResult.Score.ToString() + (pass_threshold ? " (fingerprints matched)" : " (fingerprints did not match)"));
                    //SendMessage("Place a finger on the reader.");
                    if (pass_threshold)
                    {
                        MessageBox.Show("Verification Successful", "Success", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        break;
                    }
                }
                if (!pass_threshold)
                {
                    MessageBox.Show("Verification Failed!!!", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            if (currentinstance.CurrentReader != null)
            {
                currentinstance.CurrentReader.Dispose();
            }
        }