private void InitialStart() { // Stop Windows Biometric Service to apply changes RestartService("WbioSrvc", 5000, ServiceMode.Stop); var databases = WinBio.EnumDatabases(WinBioBiometricType.Fingerprint); Console.WriteLine("Found {0} databases", databases.Length); for (var i = 0; i < databases.Length; i++) { Console.WriteLine("DatabaseId {0}: {1}", i, databases[i].DatabaseId); } if (WinBioConfiguration.DatabaseExists(DatabaseId)) { Console.WriteLine("Removing database: {0}", DatabaseId); WinBioConfiguration.RemoveDatabase(DatabaseId); } // Start Windows Biometric Service to apply changes RestartService("WbioSrvc", 5000, ServiceMode.Start); Console.WriteLine("Creating database: {0}", DatabaseId); WinBioConfiguration.AddDatabase(DatabaseId, _unitId); Console.WriteLine("Adding sensor to the pool: {0}", _unitId); WinBioConfiguration.AddUnit(DatabaseId, _unitId); // Restart Windows Biometric Service to apply changes RestartService("WbioSrvc", 5000, ServiceMode.Restart); Log("Successfully recreated database."); OpenBiometricSession(); }
public void InitialStart() { if (WinBioConfiguration.DatabaseExists(DatabaseId)) { return; } Messages.Items.Add(string.Format("Creating database: {0}", DatabaseId)); WinBioConfiguration.AddDatabase(DatabaseId, UnitId); Messages.Items.Add(string.Format("Adding sensor to the pool: {0}", UnitId)); WinBioConfiguration.AddUnit(DatabaseId, UnitId); // Restart Windows Biometric Service to apply changes Messages.Items.Add("Restart Service WbioSrvc"); RestartService("WbioSrvc", 5000, ServiceMode.Restart); }
public static void Main() { try { var units = WinBio.EnumBiometricUnits(WinBioBiometricType.Fingerprint); Console.WriteLine("Found {0} units", units.Length); if (units.Length == 0) { return; } var unit = units[0]; var unitId = unit.UnitId; Console.WriteLine("Using unit id: {0}", unitId); Console.WriteLine("Device instance id: {0}", unit.DeviceInstanceId); var databases = WinBio.EnumDatabases(WinBioBiometricType.Fingerprint); Console.WriteLine("Found {0} databases", databases.Length); for (var i = 0; i < databases.Length; i++) { Console.WriteLine("DatabaseId {0}: {1}", i, databases[i].DatabaseId); } if (WinBioConfiguration.DatabaseExists(DatabaseId)) { Console.WriteLine("Removing database: {0}", DatabaseId); WinBioConfiguration.RemoveDatabase(DatabaseId); } Console.WriteLine("Creating database: {0}", DatabaseId); WinBioConfiguration.AddDatabase(DatabaseId, unitId); Console.WriteLine("Adding sensor to the pool: {0}", unitId); WinBioConfiguration.AddUnit(DatabaseId, unitId); Console.WriteLine("Opening biometric session"); var session = WinBio.OpenSession(WinBioBiometricType.Fingerprint, WinBioPoolType.Private, WinBioSessionFlag.Basic, new[] { unitId }, DatabaseId); try { Console.WriteLine("Type sub type and press enter:"); WinBioBiometricSubType subType; if (!Enum.TryParse(Console.ReadLine(), true, out subType)) { Console.WriteLine("Invalid sub type"); return; } var identity = AddEnrollment(session, unitId, subType); Console.WriteLine("Identity: {0}", identity); Console.WriteLine(); var enrollments = WinBio.EnumEnrollments(session, unitId, identity); Console.WriteLine("Found {0} enrollments for that identity:", enrollments.Length); foreach (var enrollment in enrollments) { Console.WriteLine(enrollment); } Console.WriteLine(); Console.WriteLine("Verify identity with any finger:"); WinBioRejectDetail rejectDetail; WinBio.Verify(session, identity, WinBioBiometricSubType.Any, out unitId, out rejectDetail); Console.WriteLine("Success"); } finally { Console.WriteLine("Closing biometric session"); WinBio.CloseSession(session); } } catch (Exception ex) { Console.WriteLine("Exception: " + ex.GetType().Name); Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); } }