private async void button_Click(object sender, RoutedEventArgs e) { try { WebhostAPICall.AuthenticationInfo info = await WebhostAPICall.AuthenticateAsync(userNameInput.Text, passwordBox.Password); OnResponseSuccess(info, new EventArgs()); } catch (UnauthorizedAccessException ex) { OnResponseFailure(ex, new EventArgs()); } }
private async void LoginControl_OnAuthenticate(object sender, EventArgs e) { WebhostAPICall.AuthenticationInfo response = (WebhostAPICall.AuthenticationInfo)sender; if (response.Fingerprint.Length > 0) { var messageDialog = new Windows.UI.Popups.MessageDialog("Authentication Successful."); await messageDialog.ShowAsync(); passwordBox.Password = ""; // Continue on to the rest of the program from here. // this line is a simplified check to make sure the event handler is not null and then invoke if it has a handler. OnAuthenticationCompleted?.Invoke(response, e); } else { var messageDialog = new Windows.UI.Popups.MessageDialog("Authentication returned a blank fingerprint."); await messageDialog.ShowAsync(); passwordBox.Password = ""; } }