async private void teacherSignInClick(object sender, EventArgs e) { /// <summary> /// Subroutine that signs a teacher into their account. It sends GET /teacher/<username>?username=True /// </summary> string username = usernameTextBox.Text; string password = passwordTextBox.Text; flushTextBoxes(); if (checkBox1.Checked == true) { MessageBox.Show("Teachers cannot use the first time sign-in feature, and should enter their password."); return; } if (username == "" || password == "") { MessageBox.Show("Username or password cannot be left blank!"); return; // Do not execute more of the subroutine } string credentials = WebRequestHandler.ConvertToBase64(username + ":" + password); APIHandler.SetAuthorizationHeader(credentials); if (await APIHandler.IsUserValid(UserType.Teacher, username, password)) { Teacher teacher = await APIHandler.GetTeacher(username : username); closedByProgram = true; // Set boolean to prevent Application.Exit() call this.Close(); // Close current form FormController.teacherMain = new TeacherMainForm(teacher); // Open the new form } else { MessageBox.Show("Your account doesn't exist."); } }