protected async void OnTryAuthentication(object sender, EventArgs e) { // Disable Inputs and show "logging in" form.SetLoginState(); // Attempt Authentication with InaraAPI if (await api.Authenticate(form.User, form.Pass)) { // Successful; update credentials and close the form state.UpdateInaraCreds( form.User, form.Pass, api.cmdrName); state.Persist(); form.Close(); } else { // Failure; enable inputs and show error form.ErrorLabel = api.lastError; form.SetUserInputState(); } }