@@ -315,44 +315,20 @@ private string getFirmwareVersion(string deviceInstanceId)
315
315
316
316
private void IdentifyTheKeyLED_Click ( object sender , EventArgs e )
317
317
{
318
- // Close existed session if any.
319
- if ( _session . IsValid )
318
+ try
320
319
{
321
- WinBio . CloseSession ( _session ) ;
322
- _session . Invalidate ( ) ;
320
+ WinBioRejectDetail rejectDetail ;
321
+ Log ( string . Format ( "Please touch session: unit id {0} in flashing" , _unitId ) ) ;
322
+ WinBio . EnrollBegin ( _session , WinBioBiometricSubType . LhThumb , _unitId ) ;
323
+ WinBio . EnrollCapture ( _session , out rejectDetail ) ;
324
+ WinBio . EnrollDiscard ( _session ) ;
325
+ Log ( string . Format ( "Done" ) ) ;
323
326
}
324
-
325
- Guid DatabaseId = Guid . Parse ( "BC7263C3-A7CE-49F3-8EBF-D47D74863CC6" ) ;
326
- //Guid DatabaseId = Guid.Parse("19feb8c6-fd8d-446f-8de2-ce45b315e27a");
327
-
328
- if ( WinBioConfiguration . DatabaseExists ( DatabaseId ) )
329
- WinBioConfiguration . RemoveDatabase ( DatabaseId ) ;
330
- WinBioConfiguration . AddDatabase ( DatabaseId , _unitId ) ;
331
- WinBioConfiguration . AddUnit ( DatabaseId , _unitId ) ;
332
-
333
- ThreadPool . QueueUserWorkItem ( delegate
327
+ catch ( WinBioException ex )
334
328
{
335
- Log ( string . Format ( "Please touch session: unit id {0} in flashing" , _unitId ) ) ;
336
- try
337
- {
338
- _session = WinBio . OpenSession ( WinBioBiometricType . Fingerprint , WinBioPoolType . Private , WinBioSessionFlag . Basic , new [ ] { _unitId } , DatabaseId ) ;
339
- _unitId = WinBio . LocateSensor ( _session ) ;
340
- Log ( string . Format ( "Sensor located: unit id {0}" , _unitId ) ) ;
341
- setComboxSelectedIndex ( comboUnitId , comboUnitId . Items . IndexOf ( _unitId ) ) ;
342
- }
343
- catch ( WinBioException ex )
344
- {
345
- Log ( ex ) ;
346
- }
329
+ //ignore
330
+ }
347
331
348
- // Close this and reopen a generic one.
349
- if ( _session . IsValid )
350
- {
351
- WinBio . CloseSession ( _session ) ;
352
- _session . Invalidate ( ) ;
353
- }
354
- _session = WinBio . OpenSession ( WinBioBiometricType . Fingerprint , WinBioPoolType . System , WinBioSessionFlag . Default , null , 0 ) ;
355
- } ) ;
356
332
}
357
333
}
358
334
}
0 commit comments