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 btnCancel_Click(object sender, EventArgs e) { faceRegistration.StopRecognition(); if (camera.Camera != null) { camera.TurnOff(); } UCChooseLogin ucChooseLogin = new UCChooseLogin(mainForm); ucChooseLogin.Dock = DockStyle.Bottom; mainForm.Controls.Remove(this); mainForm.Controls.Add(ucChooseLogin); }
public void StopRecognising() { if (camera.Camera != null) { recognition.StopRecognising(); camera.TurnOff(); } }