]> O.S.I.I.S - jp/crow.git/commitdiff
search entry assembly for new crow widgets
authorjpbruyere <jp.bruyere@hotmail.com>
Sun, 13 Mar 2016 22:39:22 +0000 (23:39 +0100)
committerjpbruyere <jp.bruyere@hotmail.com>
Sun, 13 Mar 2016 22:39:22 +0000 (23:39 +0100)
src/GraphicObjects/Container.cs
src/GraphicObjects/Group.cs
src/GraphicObjects/TemplatedContainer.cs

index 58512a08046ce09111c7a487ab6003a12f4c239c..69e3a3b4136a9e08ba1d6bb64b7b89c4f5b64c47 100644 (file)
@@ -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);
index 9d458c1dd50c6ccbe82f48fe2a445e32d7c7533a..7ea37161fecc65f2118be0e80f4471bcafddce63 100644 (file)
@@ -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);
index 3003d486489f20c389275aab4cbb0ce9cc11e395..a845722ab40d5a0b93e6da9a88a38618174361cc 100644 (file)
@@ -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);