public string GetFlightData() { DisplayFlight displayFlight = InfoModel.Instance.DF; InfoModel.Instance.ReadOnce(); return(ToXml(displayFlight)); }
public string LoadFlightData() { DisplayFlight displayFlight = InfoModel.Instance.DF; //only load the file to the List at the first time that the function is called if (InfoModel.Instance.flightData == null) { InfoModel.Instance.LoadFlightDataFromFile(); } InfoModel.Instance.UpdateFlightDataInDisplayFlight(); return(ToXml(displayFlight)); }
/* * Writes all data to a xml file. */ private string ToXml(DisplayFlight display) { //Initiate XML stuff StringBuilder sb = new StringBuilder(); XmlWriterSettings settings = new XmlWriterSettings(); XmlWriter writer = XmlWriter.Create(sb, settings); writer.WriteStartDocument(); writer.WriteStartElement("Displays"); display.ToXml(writer); writer.WriteEndElement(); writer.WriteEndDocument(); writer.Flush(); return(sb.ToString()); }