Exemplo n.º 1
0
 private void LoginForm_Load(object sender, EventArgs e)
 {
     try
     {
         DataTable dt    = null;
         string    error = "";
         ConnectInfo.LoadUser(out dt, out error);
         if (this.aiFace == null)
         {
             this.aiFace       = new AIFace(this.vpFace);
             this.aiFace.Faces = this.LoadFaces(dt);
             ErrorCode rslt = this.aiFace.Initialize();
             if (rslt != ErrorCode.Ok)
             {
                 this.aiFace.Stop();
                 return;
             }
         }
         this.aiFace.Start();
     }
     catch (Exception ex)
     {
         LogHelper.Error(ex);
         if (this.aiFace != null)
         {
             this.aiFace.Stop();
             this.aiFace = null;
         }
     }
 }
Exemplo n.º 2
0
        private void btnRegist_Click(object sender, EventArgs e)
        {
            string error = "";

            byte[] face       = null;
            byte[] faceresult = null;
            if (this.pbFace.Tag != null)
            {
                face       = BytesHelper.ImageToByte(this.pbFace.Image);
                faceresult = this.pbFace.Tag as byte[];
            }
            bool rslt = ConnectInfo.Regist(
                this.txtUser.Text,
                this.txtPassword.Text,
                this.txtPhone.Text,
                this.txtEmail.Text,
                this.txtAge.Text,
                this.cmbGender.Text,
                face,
                faceresult,
                out error);

            if (rslt)
            {
                DataTable dt = null;
                error = "";
                ConnectInfo.LoadUser(out dt, out error);
                if (dt != null)
                {
                    this.dgvUser.DataSource = dt;
                }
                this.aiFace.Faces = this.LoadFaces(dt);
            }
            else
            {
                MessageBox.Show(error);
                return;
            }
            this.pbFace.Image     = null;
            this.pbFace.Tag       = null;
            this.txtUser.Text     = "";
            this.txtPassword.Text = "";
            this.txtPhone.Text    = "";
            this.txtEmail.Text    = "";
            this.txtAge.Text      = "";
            this.cmbGender.Text   = "";
            this.GoHomePage();
        }
Exemplo n.º 3
0
 private void RegistForm_Load(object sender, EventArgs e)
 {
     try
     {
         DataTable dt    = null;
         string    error = "";
         ConnectInfo.LoadUser(out dt, out error);
         if (dt != null)
         {
             this.dgvUser.DataSource = dt;
         }
     }
     catch (Exception ex)
     {
         LogHelper.Error(ex);
         if (this.aiFace != null)
         {
             this.aiFace.Stop();
             this.aiFace = null;
         }
     }
 }