//Creates a new Userdata object when button is clicked private void Submission_Button_Click(object sender, RoutedEventArgs e) { //Checks if data entered is correct if (validate.CheckIfValidUserdata(availableKeysList, usedKeysList, firstNameTextBox, lastNameTextBox, emailTextBox, phoneTextBox, datePicker, serialNumberTextBox, serial)) { userdata = new UserData(firstNameTextBox.Text, lastNameTextBox.Text, emailTextBox.Text, phoneTextBox.Text, datePicker.Date.ToString(), serialNumberTextBox.Text); //Adds used key to keep track if available keys usedKeysList.Add(userdata.SerialNumber); //Prints a success message popup.PrintSuccessfulUserdataMessage(userdata); //SaveUserdataToXML(userdata); data.WriteUserdataToXML("data", typeof(UserData), userdata, userdata.FirstName, userdata.LastName, userdata.Email, userdata.Phone, userdata.Birthday, userdata.SerialNumber); ClearTextBoxes(); //RemoveSerialKey(); } }