aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects/TemplatedControl.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/GraphicObjects/TemplatedControl.cs')
-rw-r--r--src/GraphicObjects/TemplatedControl.cs27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/GraphicObjects/TemplatedControl.cs b/src/GraphicObjects/TemplatedControl.cs
index 5b7df01d..590ca84b 100644
--- a/src/GraphicObjects/TemplatedControl.cs
+++ b/src/GraphicObjects/TemplatedControl.cs
@@ -131,14 +131,16 @@ namespace Crow
using (XmlReader xr = new XmlTextReader (tmp, XmlNodeType.Element, null)) {
//load template first if inlined
- xr.Read (); //skip current node
+ xr.Read (); //read first child
+ xr.Read (); //skip root node
- while (!xr.EOF) {
- xr.Read (); //read first child
- if (!xr.IsStartElement ())
+ while (!xr.EOF) {
+ if (!xr.IsStartElement ()) {
+ xr.Read ();
continue;
+ }
if (xr.Name == "ItemTemplate") {
- string dataType = "default", datas, itemTmp;
+ string dataType = "default", datas = "", itemTmp;
while (xr.MoveToNextAttribute ()) {
if (xr.Name == "DataType")
dataType = xr.Value;
@@ -147,13 +149,16 @@ namespace Crow
}
xr.MoveToElement ();
itemTmp = xr.ReadInnerXml ();
- xr.Read ();//itemTemplate close tag
+
if (itemTemplates == null)
itemTemplates = new Dictionary<string, IMLStream> ();
//TODO:check encoding
itemTemplates[dataType] = new IMLStream (Encoding.UTF8.GetBytes(itemTmp));
+ itemTemplates [dataType].Datas = datas;
- }else if (xr.Name == "Template") {
+ continue;
+ }
+ if (xr.Name == "Template") {
xr.Read ();
Type t = Type.GetType ("Crow." + xr.Name);
@@ -161,11 +166,9 @@ namespace Crow
(go as IXmlSerializable).ReadXml (xr);
loadTemplate (go);
-
- xr.Read ();//go close tag
- //xr.Read ();//Template close tag
- } else
- xr.ReadInnerXml ();
+ continue;
+ }
+ xr.ReadInnerXml ();
}
}
} else