private void SaveButton_Click(object sender, RoutedEventArgs e) { if (FirstNameTextBox.Text != Contact.FirstName) { Contact.FirstName = FirstNameTextBox.Text; } if (MiddleNameTextBox.Text != Contact.MiddleName) { Contact.MiddleName = MiddleNameTextBox.Text; } if (LastNameTextBox.Text != Contact.LastName) { Contact.LastName = LastNameTextBox.Text; } if (EmailTextBox.Text != Contact.Email) { Contact.Email = EmailTextBox.Text; } if (PhoneTextBox.Text != Contact.PhoneNumber) { Contact.PhoneNumber = PhoneTextBox.Text; } if (HasIconCheckBox.IsChecked != Contact.HasIcon) { Contact.HasIcon = (bool)HasIconCheckBox.IsChecked; } if (!string.IsNullOrWhiteSpace(FirstNameTextBox.Text)) { ContactHandler.SaveContact(Contact); Close(); if (Contact.HasIcon) { MessageBox.Show($"Place your Icon to '{Directory.GetParent(Contact.Icon)}' and name it '{Contact.LastName}_{Contact.FirstName}.png'", "Icon", MessageBoxButton.OK, MessageBoxImage.Information); } } else { MessageBox.Show("You Cannot save an empty contact!\nAdd at least 'First Name'.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); } }