コード例 #1
0
        //Enroll
        public void CadastrarDigital()
        {
            NBioAPI.Type.FIR  biFIR  = null;
            NBioAPI.Type.HFIR newFIR = null;
            Inicializar();
            uint ret = nBioApi.Enroll(out newFIR, null);

            if (ret == NBioAPI.Error.NONE)
            {
                nBioApi.GetFIRFromHandle(newFIR, out biFIR);
            }
            Finalizar();
        }
コード例 #2
0
        private void btnCadastrar_Click(object sender, EventArgs e)
        {
            userC = new UserController();
            user  = new User();

            if (txtUsuario.Text == "")
            {
                MessageBox.Show("Favor, preencher o campo de usuário", "Projeto Biometria", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtUsuario.Focus();
            }
            else if (txtNome.Text == "")
            {
                MessageBox.Show("Favor, preencher o campo de nome", "Projeto Biometria", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtNome.Focus();
            }
            else if (txtEmail.Text == "")
            {
                MessageBox.Show("Favor, preencher o campo de email", "Projeto Biometria", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtEmail.Focus();
            }
            else if (txtSenha.Text == "")
            {
                MessageBox.Show("Favor, preencher o campo de senha", "Projeto Biometria", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtSenha.Focus();
            }
            else
            {
                NBioAPI.Type.FIR heFIR = new NBioAPI.Type.FIR();

                m_NBioAPI = new NBioAPI();
                NBioAPI.Type.HFIR NewFIR;

                uint reta = m_NBioAPI.OpenDevice(NBioAPI.Type.DEVICE_ID.AUTO);

                // m_NBioAPI.Enroll(out NewFIR,  null);
                uint ret = m_NBioAPI.Capture(NBioAPI.Type.FIR_PURPOSE.VERIFY, out NewFIR, NBioAPI.Type.TIMEOUT.DEFAULT, null, null);
                if (ret == NBioAPI.Error.NONE)
                {
                    if (NewFIR != null)
                    {
                        m_NBioAPI.GetFIRFromHandle(NewFIR, out m_biFIR);

                        user.NomeCompleto = txtNome.Text;
                        user.Usuario      = txtUsuario.Text;
                        user.Senha        = txtSenha.Text;
                        user.Email        = txtEmail.Text;
                        user.NivelAcesso  = 3;
                        user.Digital      = m_biFIR.Data;
                        user.Imagem       = m_biFIR.Data;
                        user.Format       = Convert.ToInt32(m_biFIR.Format.ToString());
                        user.DataLength   = Convert.ToInt32(m_biFIR.Header.DataLength.ToString());
                        user.DataType     = Convert.ToInt32(m_biFIR.Header.DataType.ToString());
                        user.Purpose      = Convert.ToInt32(m_biFIR.Header.Purpose.ToString());
                        user.Length       = Convert.ToInt32(m_biFIR.Header.Length.ToString());
                        user.Quality      = Convert.ToInt32(m_biFIR.Header.Quality.ToString());
                        user.Reserved     = Convert.ToInt32(m_biFIR.Header.Reserved.ToString());
                        user.Version      = Convert.ToInt32(m_biFIR.Header.Version.ToString());

                        userC.insertUser(user);

                        MessageBox.Show("Usuário Administrador cadastrado com sucesso!", "Projeto Biometria", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        frmLogin login = new frmLogin();
                        this.Hide();
                        this.ShowIcon      = false;
                        this.ShowInTaskbar = false;
                        login.ShowDialog();
                        Application.Exit();
                    }
                }
                else
                {
                    MessageBox.Show("Erro ao cadastrar digital, tente novamente!", "Projeto Biometria", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                m_NBioAPI.CloseDevice(NBioAPI.Type.DEVICE_ID.AUTO);
            }
        }
コード例 #3
0
        public void Capture(short Dispositivo, PictureBox Pct, Label labelImgQuality, Label LblFinalizacaoSelecionado, TipoDedo Dedo, TipoMao Mao, out NBioAPI.Type.FIR MyFir, out NBioAPI.Type.FIR_TEXTENCODE textFIR, bool Infinito)
        {
            LabelQualidadeSelecionado   = labelImgQuality;
            LabelFinalizacaoSelecionado = LblFinalizacaoSelecionado;

            m_WinOption.WindowStyle            = NBioAPI.Type.WINDOW_STYLE.INVISIBLE;
            m_WinOption.Option2.FPForeColor[0] = Convert.ToByte("00", 16);
            m_WinOption.Option2.FPForeColor[1] = Convert.ToByte("00", 16);
            m_WinOption.Option2.FPForeColor[2] = Convert.ToByte("00", 16);
            m_WinOption.Option2.FPBackColor[0] = Convert.ToByte("FF", 16);
            m_WinOption.Option2.FPBackColor[1] = Convert.ToByte("FF", 16);
            m_WinOption.Option2.FPBackColor[2] = Convert.ToByte("FF", 16);


            m_WinOption.FingerWnd = (uint)Pct.Handle.ToInt32();


            // Callback funtion
            m_WinOption.CaptureCallBackInfo = new NBioAPI.Type.CALLBACK_INFO_0();
            m_WinOption.CaptureCallBackInfo.CallBackFunction = new NBioAPI.Type.WINDOW_CALLBACK_0(MyCaptureCallback);
            m_WinOption.FinishCallBackInfo = new NBioAPI.Type.CALLBACK_INFO_1();
            m_WinOption.FinishCallBackInfo.CallBackFunction = new NBioAPI.Type.WINDOW_CALLBACK_1(MyFinishCallback);


            // Select finger for enrollment
            if (Mao == Biometria.TipoMao.Direita)
            {
                m_WinOption.Option2.DisableFingerForEnroll[0] = (byte)NBioAPI.Type.TRUE;
                m_WinOption.Option2.DisableFingerForEnroll[1] = (byte)NBioAPI.Type.TRUE;
                m_WinOption.Option2.DisableFingerForEnroll[2] = (byte)NBioAPI.Type.TRUE;
                m_WinOption.Option2.DisableFingerForEnroll[3] = (byte)NBioAPI.Type.TRUE;
                m_WinOption.Option2.DisableFingerForEnroll[4] = (byte)NBioAPI.Type.TRUE;
                m_WinOption.Option2.DisableFingerForEnroll[5] = (byte)NBioAPI.Type.TRUE;
                m_WinOption.Option2.DisableFingerForEnroll[6] = (byte)NBioAPI.Type.TRUE;
                m_WinOption.Option2.DisableFingerForEnroll[7] = (byte)NBioAPI.Type.TRUE;
                m_WinOption.Option2.DisableFingerForEnroll[8] = (byte)NBioAPI.Type.TRUE;
                m_WinOption.Option2.DisableFingerForEnroll[9] = (byte)NBioAPI.Type.TRUE;

                switch (Dedo)
                {
                case Biometria.TipoDedo.Anelar:
                {
                    m_WinOption.Option2.DisableFingerForEnroll[3] = NBioAPI.Type.FALSE;
                    break;
                }

                case Biometria.TipoDedo.Indicador:
                {
                    m_WinOption.Option2.DisableFingerForEnroll[1] = NBioAPI.Type.FALSE;
                    break;
                }

                case Biometria.TipoDedo.Médio:
                {
                    m_WinOption.Option2.DisableFingerForEnroll[2] = (byte)NBioAPI.Type.FALSE;
                    break;
                }

                case Biometria.TipoDedo.Mínimo:
                {
                    m_WinOption.Option2.DisableFingerForEnroll[4] = NBioAPI.Type.FALSE;
                    break;
                }

                case Biometria.TipoDedo.Polegar:
                {
                    m_WinOption.Option2.DisableFingerForEnroll[0] = NBioAPI.Type.FALSE;
                    break;
                }
                }
            }
            else
            {
                switch (Dedo)
                {
                case Biometria.TipoDedo.Anelar:
                {
                    m_WinOption.Option2.DisableFingerForEnroll[8] = NBioAPI.Type.FALSE;
                    break;
                }

                case Biometria.TipoDedo.Indicador:
                {
                    m_WinOption.Option2.DisableFingerForEnroll[6] = NBioAPI.Type.FALSE;
                    break;
                }

                case Biometria.TipoDedo.Médio:
                {
                    m_WinOption.Option2.DisableFingerForEnroll[7] = (byte)NBioAPI.Type.FALSE;
                    break;
                }

                case Biometria.TipoDedo.Mínimo:
                {
                    m_WinOption.Option2.DisableFingerForEnroll[9] = NBioAPI.Type.FALSE;
                    break;
                }

                case Biometria.TipoDedo.Polegar:
                {
                    m_WinOption.Option2.DisableFingerForEnroll[5] = NBioAPI.Type.FALSE;
                    break;
                }
                }
            }

            NBioAPI.Type.HFIR hCapturedFIR;
            m_NBioAPI.OpenDevice(NBioAPI.Type.DEVICE_ID.AUTO);
            if (Infinito)
            {
                m_NBioAPI.Capture(out hCapturedFIR, NBioAPI.Type.TIMEOUT.INFINITE, m_WinOption);
            }
            else
            {
                m_NBioAPI.Capture(out hCapturedFIR, NBioAPI.Type.TIMEOUT.DEFAULT, m_WinOption);
            }
            try
            {
                m_NBioAPI.GetFIRFromHandle(hCapturedFIR, out MyFir);
                m_NBioAPI.GetTextFIRFromHandle(hCapturedFIR, out textFIR, true);
                m_NBioAPI.CloseDevice(Dispositivo);
            }
            catch (Exception ex)
            {
                textFIR = null;
                MyFir   = null;
            }
        }