protected void Button2_Click(object sender, EventArgs e)
    {
        //////////////  initializing machine

        DeviceInfo deviceInfo = null;
        int        ret        = mfs100.Init();

        if (ret != 0)
        {
            Literal1.Text = mfs100.GetErrorMsg(ret).ToString();
        }
        else
        {
            deviceInfo = mfs100.GetDeviceInfo(); if (deviceInfo != null)
            {
                //string scannerInfo = "SERIAL NO.: " + deviceInfo.SerialNo + " MAKE: " + deviceInfo.Make + " MODEL: " + deviceInfo.Model; lblSerial.Text = scannerInfo;
            }
            else
            {
                //lblSerial.Text = "";
            }
            Literal1.Text = mfs100.GetErrorMsg(ret).ToString();
        }


        /////////////////// capturing finger
        FingerData fingerprintData = null;
        int        timeout         = 300000;
        string     datapath        = "c:\\fingerprints\\";
        int        ret1            = mfs100.AutoCapture(ref fingerprintData, timeout, false, false);

        if (ret1 != 0)
        {
            Literal1.Text = mfs100.GetErrorMsg(ret1).ToString();
        }
        else
        {
            string info = "Quality: " + fingerprintData.Quality.ToString() + "     Nfiq: " + fingerprintData.Nfiq.ToString() + "     Bpp: " + fingerprintData.Bpp.ToString() + "     GrayScale:" + fingerprintData.GrayScale.ToString() + "\nW(in):" + fingerprintData.InWidth.ToString() + "     H(in):" + fingerprintData.InHeight.ToString() + "     area(in):" + fingerprintData.InArea.ToString() + "     Dpi/Ppi:" + fingerprintData.Resolution.ToString() + "     Compress Ratio:" + fingerprintData.WSQCompressRatio.ToString();
            //lblStatus.Text = info;
            //b[count++] = fingerprintData.ISOTemplate;

            File.WriteAllBytes(datapath + "//ISOTemplate.iso", fingerprintData.ISOTemplate);
            File.WriteAllBytes(datapath + "//ISOImage.iso", fingerprintData.ISOImage);
            File.WriteAllBytes(datapath + "//AnsiTemplate.ansi", fingerprintData.ANSITemplate);
            File.WriteAllBytes(datapath + "//RawData.raw", fingerprintData.RawData);
            fingerprintData.FingerImage.Save(datapath + "//FingerImage.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
            File.WriteAllBytes(datapath + "//WSQImage.wsq", fingerprintData.WSQImage);
            //ShowMessage("Capture Success.\nFinger data is saved at application path", false);
            Literal1.Text = "<script language='javascript'>window.alert('finger  captured');</script>";
        }

        //////////////////
    }
 private void captureFinger()
 {
     while (!exitThread)
     {
         readyForNext.Reset();
         //Reset Timer
         minTimeCount = 0;
         int ret = mfs100.StartCapture(quality, timeout, false);
         if (ret != 0)
         {
             showMessage(mfs100.GetErrorMsg(ret), true);
         }
         readyForNext.WaitOne();
     }
 }
 //*********************************************  Biometric Section  ********************************************//
 private void initialiseMFS100()
 {
     try
     {
         Control.CheckForIllegalCrossThreadCalls = false;
         mfs100                     = new MFS100();
         mfs100.OnPreview          += onPreview;
         mfs100.OnCaptureCompleted += onCaptureCompleted;
         int ret = mfs100.Init();
         if (ret != 0)
         {
             showMessage(mfs100.GetErrorMsg(ret), true);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(this, ex.Message, "Exception@initialiseMFS100", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        private void btnCapture_Click(object sender, EventArgs e)
        {
            btnCapture.Enabled = false;
            try
            {
                if (previewState == "Finger1")
                {
                    clearBioValues();
                }
                int ret = mfs100.StartCapture(quality, timeout, true);
                if (ret != 0)
                {
                    showMessage(mfs100.GetErrorMsg(ret), true);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Exception@btnCapture_Click", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            btnCapture.Enabled = true;
        }