private void NewMethodcaptureDevice_() { Task.Run(() => { if (xamlListBoxDevices.SelectedIndex >= 0) { DeviceInfos selectedDInfos = xamlListBoxDevices.SelectedItem as DeviceInfos; //Get selected Fingerprint Scanner // DeviceInfos selectedDInfos = xamlListBoxDevices.SelectedValue as DeviceInfos; //Get selected Fingerprint Scanner if (selectedDInfos != null) { var _preCursor = this.Cursor; try { this.Cursor = Cursors.WaitCursor; //.Wait; FingerPrintScanner = FPScanner.GetFPScanner(_selectedDeviceIdentity, selectedDInfos.Index); rDialogResult = true; } catch (Exception ex) { AlertForm1 al = new AlertForm1(ex.Message, AlertForm1.AlertOptions.OK, AlertForm1.AlertType.error); al.ShowDialog(); //MessageBox.Show(ex.Message, "ERROR"); } finally { this.Cursor = _preCursor; this.Close(); } } } }); }
public EnrollmentWindow(FPScanner fpScanner, LocalAFIS afis) { InitializeComponent(); xamlButtonEnroll.IsEnabled = false; _fpScanner = fpScanner; _afis = afis; }
// private Task _thread2; public SelectDeviceWindow_new(DeviceIdentity selectedDeviceIdentity, MainForm owner) { _selectedDeviceIdentity = selectedDeviceIdentity; //this.pa = owner; InitializeComponent(); this.Closing += SelectDeviceWindow_Closing; displayMessage("Loading Devices"); xamlButtonOK.Enabled = false; _thread = new Thread(() => //_thread = new Task(() => { try { DeviceInformations[] dinfos = FPScanner.GetAttachedDevices(_selectedDeviceIdentity); //Get all Fingerprint Scanners //Display all Fingerprint-Scanners in GUI // Application.Current.Dispatcher.BeginInvoke((Action)(() => { xamlProgressBar.Visible = false; displayMessage("Select Fingerprint-Scanner"); foreach (DeviceInformations dinfo in dinfos) { DeviceInfos di = new DeviceInfos(dinfo.index, dinfo.name); xamlListBoxDevices.Items.Add(di); } if (xamlListBoxDevices.Items.Count > 0) { xamlListBoxDevices.SelectedIndex = 0; } //Close(); } //)); //NewMethodcaptureDevice_(); } catch (Exception ex) { //Application.Current.Dispatcher.BeginInvoke((Action)(() => { rDialogResult = false; MessageBox.Show(ex.Message, "ERROR"); } //)); } }); _thread.Start(); //Close(); }
private void CloseScanner() { if (_fpScanner == null) { return; } StopCapturing(); _fpScanner.Dispose(); _fpScanner = null; }
public SelectFGWindow(Window owner) { this.Owner = owner; InitializeComponent(); displayMessage("Select Frame-Grabber"); xamlButtonOK.IsEnabled = false; DeviceIdentity[] dis = FPScanner.GetDevices(); xamlListBoxFG.ItemsSource = dis; }
private void OpenSelectDeviceDialog(DeviceIdentity selectedDeviceIdentity) { ResetGUI(); DisplayMessage("Device configuration"); EnableGUI(false); try { SelectDeviceWindow selectDevice = new SelectDeviceWindow(selectedDeviceIdentity, this); if (_fpScanner != null) { selectDevice.FingerPrintScanner = _fpScanner; } selectDevice.ShowDialog(); if (selectDevice.DialogResult.HasValue && selectDevice.DialogResult.Value) { DisplayMessage("Opening device"); _fpScanner = selectDevice.FingerPrintScanner; if (_fpScanner != null) { ResetGUI(); EnableGUI(true); /* * if(xamlListBoxUsers.Items.Count > 0) * { * xamlListBoxUsers.SelectedIndex = 0; * } */ } } else { DisplayError("No device selected"); if (selectDevice.FingerPrintScanner != null) { selectDevice.FingerPrintScanner.Dispose(); } } } catch (Exception ex) { DisplayError(ex.Message); } }
public SelectDeviceWindow2(DeviceIdentity selectedDeviceIdentity, Window owner) { _selectedDeviceIdentity = selectedDeviceIdentity; this.Owner = owner; InitializeComponent(); this.Closing += SelectDeviceWindow_Closing; displayMessage("Loading Devices"); xamlButtonOK.IsEnabled = false; _thread = new Thread(() => { try { DeviceInformations[] dinfos = FPScanner.GetAttachedDevices(_selectedDeviceIdentity); //Get all Fingerprint Scanners //Display all Fingerprint-Scanners in GUI Application.Current.Dispatcher.BeginInvoke((Action)(() => { xamlProgressBar.Visibility = System.Windows.Visibility.Hidden; displayMessage("Select Fingerprint-Scanner"); foreach (DeviceInformations dinfo in dinfos) { DeviceInfos di = new DeviceInfos(dinfo.index, dinfo.name); xamlListBoxDevices.Items.Add(di); } if (xamlListBoxDevices.Items.Count > 0) { xamlListBoxDevices.SelectedIndex = 0; } })); } catch (Exception ex) { Application.Current.Dispatcher.BeginInvoke((Action)(() => { DialogResult = false; MessageBox.Show(ex.Message, "ERROR"); })); } }); _thread.Start(); }
public MainForm(FPScanner __fpScanner) { // InitializeComponent(); Control.CheckForIllegalCrossThreadCalls = false; _fpScanner = __fpScanner; //connect_Device(); try { InitializeComponent(); this.Text += " v" + Assembly.GetExecutingAssembly().GetName().Version; //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); } catch (Exception ex) { //Console.WriteLine(ex.StackTrace); MessageBox.Show(ex.Message + "\n" + ex.StackTrace, "ERROR"); //Close(); //DisplayError(ex.Message + "\n" + ex.StackTrace); lst_msg.Items.Insert(0, 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 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); } }
private async void NewMethod_InitializeComponent() { InitializeComponent(); Control.CheckForIllegalCrossThreadCalls = false; displayMessage("Select Frame-Grabber"); xamlButtonOK.Enabled = false; DeviceIdentity[] dis = FPScanner.GetDevices(); xamlListBoxFG.DataSource = dis; xamlListBoxFG.SelectedIndex = 0; if (xamlListBoxFG.Items.Count > 1) { //Show(); DeviceIdentity selectedDI = (DeviceIdentity)xamlListBoxFG.SelectedItem; //Get selected Frame-Grabber this.SelectedDeviceIdentity = selectedDI; xamlButtonOK.Enabled = true; rDialogResult = true; } else if (xamlListBoxFG.Items.Count == 1) { Hide(); ////////////////////////////////////////////////////////////// //Dont alter this codes below, it will lead toerror int rr = await Task.Run(() => { DeviceIdentity selectedDI = (DeviceIdentity)xamlListBoxFG.SelectedItem; //Get selected Frame-Grabber this.SelectedDeviceIdentity = selectedDI; xamlButtonOK.Visible = false; rDialogResult = true; return(1); }); this.Close(); ////////////////////////////////////////////////////////////// } }
public void connect_Device() { // CloseScanner(); Thread.Sleep(1000); //string deviceName = "FG_ZF10"; DeviceIdentity 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); }
/// <summary> /// Factory to get FPScanner object from a given DeviceIdentity /// </summary> /// <param name="deviceIdentity"></param> /// <returns></returns> public static FPScanner GetFPScanner(DeviceIdentity deviceIdentity, int index) { FPScanner scanner = null; switch (deviceIdentity) { case DeviceIdentity.FG_LF1: scanner = new FPScannerLF1(index); break; case DeviceIdentity.FG_LF10: scanner = new FPScannerLF10(index); break; case DeviceIdentity.FG_PLS1: throw new Exception("FG_PLS1 is deprecated. Please use FG_ZF1"); // scanner = new FPScannerZF1(deviceIdentity, CaptureMode.PLAIN_FINGER, NativeInterfaceVersion.VC3v1); // break; case DeviceIdentity.FG_ZF1: scanner = new FPScannerZF1(deviceIdentity, index, CaptureMode.PREVIEW_IMAGE_AUTO_DETECT); break; case DeviceIdentity.FG_ZF10: scanner = new FPScannerZF10(index); break; case DeviceIdentity.FG_ZF2: scanner = new FPScannerZF2(index); break; default: throw new Exception("DeviceIdentity not supported: " + deviceIdentity); } return(scanner); }
private void xamlButtonOK_Click(object sender, RoutedEventArgs e) { if (xamlListBoxDevices.SelectedIndex >= 0) { DeviceInfos selectedDInfos = xamlListBoxDevices.SelectedValue as DeviceInfos; //Get seleced Fingerprint Scanner if (selectedDInfos != null) { var _preCursor = this.Cursor; try { this.Cursor = Cursors.Wait; FingerPrintScanner = FPScanner.GetFPScanner(_selectedDeviceIdentity, selectedDInfos.Index); DialogResult = true; }catch (Exception ex) { MessageBox.Show(ex.Message, "ERROR"); } finally { this.Cursor = _preCursor; } } } }
private void NewMethod_selectDevice() { InitializeComponent(); this.Closing += SelectDeviceWindow_Closing; displayMessage("Loading Devices"); xamlButtonOK.Enabled = true; //_thread = new Thread(() => Task.Run(() => { try { DeviceInformations[] dinfos = FPScanner.GetAttachedDevices(_selectedDeviceIdentity); //Get all Fingerprint Scanners //Display all Fingerprint-Scanners in GUI // Application.Current.Dispatcher.BeginInvoke((Action)(() => { xamlProgressBar.Visible = false; displayMessage("Select Fingerprint-Scanner"); foreach (DeviceInformations dinfo in dinfos) { DeviceInfos di = new DeviceInfos(dinfo.index, dinfo.name); xamlListBoxDevices.Items.Add(di); } if (xamlListBoxDevices.Items.Count > 1) { xamlListBoxDevices.SelectedIndex = 0; //NewMethodcaptureDevice_(); //xamlButtonOK.Enabled = true; } else if (xamlListBoxDevices.Items.Count == 1) { this.Hide(); xamlListBoxDevices.SelectedIndex = 0; //xamlButtonOK.Enabled = false; NewMethodcaptureDevice_(); } else if (xamlListBoxDevices.Items.Count == 0) { this.Hide(); //xamlListBoxDevices.SelectedIndex = 0; //xamlButtonOK.Enabled = false; //NewMethodcaptureDevice_(); throw new Exception("No device Detected, make sure Scanner is attached and retry"); //rDialogResult = false; } //Close(); } //)); //NewMethodcaptureDevice_(); } catch (Exception ex) { //Application.Current.Dispatcher.BeginInvoke((Action)(() => { rDialogResult = false; AlertForm1 al = new AlertForm1(ex.Message, AlertForm1.AlertOptions.OK , AlertForm1.AlertType.error, "ERROR Encountered"); al.ShowDialog(); //MessageBox.Show(ex.Message, "ERROR Encountered",MessageBoxButtons.OK,MessageBoxIcon.Error); Close(); } //)); } }).Wait(500); //_thread.Start(); //Close(); }
private void OpenSelectFGDialog() { CloseScanner(); ResetGUI(); DisplayMessage("Device configuration"); try { SelectFGWindow selectFG = new SelectFGWindow(this); //selectFG.ShowDialog(); //selectFG.DialogResult.HasValue = true; //selectFG.DialogResult.Value = true; var selectedDeviceIdentity = Dermalog.Imaging.Capturing.DeviceIdentity.FG_ZF2; if (true) //if (selectFG.DialogResult.HasValue && selectFG.DialogResult.Value) { //var selectedDeviceIdentity = selectFG.SelectedDeviceIdentity; if (_fpScanner != null) { _fpScanner.Dispose(); _fpScanner = null; } //OpenSelectDeviceDialog(selectedDeviceIdentity); //GET SCANNER SERIE DeviceInformations[] dinfos = FPScanner.GetAttachedDevices(selectedDeviceIdentity); //Get all Fingerprint Scanners var scannerSerie = 0; //Display all Fingerprint-Scanners in GUI foreach (DeviceInformations dinfo in dinfos) { DeviceInfos di = new DeviceInfos(dinfo.index, dinfo.name); //xamlListBoxDevices.Items.Add(di); scannerSerie = di.Index; } //AUTOMATIC SELECTED DEVICE WINDOWS 2 var _preCursor = this.Cursor; try { this.Cursor = Cursors.Wait; FingerPrintScanner = FPScanner.GetFPScanner(selectedDeviceIdentity, scannerSerie); //DialogResult = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "ERROR"); } finally { this.Cursor = _preCursor; } //AUTOMATIC SELECTED DEVICE WINDOWS 2 SelectDeviceWindow selectDevice = new SelectDeviceWindow(selectedDeviceIdentity, this); DisplayMessage("Opening device"); selectDevice.FingerPrintScanner = FingerPrintScanner; _fpScanner = selectDevice.FingerPrintScanner; if (_fpScanner != null) { ResetGUI(); EnableGUI(true); /* * if (xamlListBoxUsers.Items.Count > 0) * { * xamlListBoxUsers.SelectedIndex = 0; * } */ } } else { if (_fpScanner == null) { DisplayError("No Frame-Grabber selected."); } EnableGUI(false); } } catch (Exception ex) { DisplayError(ex.Message); MessageBox.Show(ex.ToString(), "Error"); } }