Guest User

Untitled

a guest
Dec 10th, 2019
90
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private void LoadDataFromXML()
  2. {
  3. List<Movie> movieList = new List<Movie>();
  4. try
  5. {
  6.  
  7. using (var sr = new StreamReader(defaultFileLocation))
  8. {
  9. var deserializer = new XmlSerializer(typeof(List<Movie>));
  10. movieList = (List<Movie>)deserializer.Deserialize(sr);
  11. }
  12.  
  13. }
  14. catch (Exception ex)
  15. {
  16. var msg = ex.Message;
  17. }
  18.  
  19. if (movieList.Count != 0)
  20. {
  21. Data.MovieList = new System.Collections.ObjectModel.ObservableCollection<Movie>(movieList);
  22. }
  23. }
RAW Paste Data