/* Pre: * Expects a fingerprint for person recognition */ public void Visit(FingerprintScanner scanner) { if (scanner == null) { return; } int id = scanner.ScanFinger(); PersonIdentity recognisedPerson = new PersonIdentity { identity = 0, name = "" }; for (int i = 0; i < PersonIdentities.Length; i++) { if (PersonIdentities[i].identity == id) { recognisedPerson = PersonIdentities[i]; break; } } if (recognisedPerson.identity == 0) { MessageBox.Show("Mobile app: The fingerprint is not recognised"); } else { MessageBox.Show("Mobile app: Welcome home, " + recognisedPerson.name); } }
/* Pre: * Shows the scanner's result */ public void Visit(FingerprintScanner scanner) { if (scanner == null) { return; } int id = scanner.ScanFinger(); MessageBox.Show("Diagnostics: received identity from scanner: " + id); }