private async void allowAccessButtonClicked(object sender, RoutedEventArgs e) { if (usersNotAllowedDropdown.SelectedItem == null) { Synthesizer.Speak("Please select the user you want to allow in the room."); } else { String[] userInfo = usersNotAllowedDropdown.SelectedItem.ToString().Split(','); ContentDialog deleteUserDialog = new ContentDialog { Title = "Are you sure you want to allow " + userInfo[1] + " in the room?", PrimaryButtonText = "Yes", SecondaryButtonText = "Cancel", }; ContentDialogResult result = await deleteUserDialog.ShowAsync(); if (result == ContentDialogResult.Primary) { SqliteTransactions.ModifyAccessByUserId(userInfo[0], true); LoadUsers(); } else { deleteUserDialog.Hide(); } } }
private async void verificationButtonClicked(object sender, RoutedEventArgs e) { if (!newUser) { progressRing.IsActive = true; Verification verificationResult = await verificationController.VerifySpeaker(speakerID); progressRing.IsActive = false; if (verificationResult != null) { if (verificationResult.Result.ToString().Equals("Accept") && (verificationResult.Confidence.ToString().Equals("High") || verificationResult.Confidence.ToString().Equals("Normal"))) { if (!isAdmin) { if (user.access) { Synthesizer.Speak("Please come on in."); //OPEN DOOR MainPage.DLPin.Write(Windows.Devices.Gpio.GpioPinValue.High); await Task.Delay(10000); MainPage.DLPin.Write(Windows.Devices.Gpio.GpioPinValue.Low); this.Frame.GoBack(); } else { Synthesizer.Speak("I am sorry " + user.firstName + ", you are not allowed in this room. You should contact the Administrator."); this.Frame.GoBack(); } } else { Synthesizer.Speak("Opening Administrator page."); this.Frame.Navigate(typeof(AdminPage)); } } else { failedVerifications++; if (failedVerifications < 3) { Synthesizer.Speak("I am sorry Dave, I'm afraid I cannot do that."); } else { SqliteTransactions.ModifyAccessByUserId(user.userId, false); Synthesizer.Speak("For security purposes, I have to deny your access to the room. You should contact the Administrator."); this.Frame.GoBack(); } } } } else { Synthesizer.Speak("I need you to record your voice first."); } }