From 6847840a3bc4b4df9bfdceea0f5ed80c9e109b91 Mon Sep 17 00:00:00 2001 From: jpbruyere Date: Wed, 16 Sep 2015 15:18:27 +0200 Subject: [PATCH] typo and debug --- src/GraphicObjects/TemplatedContainer.cs | 18 +++++++++++++----- src/OpenTKGameWindow.cs | 6 ++++-- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/GraphicObjects/TemplatedContainer.cs b/src/GraphicObjects/TemplatedContainer.cs index a19f6c28..56217419 100644 --- a/src/GraphicObjects/TemplatedContainer.cs +++ b/src/GraphicObjects/TemplatedContainer.cs @@ -26,15 +26,19 @@ namespace go { public abstract class TemplatedContainer : TemplatedControl { + #region CTOR + public TemplatedContainer () : base(){} + #endregion + [XmlIgnore]public abstract GraphicObject Content{ get; set;} - protected override void loadTemplate (GraphicObject template) + #region GraphicObject overrides + public override void ClearBinding () { - base.loadTemplate (template); - } + if (Content != null) + Content.ClearBinding (); - public TemplatedContainer () : base() - { + base.ClearBinding (); } public override GraphicObject FindByName (string nameToFind) { @@ -43,6 +47,9 @@ namespace go return Content == null ? null : Content.FindByName (nameToFind); } + #endregion + + #region IXmlSerialisation Overrides public override void ReadXml(System.Xml.XmlReader reader) { using (System.Xml.XmlReader subTree = reader.ReadSubtree ()) { @@ -90,6 +97,7 @@ namespace go (Content as IXmlSerializable).WriteXml(writer); writer.WriteEndElement(); } + #endregion } } diff --git a/src/OpenTKGameWindow.cs b/src/OpenTKGameWindow.cs index bc1ebda9..ff1ffeed 100755 --- a/src/OpenTKGameWindow.cs +++ b/src/OpenTKGameWindow.cs @@ -92,11 +92,13 @@ namespace go /// Remove all Graphic objects from top container public void ClearInterface() { - foreach (GraphicObject g in GraphicObjects) { + int i = 0; + while (GraphicObjects.Count>0) { + GraphicObject g = GraphicObjects [i]; g.Visible = false; g.ClearBinding (); + GraphicObjects.RemoveAt (0); } - GraphicObjects.Clear (); } public void Quit () { -- 2.47.3