private void button1_Click(object sender, EventArgs e) { var input = ""; TextInputForm textDialog = new TextInputForm(); textDialog.label1.Text = "Enter blacklist word"; if (textDialog.ShowDialog(this) == DialogResult.OK) { input = textDialog.textBox1.Text; } textDialog.Dispose(); if (input == "") { MessageBox.Show("invalid word"); return; } if (BlackList.IndexOf(input) > -1) { MessageBox.Show($"\"{input}\" already exists in blacklist"); } else { BlackList.Add(input); listBox1.DataSource = new List <string>(); listBox1.DataSource = BlackList; File.WriteAllLines("BlackList.txt", BlackList); } }
private void onNewFileList_Click(object sender, EventArgs e) { var input = ""; TextInputForm textDialog = new TextInputForm(); textDialog.label1.Text = "Enter blacklist word"; if (textDialog.ShowDialog(this) == DialogResult.OK) { input = textDialog.textBox1.Text; } textDialog.Dispose(); if (input == "") { return; } if (File.Exists(@"output\" + input + ".xml")) { MessageBox.Show($"File \"{input}.xml\" already exists", "New List", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { programSettings.CurrentXMLFile = input; programSettings.Save(); readList(); readOutputFiles(); } }