aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects/TemplatedControl.cs
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-08-04 13:12:30 +0200
committerjpbruyere <jp.bruyere@hotmail.com>2016-08-04 14:29:18 +0200
commit3a01c455e09af25109239ab7ca32e66ea1ebc99b (patch)
tree27a7c6923c7285d1a8432ae393c8a5fb8981a28d /src/GraphicObjects/TemplatedControl.cs
parentb24819ffb8f629fb0ed70064f90357a42653ae5d (diff)
* Tests.csproj:
* BasicTests.cs: * TreeView.crow: * welcome.crow: * test4.crow: * testWindow2.goml: * testTreeView.crow: * testDirViewer.crow: update tests * Interface.cs: * OpenTKGameWindow.cs: perf measures * IMLStream.cs: datas prop * TemplatedControl.cs: ItemTemplate * ListBox.cs: thread sync nouveau fichierĀ : Tests/test.style
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