public ActivitiesPage(AdminDashboard adminDashboard) { InitializeComponent(); this.adminDashboard = adminDashboard; this.database = adminDashboard.database; PopulateActiviesPanel("SELECT * FROM activities"); }
private void OnCaptured(CaptureResult captureResult) { try { if (!fingerprintReader.CheckCaptureResult(captureResult)) { return; } DataResult <Fmd> resultConversion = FeatureExtraction.CreateFmdFromFid(captureResult.Data, Constants.Formats.Fmd.ANSI); if (captureResult.ResultCode != Constants.ResultCode.DP_SUCCESS) { fingerprintReader.CurrentReader.Reset(); throw new Exception(captureResult.ResultCode.ToString()); } // See the SDK documentation for an explanation on threshold scores. int thresholdScore = DPFJ_PROBABILITY_ONE * 1 / 100000; if (isAdminLogin) { IdentifyResult identifyResult = Comparison.Identify(resultConversion.Data, 0, AdminFingerPrints.ToArray(), thresholdScore, AdminFingerPrints.Count); if (identifyResult.ResultCode != Constants.ResultCode.DP_SUCCESS) { throw new Exception(identifyResult.ResultCode.ToString()); } if (identifyResult.Indexes.Length > 0) { fingerprintReader.CancelCaptureAndCloseReader(this.OnCaptured); Application.Current.Dispatcher.Invoke((Action) delegate { AdminDashboard adminDashboard = new AdminDashboard(); adminDashboard.CurrentAdminId = AdminId.ElementAt(identifyResult.Indexes[0][0]); adminDashboard.Show(); fingerprintReader.CurrentReader.Dispose(); fingerprintReader.CurrentReader = null; this.Close(); }); } } else { IdentifyResult identifyResult = Comparison.Identify(resultConversion.Data, 0, StudenFingerPrints.ToArray(), thresholdScore, StudenFingerPrints.Count); if (identifyResult.ResultCode != Constants.ResultCode.DP_SUCCESS) { throw new Exception(identifyResult.ResultCode.ToString()); } if (identifyResult.Indexes.Length > 0) { fingerprintReader.CancelCaptureAndCloseReader(this.OnCaptured); Application.Current.Dispatcher.Invoke((Action) delegate { StudentDashboard studentDash = new StudentDashboard(StudentId.ElementAt(identifyResult.Indexes[0][0]).ToString(), database); studentDash.Show(); fingerprintReader.CurrentReader.Dispose(); fingerprintReader.CurrentReader = null; this.Close(); }); } } } catch (Exception) { Application.Current.Dispatcher.Invoke((Action) delegate { ErrorHeader1.Text = "Fingerprint device error"; ErrorContent1.Text = "Error while capturing the fingerprint."; DialogMessage1.IsOpen = true; }); } }