예제 #1
0
 public CatalogueViewModel()
 {
     if (Machines == null)
     {
         Machines = _rw.Read("data");
     }
     if (Machines == null)
     {
         Machines = new MachineCatalogue();
     }
     this.AddPageCommand = new RelayCommand(ChangeToAddPage);
     this.BackCommand    = new RelayCommand(Back);
     this.DetailsCommand = new RelayParameterizedCommand(ChangeToDetailsPage);
 }
예제 #2
0
 public static bool Write(MachineCatalogue mc, string filename)
 {
     try
     {
         XmlSerializer x = new XmlSerializer(typeof(MachineCatalogue));
         using (FileStream fs = File.Create(filename))
             x.Serialize(fs, mc);
         return(true);
     }
     catch (IOException)
     {
         return(false);
     }
 }
예제 #3
0
        public static MachineCatalogue Read(String filename)
        {
            MachineCatalogue mc = new MachineCatalogue();

            try
            {
                XmlSerializer x = new XmlSerializer(typeof(MachineCatalogue));
                using (FileStream fs = File.Open(filename, FileMode.Open))
                    mc = (MachineCatalogue)x.Deserialize(fs);

                return(mc);
            }
            catch
            {
                return(mc);
            }
        }
예제 #4
0
 public FaultOverview(MachineCatalogue mc)
 {
     _machines = mc;
 }