diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2016-08-10 03:07:00 +0200 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2016-08-10 03:07:00 +0200 |
| commit | 69c470239bfbab11192f3699f29b5352d74d3630 (patch) | |
| tree | d998519be790c1bc813a5a0e3e759603d6d17685 /src/GraphicObjects/TemplatedControl.cs | |
| parent | 799fec83c114d30652c96d2d245aaddd89f98db4 (diff) | |
ItemTemplate test, major changes in Instantiator implementation
bugs
modifié : Crow.csproj
modifié : Default.style
modifié : Tests/BasicTests.cs
modifié : Tests/Interfaces/Divers/welcome.crow
modifié : Tests/Interfaces/basicTests/0.crow
modifié : Tests/Interfaces/basicTests/4.crow
modifié : src/GraphicObjects/ListBox.cs
modifié : src/GraphicObjects/ProgressBar.cs
modifié : src/GraphicObjects/TemplatedControl.cs
modifié : src/IMLReader.cs
modifié : src/Instantiator.cs
modifié : src/Interface.cs
renommé : src/IMLStream.cs -> src/ItemTemplate.cs
Diffstat (limited to 'src/GraphicObjects/TemplatedControl.cs')
| -rw-r--r-- | src/GraphicObjects/TemplatedControl.cs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/GraphicObjects/TemplatedControl.cs b/src/GraphicObjects/TemplatedControl.cs index b325a0d2..f78173d2 100644 --- a/src/GraphicObjects/TemplatedControl.cs +++ b/src/GraphicObjects/TemplatedControl.cs @@ -65,7 +65,8 @@ namespace Crow string _template; string _itemTemplate; - public Dictionary<string, ItemTemplate> ItemTemplates; + public Dictionary<string, ItemTemplate> ItemTemplates = new Dictionary<string, Crow.ItemTemplate>();//TODO: dont instantiate if not used + //but then i should test if null in msil gen [XmlAttributeAttribute][DefaultValue(null)] public string Template { @@ -84,7 +85,7 @@ namespace Crow [XmlAttributeAttribute][DefaultValue("#Crow.Templates.ItemTemplate.goml")] public string ItemTemplate { get { return _itemTemplate; } - set { + set { if (value == _itemTemplate) return; @@ -146,7 +147,7 @@ namespace Crow xr.Read (); //read first child xr.Read (); //skip root node - while (!xr.EOF) { + while (!xr.EOF) { if (!xr.IsStartElement ()) { xr.Read (); continue; @@ -164,8 +165,11 @@ namespace Crow if (ItemTemplates == null) ItemTemplates = new Dictionary<string, ItemTemplate> (); - //TODO:check encoding - ItemTemplates[dataType] = new ItemTemplate (Encoding.UTF8.GetBytes(itemTmp)); + + using (IMLReader iTmp = new IMLReader (null, itemTmp)) { + ItemTemplates [dataType] = + new ItemTemplate (iTmp.RootType, iTmp.GetLoader ()); + } if (!string.IsNullOrEmpty (datas)) ItemTemplates [dataType].CreateExpandDelegate(this, dataType, datas); @@ -197,7 +201,7 @@ namespace Crow //if no template found, load default one if (this.child == null) loadTemplate (); - + //normal xml read using (XmlReader xr = new XmlTextReader (tmp, XmlNodeType.Element, null)) { xr.Read (); |