private void btnClockIn_Click(object sender, System.Windows.RoutedEventArgs e) { if (!(txtStudentID.Text == "xadminx")) { try { int studentID = int.Parse(txtStudentID.Text); if (clockInAnimationEnded) { if (StudentDB.IsValidStudentID(studentID)) { if (StudentDB.StudentClockIn(studentID, currentClassID)) { txtStudentID.Text = ""; clockInAnimationEnded = false; ClockInAnimation(studentID); } else { MessageBox.Show("Could not log student in."); txtStudentID.Text = ""; } } else { MessageBox.Show("Please enter a valid student ID"); txtStudentID.Text = ""; } } } catch (FormatException) { MessageBox.Show("Student ID must be in numbers."); txtStudentID.Text = ""; } } else { AdminPanel adminPanel = new AdminPanel(); adminPanel.mainWindow = this; txtStudentID.Text = ""; adminPanel.ShowDialog(); } }