Exemplo n.º 1
0
        private void FaceRecognition_OnFoundRegisteredFace(object sender, Camera.RecognisedPersonEventArgs e) //Suveikia, kai atpažįsta žmogų iš foto
        {
            faceRecognition.StopRecognition();
            camera.TurnOff();

            int recognisedID;

            Int32.TryParse(e.recognisedID, out recognisedID);
            Person loggedInPerson = ServiceToLibrary.PersonToLibraryObject(mainForm.humanDBHelperByPersonService.GetPersonByID(recognisedID));

            if (loggedInPerson != null)
            {
                DialogResult dr = MetroMessageBox.Show(this, "Sėkmingai atpažintas naudotojas " + loggedInPerson.Name + " " + loggedInPerson.Surname + "\nAr tai jūs?", "Prisijungimas", MessageBoxButtons.YesNo);
                if (dr == DialogResult.Yes)
                {
                    UCMainUserMeniu ucMainUserMeniu = new UCMainUserMeniu(mainForm, loggedInPerson);
                    ucMainUserMeniu.Dock = DockStyle.Bottom;
                    mainForm.Controls.Remove(this);
                    mainForm.Controls.Add(ucMainUserMeniu);
                }
                else
                {
                    camera.TurnOn();
                    faceRecognition.ContinueRecognition(cameraBox, camera.Camera);
                }
            }
        }
Exemplo n.º 2
0
        public UCScanBook(MainForm mainForm, UCMainUserMeniu ucMainUserMeniu)
        {
            camera = new UseCamera();

            InitializeComponent();
            this.mainForm        = mainForm;
            this.ucMainUserMeniu = ucMainUserMeniu;

            recognition = new BarcodeRecognition(cameraBox, camera);
            recognition.OnBarcodeRecognised += Recognition_OnBarcodeRecognised;
        }
Exemplo n.º 3
0
        private void btnRegister_Click(object sender, EventArgs e)
        {
            ErrorMessageBoxPrinter <string> errorPrinter = delegate(string topText, string message)
            {
                MetroMessageBox.Show(this, topText, message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            };

            // if(String.IsNullOrEmpty(txtVardas.Text) && String.IsNullOrEmpty(txtPavarde.Text) && String.IsNullOrEmpty(txtSlaptazodis.Text) && String.IsNullOrEmpty(txtTelefonoNr.Text) && String.IsNullOrEmpty(txtEmail.Text))
            // {
            System.Text.RegularExpressions.Regex pattern = new System.Text.RegularExpressions.Regex(@"^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$"); //@, nes reikia kad būtų \. //Reikia System.Text.RegularExpressions. nes kitaip konfliktina su Emgu.cv

            if (!pattern.IsMatch(txtEmail.Text))                                                                                                          //Jei neteisingas emailas
            {
                errorPrinter("Neteisingai įvestas elektroninis paštas", "Klaida");
                txtEmail.Clear();
                txtEmail.Focus();
            }
            else if (prbTakingPictures.Value != imageCountPerPerson)
            {
                MetroMessageBox.Show(this, "Norint užsiregistruoti dar reikia nusifotografuoti", "Registracija", MessageBoxButtons.OK);
            }
            else
            {
                faceRegistration.StopRecognition();
                if (camera.Camera != null)
                {
                    camera.TurnOff();
                }

                int newID = mainForm.humanDBHelperByPersonService.getNextId();

                List <Image> userImages = faceRegistration.getFaceImages();
                FileIO.WriteID(PathsToFiles.pathToFacesFile, newID, imageCountPerPerson);
                FileIO.WritePhotos(PathsToFiles.pathToFacesFolder, userImages, newID);

                Person newPerson = new Person(newID, txtName.Text, txtSurname.Text, txtPassword.Text, dtpBirthDate.Value, txtPhoneNumber.Text, email: txtEmail.Text);

                if (mainForm.humanDBHelperByPersonService.AddNewPerson(newID, txtName.Text, txtSurname.Text, txtPassword.Text, dtpBirthDate.Value, txtPhoneNumber.Text, email: txtEmail.Text) == true)
                {
                    UCMainUserMeniu ucMainUserMeniu = new UCMainUserMeniu(mainForm, newPerson);
                    ucMainUserMeniu.Dock = DockStyle.Bottom;
                    mainForm.Controls.Remove(this);
                    mainForm.Controls.Add(ucMainUserMeniu);
                }
                else
                {
                    errorPrinter("Klaida sukuriant naują vartotoją. Prašome kreiptis į sistemos administratorių.", "Klaida");
                }
            }
            // }
        }
Exemplo n.º 4
0
        private void btnLogInWIthName_Click(object sender, EventArgs e)
        {
            Person loggedInPerson = ServiceToLibrary.PersonToLibraryObject(mainForm.humanDBHelperByPersonService.GetPersonByNameSurnamePassword(txtVardas.Text, txtPavarde.Text, txtSlaptazodis.Text));

            camera.TurnOff();
            faceRecognition.StopRecognition();

            if (loggedInPerson != null)
            {
                UCMainUserMeniu ucMainUserMeniu = new UCMainUserMeniu(mainForm, loggedInPerson);
                ucMainUserMeniu.Dock = DockStyle.Bottom;
                mainForm.Controls.Remove(this);
                mainForm.Controls.Add(ucMainUserMeniu);
            }
            else
            {
                MetroMessageBox.Show(this, "Neteisingai įvesti prisijungimo duomenys", "Prisijungimo klaida", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 5
0
        private void btnLogIn_Click(object sender, EventArgs e)
        {
            //REIKIA ATSTATYTI - PRALEIDZIAM PRISIJUNGIMA

            /*
             * UCLogin ucLogin = new UCLogin(mainForm);
             * ucLogin.Dock = DockStyle.Bottom;
             * mainForm.Controls.Remove(this);
             * mainForm.Controls.Add(ucLogin);
             */

            //Sita iki galo istrinti
            LibraryObjects.Person loggedInPerson = ServiceToLibrary.PersonToLibraryObject(mainForm.humanDBHelperByPersonService.GetPersonByID(1));

            if (loggedInPerson != null)
            {
                UCMainUserMeniu ucMainUserMeniu = new UCMainUserMeniu(mainForm, loggedInPerson);
                ucMainUserMeniu.Dock = DockStyle.Bottom;
                mainForm.Controls.Remove(this);
                mainForm.Controls.Add(ucMainUserMeniu);
            }
        }