|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
namespace Calculator
{
public class CalcConfig
{
public CommonUtils.HistoryList InputHistory {get; set;}
public CommonUtils.HistoryList VariablesHistory {get; set;}
public CommonUtils.EquationStack Stack {get; private set;}
public GraphItemCollection GraphItems {get; private set;}
public GraphCanvasConfig CanvasConfig {get; private set;}
public CalcConfig()
{
InputHistory = new CommonUtils.HistoryList();
VariablesHistory = new CommonUtils.HistoryList();
Stack = new CommonUtils.EquationStack();
GraphItems = new GraphItemCollection();
CanvasConfig = new GraphCanvasConfig();
}
public void Read(XmlElement root)
{
XmlNode thisNode = root[typeof(CalcConfig).ToString()];
if (thisNode != null)
{
InputHistory.Read(thisNode.SelectSingleNode("list[@name='inputhistory']") as XmlElement);
VariablesHistory.Read(thisNode.SelectSingleNode("list[@name='variablehistory']") as XmlElement);
Stack.Read(thisNode[CommonUtils.EquationStack.xmlTag]);
GraphItems.Read(thisNode[GraphItemCollection.xmlTag]);
CanvasConfig.Read(thisNode[GraphCanvasConfig.xmlTag]);
}
}
public void Write(System.Xml.XmlTextWriter wr)
{
wr.WriteStartElement(typeof(CalcConfig).ToString());
InputHistory.Write(wr, "inputhistory");
VariablesHistory.Write(wr, "variablehistory");
Stack.Write(wr);
GraphItems.Write(wr);
CanvasConfig.Write(wr);
wr.WriteEndElement();
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.