public override void Display() { var allPersons = new List <Person>(); var i = 0; // Create missing templates foreach (var username in GetUsernames()) { var person = new Person(); person.Id = i++; var dataFolder = Path.Combine(PrintsFolderName, username); var allBitmaps = Directory.GetFiles(dataFolder, "*.bmp", SearchOption.TopDirectoryOnly).Select(Path.GetFileName); //var allPatterns = Directory.GetFiles(dataFolder, "*.min", SearchOption.TopDirectoryOnly).Select(Path.GetFileName).ToList(); foreach (var bitmapFile in allBitmaps) { //var fingerprintId = Path.GetFileNameWithoutExtension(bitmapFile); //var patternFile = $"{fingerprintId}.min"; Bitmap bitmap = new Bitmap(Path.Combine(dataFolder, bitmapFile)); Fingerprint fp = new Fingerprint(); fp.AsBitmap = bitmap; person.Fingerprints.Add(fp); } _afis.Extract(person); allPersons.Add(person); } var device = new DeviceAccessor().AccessFingerprintDevice(); device.FingerDetected += (sender, args) => { device.StopFingerDetection(); Output.WriteLine("Finger detected, dont remove"); var readFingerprint = device.ReadFingerprint(); Output.WriteLine("Finger captured. Validation in progress"); ValidateFingerprint(readFingerprint, allPersons); device.StartFingerDetection(); }; device.StartFingerDetection(); Output.WriteLine("Please place your finger on the device or press enter to cancel"); Input.ReadString(string.Empty); device.Dispose(); this.Program.NavigateBack(); }
public override void Display() { base.Display(); var device = new DeviceAccessor().AccessFingerprintDevice(); device.FingerDetected += (sender, args) => { HandleNewFingerprint(device.ReadFingerprint()); }; device.StartFingerDetection(); Output.WriteLine("Please place your finger on the device or press enter to cancel"); Input.ReadString(string.Empty); device.Dispose(); this.Program.NavigateBack(); }
static void Main(string[] args) { Console.WriteLine("LibScanApi Demo"); var accessor = new DeviceAccessor(); using (var device = accessor.AccessFingerprintDevice()) { device.SwitchLedState(false, false); device.FingerDetected += (sender, eventArgs) => { Console.WriteLine("Finger Detected!"); device.SwitchLedState(true, false); // Save fingerprint to temporary folder var fingerprint = device.ReadFingerprint(); var tempFile = Path.GetTempFileName(); var tmpBmpFile = Path.ChangeExtension(tempFile, "bmp"); fingerprint.Save(tmpBmpFile); Console.WriteLine("Saved to " + tmpBmpFile); }; device.FingerReleased += (sender, eventArgs) => { Console.WriteLine("Finger Released!"); device.SwitchLedState(false, true); }; Console.WriteLine("FingerprintDevice Opened"); device.StartFingerDetection(); device.SwitchLedState(false, true); Console.ReadLine(); Console.WriteLine("Exiting..."); device.SwitchLedState(false, false); } }
static void Main(string[] args) { Console.WriteLine("LibMifareApi Demo"); Console.WriteLine($"Last error {LibMifareApi.ftrMFGetLastError()}"); var accessor = new DeviceAccessor(); using (var device = accessor.AccessCardReader()) { device.CardDetected += (sender, eventArgs) => { Console.WriteLine($"Card available. Type: {eventArgs.Type.ToString()}, SN: {eventArgs.SerialNumber:D}, 0x{eventArgs.SerialNumber:X8}"); }; device.CardRemoved += (sender, eventArgs) => Console.WriteLine("Card removed"); device.StartCardDetection(); Console.WriteLine("Card detection has started, please place card on device or hit enter to quit"); Console.ReadLine(); } }
static void Main(string[] args) { Console.WriteLine("Accessing device"); var da = new DeviceAccessor(); var fp = da.AccessFingerprintDevice(); var cr = da.AccessCardReader(); fp.FingerDetected += (sender, eventArgs) => Console.WriteLine("Finger detected!"); cr.CardDetected += (sender, eventArgs) => Console.WriteLine($"Card detected: {eventArgs.SerialNumber:X10}"); fp.FingerReleased += (sender, eventArgs) => Console.WriteLine("Finger released"); cr.CardRemoved += (sender, eventArgs) => Console.WriteLine("Card removed"); fp.StartFingerDetection(); cr.StartCardDetection(); Console.WriteLine("Detection of FP and Card has started."); Console.ReadLine(); Console.WriteLine("Closing device. Please wait"); fp.Dispose(); cr.Dispose(); }