public async Task SignIn() { try { // 1. Try to identify the person await customerFace.DetectFacesAsync(); await customerFace.IdentifyFacesAsync(); // TODO: consider looping over identified persons to find matching DB record customerInfo = new CustomerRegistrationInfo(); customerInfo.CustomerFaceHash = customerFace.IdentifiedPersons.First().Person.PersonId.ToString(); customerInfo.CustomerName = customerFace.IdentifiedPersons.First().Person.Name; // 2. Try to obtain customer info from DB CustomerInfo dbCustomerInfo = IgniteDataAccess.GetCustomerInfo(customerInfo.CustomerFaceHash); customerInfo.RegistrationDate = dbCustomerInfo.PreviousVisitDate; // 3. Update status StatusText = $"Welcome, {customerInfo.CustomerName}!"; StatusTextColor = Util.ToBrush("green"); PauseCamera?.Invoke(this, EventArgs.Empty); } catch (Exception) { customerInfo = null; StatusText = "Please try again."; StatusTextColor = Util.ToBrush("red"); ResumeCamera?.Invoke(this, EventArgs.Empty); } }
public async Task UpdateFaceCaptured(ImageAnalyzer img) { customerFace = img; if (IsRegistrationMode) { UpdateRegistrationStatus(); if (img != null) { PauseCamera?.Invoke(this, EventArgs.Empty); } } else { await SignIn(); } }