private void initFinger()
        {
            if (null == ZKFPEngX1)
            {
                //实例化OCX控件
                ZKFPEngX1 = new AxZKFPEngXControl.AxZKFPEngX();
                //显式调用该实例的CreateControl方法才能调用其它方法,否则在调用时系统将报AxHost.InvalidActiveXStateException异常
                ZKFPEngX1.CreateControl();
                //连接多个指纹采集器时,选择指纹头的序号,从0 开始;小于零时指纹采集器不工作
                ZKFPEngX1.SensorIndex = 0;
                //取得指纹初始特征
                ZKFPEngX1.OnFeatureInfo += new IZKFPEngXEvents_OnFeatureInfoEventHandler(ZKFPEngX1_OnFeatureInfo);
                ZKFPEngX1.OnEnroll      += new IZKFPEngXEvents_OnEnrollEventHandler(ZKFPEngX1_OnEnroll);
                //指纹图片接收
                ZKFPEngX1.OnImageReceived += new IZKFPEngXEvents_OnImageReceivedEventHandler(ZKFPEngX1_OnImageReceived);
                //指纹识别系统算法引擎版本号
                ZKFPEngX1.FPEngineVersion = "9";
                ZKFPEngX1.Threshold       = 5;
            }
            if (!ZKFPEngX1.EngineValid)
            {
                //初始化指纹识别系统
                int result = ZKFPEngX1.InitEngine();

                if (-2 == result)
                {
                    result = ZKFPEngX1.InitEngine();
                }
                //初始化成功
                if (0 == result)
                {
                    //创建指纹识别高速缓冲空间 并返回其句柄
                    CreateFPCacheDBEx();
                }
                else if (1 == result)
                {
                    endFinger();
                    throw new Exception("指纹识别驱动程序加载失败");
                }
                else if (2 == result)
                {
                    endFinger();
                    throw new Exception("没有连接指纹识别仪");
                }
                else
                {
                    endFinger();
                    throw new Exception("指定的指纹仪不存在");
                }
            }
            ZKFPEngX1.FlushFPImages();
        }
Пример #2
0
        private void InitialAxZkfp()
        {
            try
            {
                string status = "Not Connected";
                if (m_zkFprint.InitEngine() == 0)
                {
                    m_zkFprint.FPEngineVersion = "9";

                    status = "Connected ";
                }
                if (this.lblDeviceStatus.InvokeRequired)
                {
                    this.lblDeviceStatus.BeginInvoke((MethodInvoker) delegate() { this.lblDeviceStatus.Text = status; });
                }
                else
                {
                    this.lblDeviceStatus.Text = status;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Device init err, error: " + ex.Message);
            }
        }
Пример #3
0
        public static int InitControl()
        {
            if (Control == null)
            {
                return(1);
            }

            Control.FPEngineVersion = "9";
            Control.SensorIndex     = 0;

            try
            {
                Control.EndEngine();
            }
            catch { }

            int initResult = Control.InitEngine();

            if (initResult == 0)
            {
                FpcHandle = Control.CreateFPCacheDB();

                SensorCount = Control.SensorCount;
                SensorIndex = Control.SensorIndex;
                ImageWidth  = Control.ImageWidth;
                ImageHeight = Control.ImageHeight;
                SensorSN    = Control.SensorSN;

                MatchType   = 2;
                IsConnected = true;
            }

            return(initResult);
        }
Пример #4
0
        //FUNCION PARA INICIALIZAR EL DISPOSITIVO
        private void iniciarDispositivo()
        {
            try
            {
                Controls.Add(lectorHuellas);
                imgHuellaCapturada.Image = null;

                lectorHuellas.OnImageReceived += lectorHuellas_OnImageReceived;
                lectorHuellas.OnFeatureInfo   += lectorHuellas_OnFeatureInfo;
                lectorHuellas.OnEnroll        += lectorHuellas_OnEnroll;

                //int iver = lectorHuellas.InitEngine();

                if (lectorHuellas.InitEngine() == 0)
                {
                    lectorHuellas.FPEngineVersion = "9";
                    lectorHuellas.EnrollCount     = 3;
                    mostrarNotificacion("Se ha iniciado las funciones del lector de huellas dactilares.");
                }
            }

            catch (Exception ex)
            {
                catchMensaje = new VentanasMensajes.frmMensajeNuevoCatch();
                catchMensaje.lblMensaje.Text = ex.Message;
                catchMensaje.ShowDialog();
            }
        }
Пример #5
0
        private void btnConectar_Click(object sender, EventArgs e)
        {
            botonPresionado("btnConectar");

            fp.SensorIndex = 0;

            if (rdbV9.Checked == true)
            {
                fp.FPEngineVersion = "9";
            }
            else
            {
                fp.FPEngineVersion = "10";
            }

            if (fp.InitEngine() == 0)
            {
                foreach (var ctr in this.Controls)
                {
                    if (ctr is Button)
                    {
                        ((Button)ctr).Enabled = true;
                    }
                }

                btnConectar.Enabled = false;

                fpcHandle = fp.CreateFPCacheDB();

                fp.OnImageReceived += fp_OnImageReceived;
                fp.OnCapture       += fp_OnCapture;
            }
        }
Пример #6
0
 /// <summary>
 /// 初始化指纹设备 关闭程序时需要停止指纹设备
 /// </summary>
 /// <param name="fingerPrinter">指纹设备(如:AxZKFPEngX1)</param>
 public static void InitFingerPrintDevice(AxZKFPEngX fingerPrinter)//初始化指纹设备
 {
     try
     {
         MessageBox.Show(fingerPrinter.InitEngine() == 0 ? "初始化成功" : "初始化失败");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         throw;
     }
 }
Пример #7
0
        /*private void zkFprint_OnCapture(object sender, IZKFPEngXEvents_OnCaptureEvent e)
         * {
         *  template = ZkFprint.EncodeTemplate1(e.aTemplate);
         *  List<User> temp = queryFingerTemplete();
         *  bool isMatch = false;
         *  bool duplicate = false;
         *  string secret = "";
         *
         *  for (int i = 0; i < temp.Count; i++)
         *  {
         *      if (ZkFprint.VerFingerFromStr(ref template, temp[i].finger, false, ref Check))
         *      {
         *          isMatch = true;
         *
         *          ZkFprint.CancelCapture();
         *          if (temp[i].voted == false.ToString())
         *          {
         *              secret = temp[i].secret;
         *          }
         *          else
         *          {
         *              duplicate = true;
         *          }
         *      }
         *  }
         *
         *  if (!isMatch)
         *  {
         *      ZkFprint.CancelCapture();
         *      writeResult("verify","fail");
         *      Application.Exit();
         *  }
         *  else if (duplicate == true)
         *  {
         *      ZkFprint.CancelCapture();
         *      writeResult("verify", "voted");
         *      Application.Exit();
         *  }
         *  else if (isMatch && !duplicate)
         *  {
         *      ZkFprint.CancelCapture();
         *      writeResult("verify", secret);
         *      Application.Exit();
         *  }
         * }*/

        private void InitialAxZkfp()
        {
            try
            {
                ZkFprint.OnImageReceived += zkFprint_OnImageReceived;
                ZkFprint.OnFeatureInfo   += zkFprint_OnFeatureInfo;
                ZkFprint.OnEnroll        += zkFprint_OnEnroll;
                if (ZkFprint.InitEngine() == 0)
                {
                    ZkFprint.FPEngineVersion = "10";
                    ZkFprint.EnrollCount     = 3;
                }
                else
                {
                    ZkFprint.EndEngine();
                }
            }
            catch (Exception e)
            {
                //device_status.Text = "device init error: " + e.Message;
            }
        }
Пример #8
0
        public bool Connect(Dictionary <Guid, Tuple <TipoHuella, string> > huellaTable)
        {
            if (!connected)
            {
                FPTable = new Dictionary <int, string>();

#if (!DEBUG || !DESACTIVAHUELLERO)
                int ret = ZKFPEng.InitEngine();
                if (ret != 0)
                {
                    ZKFPEng.EndEngine();
                    return(false);
                }
                FPCache = ZKFPEng.CreateFPCacheDB();
#endif

                foreach (var huella in huellaTable.Values)
                {
                    int FPID = (int)huella.Item1 + 1;
                    if (FPTable.ContainsKey(FPID))
                    {
                        continue;
                    }
#if (DEBUG && DESACTIVAHUELLERO)
                    FPTable[FPID] = huella.Item2;
#else
                    if (ZKFPEng.AddRegTemplateStrToFPCacheDB(FPCache, FPID, huella.Item2) != 1)
                    {
                        Clean();
                        return(false);
                    }
                    else
                    {
                        FPTable[FPID] = huella.Item2;
                    }
#endif
                }
#if (!DEBUG || !DESACTIVAHUELLERO)
                ZKFPEng.OnEnroll         += ZKFPEng_OnEnroll;
                ZKFPEng.OnFeatureInfo    += ZKFPEng_OnFeatureInfo;
                ZKFPEng.OnCapture        += ZKFPEng_OnCapture;
                ZKFPEng.OnFingerLeaving  += ZKFPEng_OnFingerLeaving;
                ZKFPEng.OnFingerTouching += ZKFPEng_OnFingerTouching;
#endif

                connected = true;
            }
            return(true);
        }
Пример #9
0
        private void frmPantallaRegistroEmpleadosEmpresas_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (Program.iUsarLectorHuellas == 1)
            {
                Controls.Add(lectorHuellas);

                if (lectorHuellas.InitEngine() == 0)
                {
                    lectorHuellas.FPEngineVersion = "9";
                    lectorHuellas.EnrollCount     = 3;
                }

                lectorHuellas.CancelEnroll();
                lectorHuellas.EndEngine();
            }
        }
Пример #10
0
        private void Inicial_Lector_ZK()
        {
            try
            {
                if (zk_dispositivo.InitEngine() == 0)
                {
                    zk_dispositivo.FPEngineVersion = "9";
                    zk_dispositivo.EnrollCount     = 3;
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #11
0
 private void InitialAxZkfp()
 {
     try
     {
         if (ZkFprint.InitEngine() == 0)
         {
             ZkFprint.FPEngineVersion = "9";
             ZkFprint.EnrollCount     = 3;
             deviceSerial.Text       += " " + ZkFprint.SensorSN + " Count: " + ZkFprint.SensorCount.ToString() + " Index: " + ZkFprint.SensorIndex.ToString();
             ShowHintInfo("Device successfully connected");
         }
     }
     catch (Exception ex)
     {
         ShowHintInfo("Device init err, error: " + ex.Message);
     }
 }
        private void AddEditStudentFrm_Load(object sender, EventArgs e)
        {
            // Init Database
            _db = ((MainFrm)Parent)._db;

            // Init FP engine
            _fpEngine = new AxZKFPEngX();
            _fpEngine.BeginInit();
            _fpEngine.OnEnroll += new IZKFPEngXEvents_OnEnrollEventHandler(_fpEngine_OnEnroll);
            _fpEngine.OnImageReceived += new IZKFPEngXEvents_OnImageReceivedEventHandler(_fpEngine_OnImageReceived);
            this.Controls.Add(_fpEngine);

            if (_fpEngine.InitEngine() != 0)
            {
                MessageBox.Show("ไม่สามารถติดต่อเครื่องสแกนลายนิ้วมือได้", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                _fpDeviceConnect = false;
            }
            else
            {
                _fpDeviceConnect = true;
            }

            // For Edit mode
            if (EditMode == true)
            {
                _db.SQLCommand = "SELECT * FROM student WHERE std_id='" + StudentID + "'";
                _db.Query();
                if (_db.Result.HasRows)
                {
                    _db.Result.Read();
                    txtStdID.Text = (string)_db.Result.GetValue(0);
                    txtStdName.Text = (string)_db.Result.GetValue(1);
                    txtStdMajor.Text = (string)_db.Result.GetValue(2);
                    if (_db.Result.GetValue(3) == null)
                    {
                        txtFinger.Text = "";
                    }
                    else
                    {
                        txtFinger.Text = (string)_db.Result.GetValue(3);
                    }
                }
            }
        }
Пример #13
0
        //FUNCION PARA INICIALIZAR EL DISPOSITIVO
        private void iniciarDispositivoReconocer()
        {
            try
            {
                Controls.Add(lectorHuellas);

                if (lectorHuellas.InitEngine() == 0)
                {
                    lectorHuellas.FPEngineVersion = "9";
                    lectorHuellas.EnrollCount     = 3;
                    lblMensajeRespuesta.Text      = "Dispositivo: " + lectorHuellas.SensorSN;
                }
            }

            catch (Exception ex)
            {
                catchMensaje = new VentanasMensajes.frmMensajeNuevoCatch();
                catchMensaje.lblMensaje.Text = ex.Message;
                catchMensaje.ShowDialog();
            }
        }
Пример #14
0
        private void Inicial_Lector_ZK()
        {
            try
            {
                zk_dispositivo.OnImageReceived -= zkFprint_OnImageReceived;
                zk_dispositivo.OnFeatureInfo   -= zkFprint_OnFeatureInfo;
                zk_dispositivo.OnEnroll        -= zkFprint_OnEnroll;

                if (zk_dispositivo.InitEngine() == 0)
                {
                    zk_dispositivo.FPEngineVersion = "9";
                    zk_dispositivo.EnrollCount     = 3;
                    deviceSerial.Text += " " + zk_dispositivo.SensorSN + " Count: " + zk_dispositivo.SensorCount.ToString() + " Index: " + zk_dispositivo.SensorIndex.ToString();
                    mostrarNotificacion("Dispositivo conectado éxitosamente.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #15
0
        private void InitialAxZkfp()
        {
            try
            {
                ZkFprint.OnImageReceived += zkFprint_OnImageReceived;
                ZkFprint.OnFeatureInfo   += zkFprint_OnFeatureInfo;
                //zkFprint.OnFingerTouching
                //zkFprint.OnFingerLeaving
                ZkFprint.OnEnroll += zkFprint_OnEnroll;

                if (ZkFprint.InitEngine() == 0)
                {
                    ZkFprint.FPEngineVersion = "9";
                    ZkFprint.EnrollCount     = 3;
                    deviceSerial.Text       += " " + ZkFprint.SensorSN + " Count: " + ZkFprint.SensorCount.ToString() + " Index: " + ZkFprint.SensorIndex.ToString();
                    ShowHintInfo("Device successfully connected");
                }
            }
            catch (Exception ex)
            {
                ShowHintInfo("Device init err, error: " + ex.Message);
            }
        }
Пример #16
0
        private void InitialAxZkfp()
        {
            try
            {
                ZkFprint.OnImageReceived += zkFprint_OnImageReceived;
                ZkFprint.OnFeatureInfo   += zkFprint_OnFeatureInfo;
                //zkFprint.OnFingerTouching
                //zkFprint.OnFingerLeaving
                ZkFprint.OnEnroll += zkFprint_OnEnroll;

                if (ZkFprint.InitEngine() == 0)
                {
                    ZkFprint.FPEngineVersion = "9";
                    ZkFprint.EnrollCount     = 3;
                    deviceSerial.Text       += " " + ZkFprint.SensorSN + " Count: " + ZkFprint.SensorCount.ToString() + " Index: " + ZkFprint.SensorIndex.ToString();
                    ShowHintInfo("SENSOR BIOMETRICO CONECTADO EXITOSAMENTE.");
                }
            }
            catch (Exception ex)
            {
                ShowHintInfo("ERROR EN LA CONEXIÓN CON EL SENSOR: " + ex.Message);
            }
        }
        private void ScanFingerStdFrm_Load(object sender, EventArgs e)
        {
            // Init Database
            _db = ((TeachingViewFrm)Parent)._db;

            // Init FP engine
            _fpEngine = new AxZKFPEngX();
            _fpEngine.BeginInit();
            _fpEngine.OnEnroll += new IZKFPEngXEvents_OnEnrollEventHandler(_fpEngine_OnEnroll);
            _fpEngine.OnImageReceived += new IZKFPEngXEvents_OnImageReceivedEventHandler(_fpEngine_OnImageReceived);
            this.Controls.Add(_fpEngine);

            if (_fpEngine.InitEngine() != 0)
            {
                MessageBox.Show("ไม่สามารถติดต่อเครื่องสแกนลายนิ้วมือได้", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                if (AutoScanMode == false)
                {
                    this.Close();
                }
                else
                {
                    _fpEngine.EndInit();
                    _fpEngine.EndEngine();
                    StopAutoScan = true;
                    btnCancel.Enabled = false;
                }
            }

            _fpEngine.BeginEnroll();
            txtFPStatus.Text = "วางนิ้ว 3 ครั้ง";
            txtFPNo.Text = _cntFPEnroll.ToString();

            _timer.Enabled = false;
            _timer.Interval = 3000;
            _timer.Tick += new EventHandler(_timer_Tick);

            txtStdID.Text = StdID;
            txtStdName.Text = StdName;

            if (AutoScanMode == false)
            {
                btnStop.Visible = false;
                btnCancel.Visible = false;
            }
        }