From: jpbruyere Date: Sun, 13 Mar 2016 22:39:22 +0000 (+0100) Subject: search entry assembly for new crow widgets X-Git-Tag: v0.4~81 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=e5bb6eaee1d61bdcc60ad0a0fb7e81911bd57e47;p=jp%2Fcrow.git search entry assembly for new crow widgets --- 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);