private void EditStudentEnrollment_Load(object sender, EventArgs e)
        {
            preenrollmentFmds = new List <Fmd>();
            _db      = new DataEntity();
            _readers = ReaderCollection.GetReaders();

            CurrentReader = _readers[0];

            ClearFormFields(this);
            picBoxFingerPrint.Image = null;

            if (!OpenReader())
            {
                this.Close();
            }

            if (!StartCaptureAsync(this.OnCaptured))
            {
                this.Close();
            }

            LoadColleges();
            //LoadProgrammes();
            LoadLevels();
            cmdGender.SelectedIndex = 0;
        }
        public async Task DatabaseAbstractionTestAsync()
        {
            var queryDispatcher  = new QueryDispatcher(new QueryExecutor(new CommandPreparer(), new ConnectionFactory(ConnectionString.Default)));
            var readerCollection = new ReaderCollection(new[] { Reader.Create(new TestItemReader()) });
            var database         = new Database(queryDispatcher, readerCollection);

            var setupQueries = new String[]
            {
                "DROP TABLE IF EXISTS database_abstraction_test;",
                "CREATE TABLE database_abstraction_test (id INT NOT NULL, value TEXT NOT NULL);",
                "INSERT INTO database_abstraction_test VALUES (1, 'James');",
                "INSERT INTO database_abstraction_test VALUES (2, 'Madison');",
                "INSERT INTO database_abstraction_test VALUES (3, 'University');"
            };

            foreach (var setupQuery in setupQueries)
            {
                await queryDispatcher.ExecuteAsync(new Query(setupQuery));
            }

            var item =
                await database
                .CreateQuery(@"
						SELECT id, value
						FROM database_abstraction_test
						WHERE id = :id;"                        )
                .SetParameter("id", 1)
                .FirstAsync <TestItem>();

            Assert.NotNull(item);
            Assert.Equal(item.Id, 1);
            Assert.Equal(item.Value, "James");
        }
Exemple #3
0
        public void IndexDeviceList(System.Windows.Forms.ComboBox cboLista)
        {
            objReaders      = ReaderCollection.GetReaders();
            objDeviceReader = new List <DeviceInfo>();
            objUsbs         = GetUSBDevices();

            Action work = delegate
            {
                foreach (DeviceInfo device in objUsbs)
                {
                    System.Console.WriteLine(device.deviceID);

                    foreach (Reader itemReader in objReaders)
                    {
                        if (device.deviceID.IndexOf(itemReader.Description.SerialNumber) != -1)
                        {
                            objDeviceReader.Add(device);
                            cboLista.Items.Add(device.deviceName);

                            return;
                        }
                    }
                }
            };

            work();
        }
Exemple #4
0
        public DigitalPersonaBiometricsForm(string Savefile, DPBiometricsState scanprocess, string userid, int timeout, BiometricDataManager biodatamanager)
        {
            InitializeComponent();
            buttonScan.Text   = LanguageTranslation.SCAN;
            buttonCancel.Text = LanguageTranslation.CANCEL;

            SaveFileName      = Savefile;
            Cancelled         = false;
            Success           = false;
            UserID            = userid;
            Timeout           = timeout;
            BioDataManager    = biodatamanager;
            IdentificationIDs = new List <string>();
            AvailableReaders  = ReaderCollection.GetReaders();
            ScanProcess       = scanprocess;
            if (AvailableReaders.Count > 0)
            {
                Reader = AvailableReaders[0];
            }
            else
            {
                throw new Exception("No Biometric Readers\r\nAvailable");
            }
            SetLabelText(labelMessage, LanguageTranslation.SCAN_FINGERPRINT + ScanProcess.ToString());
        }
Exemple #5
0
        /// <summary>
        /// Enumerates the devices.
        /// </summary>
        public void EnumerateDevices()
        {
            ReaderCollection readers = ReaderCollection.GetReaders();

            foreach (var reader in readers)
            {
                if (ActiveDevices.OfType <DeviceDP>().Any(dev =>
                                                          dev.Id == reader.Description.Name))
                {
                    continue;
                }
                DeviceDP device = new DeviceDP(reader.Description.Name, "U.Are.U Fingerprint Reader", this);
                ActiveDevices.Add(device);
            }
            List <DeviceDP> deleteList = new List <DeviceDP>();

            foreach (var device in ActiveDevices.OfType <DeviceDP>())
            {
                if (!readers.Any(reader =>
                                 reader.Description.Name == device.Id))
                {
                    device.Dispose();
                    deleteList.Add(device);
                }
            }
            foreach (var device in deleteList)
            {
                ActiveDevices.Remove(device);
            }
        }
Exemple #6
0
        //load available reader if multiple reader is selected
        private void loadAvaillableReaders()
        {
            cboReaders.Text = string.Empty;
            cboReaders.Items.Clear();
            cboReaders.SelectedIndex = -1;

            try
            {
                _readers = ReaderCollection.GetReaders();

                foreach (Reader Reader in _readers)
                {
                    cboReaders.Items.Add(Reader.Description.SerialNumber);
                }

                if (cboReaders.Items.Count > 0)
                {
                    cboReaders.SelectedIndex = 0;
                }
                else
                {
                }
            }
            catch (Exception ex)
            {
                //message box:
                String text = ex.Message;
                text += "\r\n\r\nPlease check if DigitalPersona service has been started";
                String caption = "Cannot access readers";
                MessageBox.Show(text, caption);
            }
        }
Exemple #7
0
        /// <summary>
        /// Clear the control of readers, get readers and display.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnRefresh_Click(System.Object sender, System.EventArgs e)
        {
            cboReaders.Text = string.Empty;
            cboReaders.Items.Clear();
            cboReaders.SelectedIndex = -1;

            _readers = ReaderCollection.GetReaders();

            foreach (Reader Reader in _readers)
            {
                cboReaders.Items.Add(Reader.Description.SerialNumber);
            }

            if (cboReaders.Items.Count > 0)
            {
                cboReaders.SelectedIndex = 0;
                btnCaps.Enabled          = true;
                btnSelect.Enabled        = true;
            }
            else
            {
                btnSelect.Enabled = false;
                btnCaps.Enabled   = false;
            }
        }
Exemple #8
0
        private void Register_Load(object sender, EventArgs e)
        {
            btnSave.Enabled   = false;
            this.DialogResult = System.Windows.Forms.DialogResult.None;
            ReaderCollection readers = ReaderCollection.GetReaders();

            if (readers.Count == 0)
            {
                MessageBox.Show("Registration requires a plugged in fingerprint reader.");
                readers.Dispose();
                readers = null;
                this.Close();
                return;
            }

            if (readers.Count > 1)
            {
                MessageBox.Show("This sample is designed for a single connected reader.  Please connect only 1 device.");
                readers.Dispose();
                readers = null;
                this.Close();
                return;
            }

            reader = readers[0];

            if (reader.Open(Constants.CapturePriority.DP_PRIORITY_COOPERATIVE) != Constants.ResultCode.DP_SUCCESS)
            {
                MessageBox.Show("Could not open device.");
                readers.Dispose();
                readers = null;
                this.Close();
                return;
            }

            if (reader.GetStatus() != Constants.ResultCode.DP_SUCCESS)
            {
                MessageBox.Show("Error getting device status.");
                readers.Dispose();
                readers = null;
                this.Close();
                return;
            }

            if (reader.Status.Status != Constants.ReaderStatuses.DP_STATUS_READY)
            {
                MessageBox.Show("Device not ready.  Try again in a few seconds.");
                readers.Dispose();
                readers = null;
                this.Close();
                return;
            }

            reader.On_Captured += new Reader.CaptureCallback(reader_On_Captured);
            reader.CaptureAsync(Constants.Formats.Fid.ISO, Constants.CaptureProcessing.DP_IMG_PROC_DEFAULT, reader.Capabilities.Resolutions[0]);

            rbLeftIndex.Checked = true;
            lblInfo.Text        = "Press your thumb 4 or more times.";
        }
Exemple #9
0
 private void frmEncontrarDispositivo_Load(object sender, EventArgs e)
 {
     dispositivos = ReaderCollection.GetReaders();
     listFingers.Items.Clear();
     foreach (Reader item in dispositivos)
     {
         listFingers.Items.Add(item.Description.Name);
     }
 }
        /// <summary>
        /// Sets available readers.
        /// </summary>
        public static void Reset()
        {
            readerCollection = ReaderCollection.GetReaders();

            if (readerCollection.Count == 0)
            {
                throw new Exceptions.NullReferenceException("No fingerprint scanner found - plug in the device.");
            }
        }
Exemple #11
0
        private void CheckReaderPluggedin()
        {
            ReaderCollection rc = ReaderCollection.GetReaders();

            //If reader count is zero, inform user
            if (rc.Count == 0)
            {
                readerNotFoundlbl.Visible = true;
            }
        }
Exemple #12
0
        public unsafe T Deserialize <T>(byte[] data)
        {
            var reader = ReaderCollection.GetReader(typeof(T));

            fixed(byte *b = &data[0])
            {
                int index = 0;

                return((T)reader.Read(b, ref index));
            }
        }
Exemple #13
0
 /// <summary>
 /// Initializes this instance.
 /// </summary>
 public void Initialize()
 {
     try
     {
         ReaderCollection readers = ReaderCollection.GetReaders();
         ActiveDevices = new List <IFingerDevice>();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #14
0
        public GroBufReader(long serializerId, IDataMembersExtractor dataMembersExtractor, IGroBufCustomSerializerCollection customSerializerCollection, GroBufOptions options, Func <Type, IGroBufCustomSerializer> factory, Func <Type, IGroBufCustomSerializer> baseFactory)
        {
            this.serializerId               = serializerId;
            this.dataMembersExtractor       = dataMembersExtractor;
            this.customSerializerCollection = customSerializerCollection;
            this.options     = options;
            this.factory     = factory;
            this.baseFactory = baseFactory;
            var assembly = AppDomain.CurrentDomain.DefineDynamicAssembly(new AssemblyName(Guid.NewGuid().ToString()), AssemblyBuilderAccess.Run);

            module           = assembly.DefineDynamicModule(Guid.NewGuid().ToString());
            readerCollection = new ReaderCollection(customSerializerCollection, factory, baseFactory, module);
        }
Exemple #15
0
        public Reader IndexDevice()
        {
            Reader           objSelectedReader = null;
            ReaderCollection objReadersList    = ReaderCollection.GetReaders();

            foreach (Reader itemReader in objReadersList)
            {
                objSelectedReader = itemReader;

                break;
            }

            return(objSelectedReader);
        }
 private void RefreshEikon()
 {
     try
     {
         _readers = ReaderCollection.GetReaders();
     }
     catch (Exception ex)
     {
         //message box:
         String text = ex.Message;
         text += "\r\n\r\nPlease check if DigitalPersona service has been started";
         String caption = "Cannot access readers";
         MessageBox.Show(text, caption);
     }
 }
Exemple #17
0
        private void InitializeReaders()
        {
            ReaderCollection rc = ReaderCollection.GetReaders();

            if (rc.Count == 0)
            {
                //UpdateEnrollMessage("Fingerprint Reader not found. Please check if reader is plugged in and try again", null);
                VerifyMessageLbl.Text = "Fingerprint Reader not found. Please check if reader is plugged in and try again";
            }
            else
            {
                reader = rc[0];
                Constants.ResultCode readersResult = reader.Open(Constants.CapturePriority.DP_PRIORITY_COOPERATIVE);
            }
        }
Exemple #18
0
        public async Task ContextualizedQueryBuilderTestAsync()
        {
            var queryDispatcher =
                new QueryDispatcher(
                    new QueryExecutor(
                        new CommandPreparer(),
                        new ConnectionFactory(ConnectionString.Default)));

            var setupQueries = new String[]
            {
                "DROP TABLE IF EXISTS contextualized_query_builder_query_test;",
                "CREATE TABLE contextualized_query_builder_query_test (id INT NOT NULL, value TEXT NOT NULL);",
                "INSERT INTO contextualized_query_builder_query_test VALUES (1, 'James');",
                "INSERT INTO contextualized_query_builder_query_test VALUES (2, 'Frank');",
                "INSERT INTO contextualized_query_builder_query_test VALUES (3, 'Hopkins');",
                "INSERT INTO contextualized_query_builder_query_test VALUES (4, 'Greenfield');",
                "INSERT INTO contextualized_query_builder_query_test VALUES (5, 'Quarles');",
                "INSERT INTO contextualized_query_builder_query_test VALUES (6, 'James');",
                "INSERT INTO contextualized_query_builder_query_test VALUES (7, 'McIlvaine');",
                "INSERT INTO contextualized_query_builder_query_test VALUES (8, 'Riley');",
            };

            foreach (var setupQuery in setupQueries)
            {
                await queryDispatcher.ExecuteAsync(new Query(setupQuery));
            }

            var readerCollection = new ReaderCollection(new[]
            {
                Reader.Create(new TestItemReader())
            });

            var contextualizedQueryBuilder = new ContextualizedQueryBuilder(queryDispatcher, readerCollection);

            var item =
                await contextualizedQueryBuilder
                .SetQuery(@"
						SELECT id, value
						FROM contextualized_query_builder_query_test
						WHERE value = :value;"                        )
                .SetParameter("value", "Hopkins")
                .Build()
                .FirstAsync <TestItem>();

            Assert.NotNull(item);
            Assert.Equal(item.Id, 3);
            Assert.Equal(item.Value, "Hopkins");
        }
        private void Driver(object sender, RoutedEventArgs e)
        {
            ReaderCollection rc = ReaderCollection.GetReaders();

            if (rc != null)
            {
                foreach (Reader r in rc)
                {
                    Console.WriteLine(r.Description.Name);
                }

                reader = rc[0];

                Console.WriteLine(reader.Description.Name);
            }
        }
Exemple #20
0
        private void Verification_Load(object sender, EventArgs e)
        {
            _db           = new DataEntity();
            _readers      = ReaderCollection.GetReaders();
            CurrentReader = _readers[0];
            if (!OpenReader())
            {
                this.Close();
            }

            if (!StartCaptureAsync(this.OnCaptured))
            {
                this.Close();
            }
            LoadColleges();
            LoadLevels();
        }
Exemple #21
0
        public async Task ContextualizedQueryTestAsync()
        {
            var queryDispatcher =
                new QueryDispatcher(
                    new QueryExecutor(
                        new CommandPreparer(),
                        new ConnectionFactory(ConnectionString.Default)));

            var setupQueries = new String[]
            {
                "DROP TABLE IF EXISTS contextualized_query_test;",
                "CREATE TABLE contextualized_query_test (id INT NOT NULL, value TEXT NOT NULL);",
                "INSERT INTO contextualized_query_test VALUES (1, 'Sigma');",
                "INSERT INTO contextualized_query_test VALUES (2, 'Nu');",
                "INSERT INTO contextualized_query_test VALUES (3, 'Iota');",
                "INSERT INTO contextualized_query_test VALUES (4, 'Delta');"
            };

            foreach (var setupQuery in setupQueries)
            {
                await queryDispatcher.ExecuteAsync(new Query(setupQuery));
            }

            var query =
                new QueryBuilder()
                .SetQuery(@"
						SELECT id, value
						FROM contextualized_query_test
						WHERE value = :greekLetter;"                        )
                .SetParameter("greekLetter", "Delta")
                .Build();

            var readerCollection = new ReaderCollection(new[]
            {
                Reader.Create(new TestItemReader())
            });

            var contextualizedQuery = new ContextualizedQuery(query, queryDispatcher, readerCollection);

            var item = await contextualizedQuery.FirstAsync <TestItem>();

            Assert.NotNull(item);
            Assert.Equal(item.Id, 4);
            Assert.Equal(item.Value, "Delta");
        }
Exemple #22
0
        /// <summary>
        /// The capture fingerprint.
        /// </summary>
        /// <returns>
        /// The <see cref="ResultFingerprint"/>.
        /// </returns>
        public ResultFingerprint CaptureFingerprint()
        {
            var readers = ReaderCollection.GetReaders();

            var resultFingerprint = this.ValidateReader(readers);

            if (!resultFingerprint.Result)
            {
                return(resultFingerprint);
            }

            var currentReader = readers[0];
            var resultOpen    = currentReader.Open(Constants.CapturePriority.DP_PRIORITY_COOPERATIVE);

            if (resultOpen != Constants.ResultCode.DP_SUCCESS)
            {
                resultFingerprint.Result  = false;
                resultFingerprint.Message = es_CO.CannotOpenReader;
            }

            currentReader.On_Captured += this.OnCapture;

            if (this.ValidateReader(currentReader))
            {
                resultFingerprint.Result  = false;
                resultFingerprint.Message = es_CO.ReaderNotReady;
            }

            var captureResult = currentReader.CaptureAsync(
                Constants.Formats.Fid.ANSI,
                Constants.CaptureProcessing.DP_IMG_PROC_DEFAULT,
                currentReader.Capabilities.Resolutions[0]);

            if (captureResult != Constants.ResultCode.DP_SUCCESS)
            {
                resultFingerprint.Result  = false;
                resultFingerprint.Message = es_CO.CaptureFail;
            }

            resultFingerprint.Result  = true;
            resultFingerprint.Message = es_CO.WithoutReader;

            return(resultFingerprint);
        }
        public async Task ReaderTestAsync()
        {
            var queryDispatcher =
                new QueryDispatcher(
                    new QueryExecutor(
                        new CommandPreparer(),
                        new ConnectionFactory(ConnectionString.Default)));

            var setupQueries = new String[]
            {
                "DROP TABLE IF EXISTS reader_test;",
                "CREATE TABLE reader_test (id INT NOT NULL, first_name TEXT NOT NULL, middle_name TEXT, last_name TEXT NOT NULL);",
                "INSERT INTO reader_test VALUES (417, 'Brendan', 'James', 'Baker');"
            };

            foreach (var setupQuery in setupQueries)
            {
                await queryDispatcher.ExecuteAsync(new Query(setupQuery));
            }

            var readerCollection = new ReaderCollection(new[]
            {
                Reader.Create(new PersonReader())
            });

            var contextualizedQueryBuilder = new ContextualizedQueryBuilder(queryDispatcher, readerCollection);

            var item =
                await contextualizedQueryBuilder
                .SetQuery(@"
						SELECT id, first_name, middle_name, last_name
						FROM reader_test
						WHERE last_name = :last_name;"                        )
                .SetParameter("last_name", "Baker")
                .Build()
                .SingleAsync <Person>();

            Assert.NotNull(item);
            Assert.Equal(item.Id, 417);
            Assert.Equal(item.FirstName, "Brendan");
            Assert.Equal(item.MiddleName, "James");
            Assert.Equal(item.LastName, "Baker");
        }
        /// <summary>
        /// Generate Readers.
        /// </summary>
        /// <returns>Returns true if successful; false if unsuccessful</returns>
        public bool GenerateReader()
        {
            try
            {
                _readers = ReaderCollection.GetReaders();
                if (_readers.Count > 0)
                {
                    _reader = _readers.First <Reader>();
                }
                else
                {
                    return(false);
                }
            } catch (Exception)
            {
                return(false);
            }

            return(true);
        }
Exemple #25
0
        /// <summary>
        /// Initializes the device.
        /// </summary>
        private Reader InitDevice()
        {
            Reader activeReader = null;

            using (ReaderCollection readers = ReaderCollection.GetReaders())
            {
                foreach (var reader in readers)
                {
                    if (reader.Description.Name == Id)
                    {
                        activeReader = reader;
                        break;
                    }
                }
                if (activeReader != null)
                {
                    activeReader.Open(Constants.CapturePriority.DP_PRIORITY_COOPERATIVE);
                }
            }
            return(activeReader);
        }
Exemple #26
0
        /// <summary>
        /// The validate reader.
        /// </summary>
        /// <param name="readers">
        /// The readers.
        /// </param>
        /// <returns>
        /// The <see cref="ResultFingerprint"/>.
        /// </returns>
        private ResultFingerprint ValidateReader(ReaderCollection readers)
        {
            var resultFingerprint = new ResultFingerprint();

            if (readers.Count == 0)
            {
                resultFingerprint.Result  = false;
                resultFingerprint.Message = es_CO.WithoutReader;
                return(resultFingerprint);
            }

            if (readers.Count > 1)
            {
                resultFingerprint.Result  = false;
                resultFingerprint.Message = es_CO.MultipleReaders;
                return(resultFingerprint);
            }

            resultFingerprint.Result = true;
            return(resultFingerprint);
        }
Exemple #27
0
        public Reader IndexDevice()
        {
            Reader objSelectedReader = null;

            try
            {
                ReaderCollection objReadersList = ReaderCollection.GetReaders();

                foreach (Reader itemReader in objReadersList)
                {
                    objSelectedReader = itemReader;

                    break;
                }
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }

            return(objSelectedReader);
        }
        /// <summary>
        /// Clear the control of readers, get readers and display.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnRefresh_Click(System.Object sender, System.EventArgs e)
        {
            cboReaders.Text = string.Empty;
            cboReaders.Items.Clear();
            cboReaders.SelectedIndex = -1;

            try
            {
                _readers = ReaderCollection.GetReaders();

                foreach (Reader Reader in _readers)
                {
                    cboReaders.Items.Add(Reader.Description.SerialNumber);
                }

                if (cboReaders.Items.Count > 0)
                {
                    cboReaders.SelectedIndex = 0;
                    btnCaps.Enabled          = true;
                    btnSelect.Enabled        = true;
                }
                else
                {
                    btnSelect.Enabled = false;
                    btnCaps.Enabled   = false;
                    _sender.txtReaderSelected.Text = "";
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                //message box:
                String text = ex.Message;
                text += "\r\n\r\nPlease check if DigitalPersona service has been started";
                String caption = "Cannot access readers";
                MessageBox.Show(text, caption);
            }
        }
Exemple #29
0
        public VerificationForm(AppWindow owner)
        {
            InitializeComponent();

            //this.Dock = DockStyle.Fill;
            //this.BackColor = Color.White;

            //picVerification = new PictureBox()
            //{
            //    Location = new Point(20, 20),
            //    Size = new Size(100, 100)
            //};
            //this.Controls.Add(picVerification);

            //btnScan = new Button()
            //{
            //    Location = new Point(picVerification.Left, picVerification. Bottom + 10),
            //    Size = new Size(100, 25)
            //};
            //this.Controls.Add(btnScan);

            //this.Load += VerificationForm_Load;
            ReaderCollection rc = ReaderCollection.GetReaders();
        }
Exemple #30
0
 private void CargarLectores()
 {
     try
     {
         cboLectores.Items.Clear();
         readers = ReaderCollection.GetReaders();
         foreach (Reader rd in readers)
         {
             cboLectores.Items.Add(rd.Description.SerialNumber);
         }
         if (cboLectores.Items.Count > 0)
         {
             cboLectores.SelectedIndex = 0;
         }
     }
     catch (ArgumentOutOfRangeException ex)
     {
         Clases.CFuncionesGenerales.MensajeError("Indice fuera de rango.", ex);
     }
     catch (ArgumentNullException ex)
     {
         Clases.CFuncionesGenerales.MensajeError("No se pueden agregar argumentos nulos a un ComboBox.", ex);
     }
 }