From e5bb6eaee1d61bdcc60ad0a0fb7e81911bd57e47 Mon Sep 17 00:00:00 2001 From: jpbruyere Date: Sun, 13 Mar 2016 23:39:22 +0100 Subject: [PATCH] search entry assembly for new crow widgets --- src/GraphicObjects/Container.cs | 7 +++++++ src/GraphicObjects/Group.cs | 10 +++++++++- src/GraphicObjects/TemplatedContainer.cs | 8 ++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/GraphicObjects/Container.cs b/src/GraphicObjects/Container.cs index 58512a08..69e3a3b4 100644 --- a/src/GraphicObjects/Container.cs +++ b/src/GraphicObjects/Container.cs @@ -51,6 +51,13 @@ namespace Crow return; Type t = Type.GetType("Crow." + subTree.Name); + if (t == null) { + Assembly a = Assembly.GetEntryAssembly (); + foreach (Type expT in a.GetExportedTypes ()) { + if (expT.Name == subTree.Name) + t = expT; + } + } GraphicObject go = (GraphicObject)Activator.CreateInstance(t); (go as IXmlSerializable).ReadXml(subTree); diff --git a/src/GraphicObjects/Group.cs b/src/GraphicObjects/Group.cs index 9d458c1d..7ea37161 100644 --- a/src/GraphicObjects/Group.cs +++ b/src/GraphicObjects/Group.cs @@ -5,6 +5,7 @@ using System.Xml.Serialization; using Cairo; using OpenTK.Input; using System.Diagnostics; +using System.Reflection; namespace Crow @@ -46,7 +47,7 @@ namespace Crow GraphicObject g = child as GraphicObject; Children.Add(g); g.Parent = this as GraphicObject; - ResolveBindings (); + g.ResolveBindings (); g.RegisterForLayouting (LayoutingType.Sizing | LayoutingType.ArrangeChildren); g.LayoutChanged += OnChildLayoutChanges; return (T)child; @@ -339,6 +340,13 @@ namespace Crow break; Type t = Type.GetType("Crow." + subTree.Name); + if (t == null) { + Assembly a = Assembly.GetEntryAssembly (); + foreach (Type expT in a.GetExportedTypes ()) { + if (expT.Name == subTree.Name) + t = expT; + } + } if (t == null) throw new Exception ("Crow." + subTree.Name + " type not found"); GraphicObject go = (GraphicObject)Activator.CreateInstance(t); diff --git a/src/GraphicObjects/TemplatedContainer.cs b/src/GraphicObjects/TemplatedContainer.cs index 3003d486..a845722a 100644 --- a/src/GraphicObjects/TemplatedContainer.cs +++ b/src/GraphicObjects/TemplatedContainer.cs @@ -21,6 +21,7 @@ using System; using System.Xml.Serialization; using System.Xml; +using System.Reflection; namespace Crow { @@ -84,6 +85,13 @@ namespace Crow } Type t = Type.GetType ("Crow." + xr.Name); + if (t == null) { + Assembly a = Assembly.GetEntryAssembly (); + foreach (Type expT in a.GetExportedTypes ()) { + if (expT.Name == xr.Name) + t = expT; + } + } GraphicObject go = (GraphicObject)Activator.CreateInstance (t); (go as IXmlSerializable).ReadXml (xr); -- 2.47.3