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); }
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); } }
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); } }
public FaultOverview(MachineCatalogue mc) { _machines = mc; }