public void LoadConfig(XDocument xDoc) { HistoryLines.Clear(); var xHistory = xDoc.Descendants(XName.Get("History")).FirstOrDefault(); if (xHistory != null) { foreach (var xHistoryLine in xHistory.Elements(XName.Get("HistoryLine"))) { var xAttrText = xHistoryLine.Attribute(XName.Get("Text")); var xAttrDate = xHistoryLine.Attribute(XName.Get("Date")); DateTime date; if (xAttrText != null && xAttrDate != null && DateTime.TryParse(xAttrDate.Value, out date)) { HistoryLines.Add(new ConsoleHistoryLine(this, xAttrText.Value, date)); } } } mHistoryLineCurrIdx = HistoryLines.Count; }
public void AddToHistory(string text) { HistoryLines.Add(new ConsoleHistoryLine(this, text, DateTime.Now)); mHistoryLineCurrIdx = HistoryLines.Count; }