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