Beispiel #1
0
        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);
            }
        }
Beispiel #2
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");
            }
        }