private void addCategoryButton_Click(object sender, System.EventArgs e) { AddItem newItemDialog = new AddItem("Category"); if (newItemDialog.ShowDialog(this) == DialogResult.OK) { String newCategoryName = newItemDialog.ItemName; if (m_initialised && AssetTagging.AssetTagging_CategoryExists(newCategoryName, (String)projectSelectionComboBox.SelectedItem) > 0) { MessageBox.Show("Category with that name already exists!", "Add category error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } AddNewCategory(newCategoryName); UpdateCategoriesList(); categoryListBox.SelectedItem = newCategoryName; } }
private void addProjectButton_Click(object sender, EventArgs e) { AddItem newItemDialog = new AddItem("Project"); if (newItemDialog.ShowDialog(this) == DialogResult.OK) { String newProjectName = newItemDialog.ItemName; if (m_initialised) { if (AssetTagging.AssetTagging_ProjectExists(newProjectName) > 0) { MessageBox.Show("Project with that name already exists!", "Add tag error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } AssetTagging.AssetTagging_CreateProject(newProjectName); projectSelectionComboBox.Items.Add(newProjectName); projectSelectionComboBox.SelectedIndex = projectSelectionComboBox.Items.IndexOf(newProjectName); } } }
private void addTagButton_Click(object sender, EventArgs e) { if (categoryListBox.SelectedItem == null) return; String categoryString = (String)categoryListBox.SelectedItem; AddItem newItemDialog = new AddItem("Tag"); if (newItemDialog.ShowDialog(this) == DialogResult.OK) { String newTagName = newItemDialog.ItemName; if (m_initialised && AssetTagging.AssetTagging_TagExists(newTagName, categoryString, (String)projectSelectionComboBox.SelectedItem) > 0) { MessageBox.Show("Tag with that name already exists!", "Add tag error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } AddNewTag(newTagName, categoryString); UpdateTagList(); tagListBox.SelectedItem = newTagName; } }