Esempio n. 1
0
 public void LoadItems()
 {
     var today = DateTime.Now.Date;
     var fileName = GetFileName(today, FileNameType.Default);
     try
     {
         using (var stream = new FileStream(fileName, FileMode.Open))
         {
             var reader = new XmlSerializer(typeof(ObservableCollection<WorkItem>));
             var items = reader.Deserialize(stream) as ObservableCollection<WorkItem>;
             WorkItems.Clear();
             var factory = new ViewModelFactory();
             foreach (var item in factory.Convert<WorkItem, WorkItemVM>(items))
             {
                 WorkItems.Add(item);
             }
         }
     }
     catch (FileNotFoundException)
     {
         // We've got new work day :)
     }
 }