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);
                }
            }
        }
        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);
            }
        }
        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);
            }
        }