private void addSkillButton_Click(object sender, EventArgs e) { textValue = addSkillTextBox.Text; creativeValue = creativeStatus; strengthValue = strengthStatus; intellectValue = intellectStatus; foreach (Skill skill in dataManager.data) { if ((skill.name == textValue || (textValue.Replace(" ", "").Length <= 0))) { DuplicateEmptyPopup duplicateEmptyPopup = new DuplicateEmptyPopup(); duplicateEmptyPopup.Owner = this; duplicateEmptyPopup.Show(); return; } } if (intellectValue || strengthValue || creativeValue) { DialogResult = true; Close(); } else { CategoryPopup categoryPopup = new CategoryPopup(); categoryPopup.Owner = this; categoryPopup.Show(); } }
private void applyButton_Click(object sender, RoutedEventArgs e) { HashSet <String> skillSet = new HashSet <String>(); List <String> stringList = new List <String>(); foreach (Canvas skillContainer in editSkillsContainerCanvas.Children.OfType <Canvas>()) { List <TextBox> textBoxList = skillContainer.Children.OfType <TextBox>().ToList(); TextBox textBox = textBoxList[0]; String newSkillName = textBox.Text.ToLower().Replace(" ", ""); skillSet.Add(newSkillName); stringList.Add(newSkillName); if (newSkillName.Length == 0) { DuplicateEmptyPopup dialog = new DuplicateEmptyPopup(); dialog.Owner = this; dialog.Show(); return; } } if (skillSet.Count != stringList.Count) { DuplicateEmptyPopup dialog = new DuplicateEmptyPopup(); dialog.Owner = this; dialog.Show(); return; } foreach (Canvas skillContainer in editSkillsContainerCanvas.Children.OfType <Canvas>()) { List <TextBox> textBoxList = skillContainer.Children.OfType <TextBox>().ToList(); TextBox textBox = textBoxList[0]; String newSkillName = textBox.Text; String identifier = (String)skillContainer.Tag; dataManager.update_name(newSkillName, identifier); } foreach (String identifier in skillsToDelete) { dataManager.remove_data(identifier); } DialogResult = true; Close(); }