private void Open_Click(object sender, EventArgs e) { if (checkChanged()) { openFileDialog1.InitialDirectory = selectedFolder; openFileDialog1.Filter = "Text files (*.txt) | *.txt | All files(*.*) | *.*"; openFileDialog1.FileName = excuse.Text + ".txt"; DialogResult result = openFileDialog1.ShowDialog(); if (result == DialogResult.OK) { currentExcuse = new Excuse(openFileDialog1.FileName); updateForm(false); } } }
private void Random_Click(object sender, EventArgs e) { string[] fileNames = Directory.GetFiles(selectedFolder, "*.txt"); if (fileNames.Length == 0) { MessageBox.Show("Please specify a folder with excuse files in it", "No excuse files found"); } else { if (checkChanged()) { currentExcuse = new Excuse(random, selectedFolder); updateForm(false); } } }