private void MDIParent3_FormClosing(object sender, FormClosingEventArgs e) { if (_fpScanner == null) { return; } //StopCapturing(); _fpScanner.Dispose(); _fpScanner = null; }
private void CloseScanner() { if (_fpScanner == null) { return; } // StopCapturing(); _fpScanner.Dispose(); _fpScanner = null; }
private void OpenSelectFGDialog(bool setupPARAM = false) { //CloseScanner(); //ResetGUI(); //DisplayMessage("Device configuration"); try { SelectFGWindow_new selectFG = new SelectFGWindow_new(this); selectFG.ShowDialog(); if (selectFG.rDialogResult) // if (selectFG.ShowDialog()==DialogResult.OK) //if (selectFG.rDialogResult.HasValue && selectFG.rDialogResult.Value) { var selectedDeviceIdentity = selectFG.SelectedDeviceIdentity; if (_fpScanner != null) { _fpScanner.Dispose(); _fpScanner = null; } if (setupPARAM) { OpenSelectDeviceDialog_setup(selectedDeviceIdentity); } else { OpenSelectDeviceDialog(selectedDeviceIdentity); } } else { if (_fpScanner == null) { DisplayError("No Frame-Grabber selected."); } //EnableGUI(false); } } catch (Exception ex) { AlertForm1 al = new AlertForm1(ex.Message, AlertForm1.AlertOptions.OK, AlertForm1.AlertType.error); al.ShowDialog(); // DisplayError(ex.Message); } }
private void OpenSelectDeviceDialog(DeviceIdentity selectedDeviceIdentity) { //ResetGUI(); //DisplayMessage("Device configuration"); //EnableGUI(false); try { //IWin32Window win32Window = new WindowWrapper(this); SelectDeviceWindow_new selectDevice = new SelectDeviceWindow_new(selectedDeviceIdentity, this); if (_fpScanner != null) { selectDevice.FingerPrintScanner = _fpScanner; } selectDevice.ShowDialog(); if (selectDevice.rDialogResult) //if (selectDevice.rDialogResult.HasValue && selectDevice.DialogResult.Value) { // DisplayMessage("Opening device"); _fpScanner = selectDevice.FingerPrintScanner; if (_fpScanner != null) { //ResetGUI(); //EnableGUI(true); } } else { DisplayError("No device selected"); if (selectDevice.FingerPrintScanner != null) { selectDevice.FingerPrintScanner.Dispose(); } } } catch (Exception ex) { DisplayError(ex.Message); } }
private void btn_verifyZF10_Click(object sender, EventArgs e) { bool runNextPhase = true; Task.Run(() => { try { //_streaming = false; //_capture = new Capture(); if (_fpScanner == null) { OpenSelectFGDialog(); } else { //CloseScanner(); connect_Device(); _fpScanner = FingerPrintScanner; } //testForm1 tf = new testForm1(); //tf.Show(); } catch (Exception ex) { runNextPhase = false; AlertForm1 al = new AlertForm1(ex.ToString(), AlertForm1.AlertOptions.OK); al.ShowDialog(); //MessageBox.Show(ex.ToString(), "Error"); } }).Wait(); if (runNextPhase) { VerifyZF10 fm = new VerifyZF10(_fpScanner); fm.Show(); } }
private void OpenSelectFGDialog() { CloseScanner(); //ResetGUI(); //DisplayMessage("Device configuration"); try { SelectFGWindow_new selectFG = new SelectFGWindow_new(this); selectFG.ShowDialog(); if (selectFG.rDialogResult) // if (selectFG.ShowDialog()==DialogResult.OK) //if (selectFG.rDialogResult.HasValue && selectFG.rDialogResult.Value) { var selectedDeviceIdentity = selectFG.SelectedDeviceIdentity; if (_fpScanner != null) { _fpScanner.Dispose(); _fpScanner = null; } OpenSelectDeviceDialog(selectedDeviceIdentity); } else { if (_fpScanner == null) { DisplayError("No Frame-Grabber selected."); } //EnableGUI(false); } } catch (Exception ex) { DisplayError(ex.Message); } }
public void connect_Device() { // CloseScanner(); //Thread.Sleep(1000); //string deviceName = "FG_ZF10"; DeviceIdentity selectedDI = new DeviceIdentity(); //Get selected Frame-Grabber selectedDI = DeviceIdentity.FG_ZF10; //Get selected Frame-Grabber //DeviceIdentity selectedDI = (DeviceIdentity)xamlListBoxFG.SelectedItem; //Get selected Frame-Grabber //this.SelectedDeviceIdentity = selectedDI; DeviceInformations[] dinfos = FPScanner.GetAttachedDevices(selectedDI); //Get all Fingerprint Scanners DeviceInformations dinfo = dinfos.First(); DeviceInfos di = new DeviceInfos(dinfo.index, dinfo.name); FingerPrintScanner = FPScanner.GetFPScanner(selectedDI, di.Index); //_fpScanner = FingerPrintScanner; ////use any assembly versions //RedirectAssembly("Dermalog.Imaging.Capturing"); //RedirectAssembly("Dermalog.AFIS.FourprintSegmentation"); //RedirectAssembly("Dermalog.AFIS.TwoPprintSegmentation"); //RedirectAssembly("Dermalog.Afis.NistQualityCheck"); //RedirectAssembly("Dermalog.AFIS.FingerCode3"); //_afis = new LocalAFIS(); //// DisplayMessage("Loading user database"); // // lbStorage.Text = "Storage: " + _afis.StoragePath; // //toolTip1.SetToolTip(lbStorage, _afis.StoragePath); // //lbStorage.ToolTip = _afis.StoragePath; // UpdateUserList(); //EnableGUI(false); //Thread.Sleep(500); }
private void AddScanner(FPScanner Scanner) { try { if (!Scanner.IsCapturing) { Scanner.FingerPlaced += new EventHandler(Scanner_FingerPlaced); Scanner.FingerRemoved += new EventHandler(Scanner_FingerRemoved); Scanner.ImageScanned += new FPScannerImageScannedEventHandler(Scanner_ImageScanned); Scanner.StartCapturing(); } } catch (Neurotec.NotActivatedException ex) { throw new Exception("A scanning module has not been registered. Please check your scanning services to make sure they have been started.", ex); } catch (Exception ex) { throw new Exception(string.Format("Unable to start capturing using device: {0}.", Scanner.Id), ex); } }
private void OpenSelectDeviceDialog_setup(DeviceIdentity selectedDeviceIdentity) { bool runNextPhase = true; //ResetGUI(); //DisplayMessage("Device configuration"); //EnableGUI(false); try { //IWin32Window win32Window = new WindowWrapper(this); SelectDeviceWindow_new selectDevice = new SelectDeviceWindow_new(selectedDeviceIdentity, this); if (_fpScanner != null) { selectDevice.FingerPrintScanner = _fpScanner; } selectDevice.ShowDialog(); if (selectDevice.rDialogResult) //if (selectDevice.rDialogResult.HasValue && selectDevice.DialogResult.Value) { // DisplayMessage("Opening device"); _fpScanner = selectDevice.FingerPrintScanner; //ic._fpScanner = _fpScanner; if (_fpScanner != null) { //ResetGUI(); //EnableGUI(true); } // runNextPhase = true; // NewUserRegistraion_popup(); ////EnterUsernameWindow_new //EnterUsernameWindow_new enterUsernameWindow = new EnterUsernameWindow_new(true); ////enterUsernameWindow.Owner = this; //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); // //enrollmentWindow.MdiParent = this; // //enrollmentWindow.StartPosition = FormStartPosition.CenterScreen; // // EnrollmentWindow enrollmentWindow = new EnrollmentWindow(_fpScanner, _afis); // //enrollmentWindow.Owner = this; // //enrollmentWindow.Show(); // var ddg = enrollmentWindow.ShowDialog(); // } // else // { // enrollmentWindow.reloadForm(enterUsernameWindow.DialogResponse.enteredUsername); // var ddg = enrollmentWindow.ShowDialog(); // } // } // catch { } //} } else { //DisplayError("No device selected"); //DialogResult msg = MessageBox.Show("Kindly connect your fingerprint Device and Retry", "No device selected" // , MessageBoxButtons.RetryCancel, MessageBoxIcon.Information); AlertForm1 al = new AlertForm1("Kindly connect your fingerprint Device and Retry", AlertForm1.AlertOptions.RETRYCANCEL , AlertForm1.AlertType.error, "No device selected"); var aa = al.ShowDialog(); if (!al.rDialogResult) //if (msg == DialogResult.Cancel) { if (selectDevice.FingerPrintScanner != null) { selectDevice.FingerPrintScanner.Dispose(); } runNextPhase = false; } else { OpenSelectDeviceDialog_setup(selectedDeviceIdentity); //connect_Device(); } } } catch (Exception ex) { DisplayError(ex.Message); } }
private void RemoveScanner(FPScanner Scanner) { try { if (Scanner.IsCapturing) { Scanner.StopCapturing(); Scanner.FingerPlaced -= new EventHandler(Scanner_FingerPlaced); Scanner.FingerRemoved -= new EventHandler(Scanner_FingerRemoved); Scanner.ImageScanned -= new FPScannerImageScannedEventHandler(Scanner_ImageScanned); } } catch (Exception ex) { throw new Exception(string.Format("Unable to stop capturing using device: {0}.", Scanner.Id), ex); } }