private void Window_Loaded(object sender, RoutedEventArgs e) //At the beginning of the program the details will be read from the XML file { if (File.Exists(path)) { Xslm xmlConnection = new Xslm(path); mybooks = xmlConnection.Read(); listBoxbooks.ItemsSource = mybooks; } }
private void Window_Closing_1(object sender, System.ComponentModel.CancelEventArgs e) //When you close the program, the details are saved to the XML file { if (mybooks.Count > 0) { Xslm xmlConnection = new Xslm(path); xmlConnection.Write(mybooks); } else { File.Delete(path); } }