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();
                        }
                    }
                }
            });
        }
        // 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();
        }
        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();
        }
Esempio n. 4
0
        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 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();
        }
Esempio n. 7
0
        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");
            }
        }