// Saves when the form closes private void employeeAdd_FormClosed(object sender, FormClosedEventArgs e) { Form1.currentStaff = original; SaveToFile.serializeAll(); if (action == 1 && Form1.currentStaff.Count > 0) { employeeSelect eS = new employeeSelect(); eS.ShowDialog(); } }
// When form is closing private void Form1_FormClosed(object sender, FormClosedEventArgs e) { if (Form1.currentStaff.Count == 0) { File.Delete(filepath + "\\Employees.xml"); } SaveToFile.serializeAll(); // Perform backup if necessary backupFunction.performBackup(filepath); }
// Saves to a file private void saveButton_Click(object sender, EventArgs e) { SaveToFile.serializeAll(); }