Exemple #1
0
        private async void loginbtn_Click(object sender, EventArgs e)
        {
            statusLbl.ForeColor = Color.Blue;
            statusLbl.Text      = "Processing....";
            try
            {
                var reconizedUsers = await FaceService.RecognizeAsync(GetImage(bitmap));

                if (reconizedUsers.Count > 0)
                {
                    isAuthorized        = true;
                    statusLbl.ForeColor = Color.Green;
                    statusLbl.Text      = "AUTHORIZED - " + reconizedUsers[0].Name;
                }
                else
                {
                    isAuthorized        = false;
                    statusLbl.ForeColor = Color.Red;
                    statusLbl.Text      = "UNAUTHORIZED.";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Something went wrong.", "Error");
            }
        }
Exemple #2
0
        private async void registerBtn_Click(object sender, EventArgs e)
        {
            statusLbl.ForeColor = Color.Blue;
            statusLbl.Text      = "Processing....";
            try
            {
                await FaceService.CreatePersonAsync(nameTxt.Text, string.Empty, GetImage(bitmap));

                statusLbl.ForeColor = Color.Green;
                statusLbl.Text      = "Registered";
                MessageBox.Show("Registration Successful.", "Success");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Something went wrong.", "Error");
            }
        }