Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
 public async Task UpdateFaceCaptured(ImageAnalyzer img)
 {
     customerFace = img;
     if (IsRegistrationMode)
     {
         UpdateRegistrationStatus();
         if (img != null)
         {
             PauseCamera?.Invoke(this, EventArgs.Empty);
         }
     }
     else
     {
         await SignIn();
     }
 }
Esempio n. 3
0
 private void Awake()
 {
     instance = this;
 }