private void btnRandom_Click(object sender, EventArgs e) { if (CheckChanged()) { currentExcuse = new Excuse(random, selectedFolder); UpdateForm(false); } }
private void btnOpen_Click(object sender, EventArgs e) { lblFileDate.Text = DateTime.Now.ToString(); openFileDialog1.InitialDirectory = selectedFolder; openFileDialog1.Filter = "Class Excuse (*.excuse)|*.excuse|All files(*.*)|*.*"; openFileDialog1.Title = "Open file"; if (openFileDialog1.ShowDialog() == DialogResult.OK) { currentExcuse = new Excuse(openFileDialog1.FileName); UpdateForm(false); } }
public void OpenFile(string file) { this.ExcusePath = file; BinaryFormatter binary = new BinaryFormatter(); using (FileStream input = File.OpenRead(file + @"\Excuse")) { Excuse newExcuse = (Excuse)binary.Deserialize(input); Description = newExcuse.Description; Results = newExcuse.Results; LastUsed = newExcuse.LastUsed; } }