From 3a01c455e09af25109239ab7ca32e66ea1ebc99b Mon Sep 17 00:00:00 2001 From: jpbruyere Date: Thu, 4 Aug 2016 13:12:30 +0200 Subject: * Tests.csproj: * BasicTests.cs: * TreeView.crow: * welcome.crow: * test4.crow: * testWindow2.goml: * testTreeView.crow: * testDirViewer.crow: update tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Interface.cs: * OpenTKGameWindow.cs: perf measures * IMLStream.cs: datas prop * TemplatedControl.cs: ItemTemplate * ListBox.cs: thread sync nouveau fichierĀ : Tests/test.style --- src/GraphicObjects/TemplatedControl.cs | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'src/GraphicObjects/TemplatedControl.cs') 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 (); //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 -- cgit v1.3.1-4-g156e