private void btn_resetData_Click(object sender, EventArgs e) { //DialogResult msg = MessageBox.Show("Are you sure you want to Delete All Records....", // "Reset Database Records...", // MessageBoxButtons.OKCancel, // MessageBoxIcon.Warning); AlertForm1 al = new AlertForm1("Are you sure you want to Delete All Records....", AlertForm1.AlertOptions.YESNO, AlertForm1.AlertType.success, "Reset Database Records..."); var aa = al.ShowDialog(); if (al.rDialogResult) //if (msg == DialogResult.OK) { try { //StopCapturing(); _afis = new LocalAFIS(); System.IO.Directory.Delete(_afis.StoragePath, true); //Added to mimick same behavior in database table Utils.truncate_tables(); //UpdateUserList(); //ResetGUI(); DisplayError("Reset Completed............"); } catch (Exception ex) { DisplayError(ex.Message); } } }
private void resetApplicationToolStripMenuItem_Click(object sender, EventArgs e) { try { //StopCapturing(); _afis = new LocalAFIS(); System.IO.Directory.Delete(_afis.StoragePath, true); //Added to mimick same behavior in database table Utils.truncate_tables(); //UpdateUserList(); //ResetGUI(); } catch (Exception ex) { DisplayError(ex.Message); } }
private void IdentityForm1_FormClosing(object sender, FormClosingEventArgs e) { _afis = null; this.Dispose(true); }
private void NewMethod() { AFISVerificationResult result = new AFISVerificationResult(); LocalUser user_found = new LocalUser(); _afis = new LocalAFIS(); Dictionary <long, LocalUser> userList = _afis.GetUserList(); int threshold = Properties.Settings.Default.VerificationThreshold; //xamlListBoxUsers.Items.Clear(); bool found = false;; double matchValue = 0; List <Fingerprint> fg = new List <Fingerprint>(); using (tranxDataContext tx = new tranxDataContext()) { tx.Connection.ConnectionString = Utils.getConnection(); var fng = tx.fingerprint_Table_verifies.Select(s => s); lst_feedback.Items.Clear(); //foreach (fingerprint_Table_verify templateFile in fng) Parallel.ForEach(fng, templateFile => { lst_feedback.Items.Insert(0, templateFile.refNO); byte[] data = Utils.convert_string2byteArray(templateFile.finger_data); //String templateFileString = Path.GetFileNameWithoutExtension(templateFile); String fingerPos = templateFile.position; Fingerprint fingerprint = new Fingerprint(); fingerprint.Template = new Template(); fingerprint.Template.SetData(data, Dermalog.Afis.FingerCode3.Enums.TemplateFormat.Dermalog); fingerprint.Position = UInt32.Parse(fingerPos); fg.Add(fingerprint); StringBuilder str = new StringBuilder(); Parallel.ForEach(userList, (user, loopState) => //Parallel.ForEach(userList, options, (user, loopState) => { foreach (Fingerprint fd in user.Value.Fingerprints) { //str.Clear(); //xamlListBoxUsers.Items.Add(user); double dScore = new Matcher().Match(fingerprint.Template, fd.Template); //double dScore = new Matcher().Match(userFingerprints[i].Template, fingerprints[j].Template); if (dScore > threshold) { //dMaxScore = dScore; result.Score = dScore;; result.Hit = true; //return result; templateFile.identifiedAS = user.Value.Name; //tx.SubmitChanges(); //str.Append(user.Value.Name); loopState.Stop(); } } //result = _afis.IdentifyUser_New(user.Key, fg, Properties.Settings.Default.VerificationThreshold); //result = _afis.IdentifyUser(user.Key, fingerprints_all, Properties.Settings.Default.VerificationThreshold); //if (result.Hit) { //templateFile.identifiedAS = str.ToString(); //found = true; //matchValue = result.Score; //loopState.Stop(); } }); }); tx.SubmitChanges(); } //return ""; }
private void btn_enroll_Click(object sender, EventArgs e) { bool runNextPhase = false; // Task.Factory.StartNew(() => Thread.Sleep(1000); try { //_streaming = false; //_capture = new Capture(); { //Task.Run(() => //{ if (_fpScanner == null) { // OpenSelectFGDialog(); // runNextPhase = true; throw new Exception("Device not connected.."); } //}).Wait(); else { //CloseScanner(); //connect_Device(); //_fpScanner = FingerPrintScanner; //Task.Run(() => //{ if (!EnterUsernameForm_hidden) { //EnrollmentWindow_new enrollmentWindow = new EnrollmentWindow_new(_fpScanner, _afis); //EnrollmentWindow_new enrollmentWindow = new EnrollmentWindow_new(_fpScanner, _afis, enterUsernameWindow = new EnterUsernameWindow_new(true, this); //enterUsernameWindow.Owner = this; enterUsernameWindow.Activate(); var dg = enterUsernameWindow.ShowDialog(); } else { enterUsernameWindow.Activate(); enterUsernameWindow.reloadForm(); var ddg = enrollmentWindow.ShowDialog(); } // var dg = enterUsernameWindow.ShowDialog(); //}).Wait(); //EnterUsernameWindow_new enterUsernameWindow = new EnterUsernameWindow_new(true); ////enterUsernameWindow.Owner = this; //var dg = enterUsernameWindow.ShowDialog(); if ((bool)enterUsernameWindow.DialogResponse.result) //this.Close(); { try { _afis = new LocalAFIS(); if (!enrollForm_hidden) { //EnrollmentWindow_new enrollmentWindow = new EnrollmentWindow_new(_fpScanner, _afis); //EnrollmentWindow_new enrollmentWindow = new EnrollmentWindow_new(_fpScanner, _afis, enrollmentWindow = new EnrollmentWindow_new(_fpScanner, _afis, loggedin_staff, enterUsernameWindow.DialogResponse.enteredUsername, this); var ddg = enrollmentWindow.ShowDialog(); } else { enrollmentWindow.reloadForm(enterUsernameWindow.DialogResponse.enteredUsername); //var ddg = enrollmentWindow.Show(); } } catch (Exception ex) { AlertForm1 al = new AlertForm1(ex.Message, AlertForm1.AlertOptions.OK, AlertForm1.AlertType.error); al.ShowDialog(); } } } //testForm1 tf = new testForm1(); //tf.Show(); } //).Wait(); } catch (Exception ex) { //MetroMessageBox.Show(this,ex.ToString(), "Error",MessageBoxButtons.OK,MessageBoxIcon.Error); AlertForm1 al = new AlertForm1(ex.Message, AlertForm1.AlertOptions.OK); al.ShowDialog(); //MessageBox.Show(ex.ToString(), "Error"); runNextPhase = false; } //return 1; // .ContinueWith((_)=> //if (runNextPhase) { // Task.Run(() => //await Task.Run(() => //StopCapturing(); //ResetGUI(); //DisplayMessage("User enrollment"); //xamlListBoxUsers.SelectedIndex = -1; //Deselect User //Task.Factory.StartNew(() => { //try //{ // _afis = new LocalAFIS(); // //EnrollmentWindow_new enrollmentWindow = new EnrollmentWindow_new(_fpScanner, _afis); // EnrollmentWindow_new enrollmentWindow = new EnrollmentWindow_new(_fpScanner, _afis, loggedin_staff); // //enrollmentWindow.MdiParent = this; // enrollmentWindow.StartPosition = FormStartPosition.CenterScreen; // // EnrollmentWindow enrollmentWindow = new EnrollmentWindow(_fpScanner, _afis); // //enrollmentWindow.Owner = this; // //enrollmentWindow.Show(); // enrollmentWindow.Show(); //} //catch { } } //return 2; //).Wait(); } //if (enrollmentWindow.DialogResult) ////if (enrollmentWindow.DialogResult.HasValue && enrollmentWindow.DialogResult.Value) //{ // UpdateUserList(); //} //DisplayMessage("Select User to verify"); }
private void btn_Identification_Click(object sender, EventArgs e) { bool runNextPhase = false; // Task.Factory.StartNew(() => Thread.Sleep(1000); try { //_streaming = false; //_capture = new Capture(); { //Task.Run(() => //{ if (_fpScanner == null) { //MetroMessageBox.Show(this,ex.ToString(), "Error",MessageBoxButtons.OK,MessageBoxIcon.Error); //AlertForm1 al = new AlertForm1("Device is not connected", AlertForm1.AlertOptions.OK); //al.ShowDialog(); throw new Exception("Device is not connected"); //OpenSelectFGDialog(); //runNextPhase = true; //return; } //}).Wait(); else { //if ((bool)enterUsernameWindow.DialogResponse.result) //this.Close(); { try { _afis = new LocalAFIS(); if (!identifyForm_hidden) { //EnrollmentWindow_new enrollmentWindow = new EnrollmentWindow_new(_fpScanner, _afis); //EnrollmentWindow_new enrollmentWindow = new EnrollmentWindow_new(_fpScanner, _afis, IdentifyWindow = new IdentificationWindow(_fpScanner, _afis, loggedin_staff, "Identification Request", this); //IdentifyWindow.Show(); IdentifyWindow.Activate(); var ddg = IdentifyWindow.ShowDialog(); } else { //IdentifyWindow.reloadForm("Identification Request"); //var ddg = //IdentifyWindow.Show(); IdentifyWindow.Activate(); var ddg = IdentifyWindow.ShowDialog(); } } catch (Exception ex) { AlertForm1 al = new AlertForm1(ex.ToString(), AlertForm1.AlertOptions.OK); al.ShowDialog(); } } } //testForm1 tf = new testForm1(); //tf.Show(); } //).Wait(); } catch (Exception ex) { //MetroMessageBox.Show(this,ex.ToString(), "Error",MessageBoxButtons.OK,MessageBoxIcon.Error); AlertForm1 al = new AlertForm1(ex.Message, AlertForm1.AlertOptions.OK); al.ShowDialog(); //MessageBox.Show(ex.ToString(), "Error"); runNextPhase = false; } }