Skip to content

Commit e40f850

Browse files
committed
To use Enroll fucntions in IdentifyTheKeyLED_Click.
Previous method will require admin right.
1 parent 77c7511 commit e40f850

File tree

1 file changed

+10
-34
lines changed

1 file changed

+10
-34
lines changed

WindowsFormsTest/WinBioForm.cs

Lines changed: 10 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -315,44 +315,20 @@ private string getFirmwareVersion(string deviceInstanceId)
315315

316316
private void IdentifyTheKeyLED_Click(object sender, EventArgs e)
317317
{
318-
// Close existed session if any.
319-
if (_session.IsValid)
318+
try
320319
{
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"));
323326
}
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)
334328
{
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+
}
347331

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-
});
356332
}
357333
}
358334
}

0 commit comments

Comments
 (0)