private void buttonAddColorSet_Click(object sender, EventArgs e) { using (TextDialog textDialog = new TextDialog("New Color Set name?", "New Color Set")) { if (textDialog.ShowDialog() == DialogResult.OK) { string newName = textDialog.Response; if (_data.ContainsColorSet(newName)) { MessageBox.Show("Color Set already exists."); return; } ColorSet newcs = new ColorSet(); _data.SetColorSet(newName, newcs); UpdateGroupBoxWithColorSet(newName, newcs); UpdateColorSetsList(); } } }
private void buttonAddColorSet_Click(object sender, EventArgs e) { using (TextDialog textDialog = new TextDialog("New Color Set name?", "New Color Set")) { if (textDialog.ShowDialog() == DialogResult.OK) { string newName = textDialog.Response; if (_data.ContainsColorSet(newName)) { //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible) MessageBoxForm.msgIcon = SystemIcons.Error; //this is used if you want to add a system icon to the message form. var messageBox = new MessageBoxForm("Color Set already exists.", "Error", false, false); messageBox.ShowDialog(); return; } ColorSet newcs = new ColorSet(); _data.SetColorSet(newName, newcs); UpdateGroupBoxWithColorSet(newName, newcs); UpdateColorSetsList(); } } }