Author: jackson
Date: 2007-11-20 11:30:03 -0500 (Tue, 20 Nov 2007)
New Revision: 89991

Modified:
   trunk/olive/class/agclr/Mono/ChangeLog
   trunk/olive/class/agclr/Mono/ManagedXamlLoader.cs
Log:

        * ManagedXamlLoader.cs: Helper now gives us back an unmanaged
        value if we tried to set a property that was an agclr type.
        Create the wrapper for this type and set the property using the
        new object.



Modified: trunk/olive/class/agclr/Mono/ChangeLog
===================================================================
--- trunk/olive/class/agclr/Mono/ChangeLog      2007-11-20 16:29:44 UTC (rev 
89990)
+++ trunk/olive/class/agclr/Mono/ChangeLog      2007-11-20 16:30:03 UTC (rev 
89991)
@@ -1,3 +1,10 @@
+2007-11-20  Jackson Harper  <[EMAIL PROTECTED]>
+
+       * ManagedXamlLoader.cs: Helper now gives us back an unmanaged
+       value if we tried to set a property that was an agclr type.
+       Create the wrapper for this type and set the property using the
+       new object.
+
 2007-10-10  Chris Toshok  <[EMAIL PROTECTED]>
 
        * ManagedXamlLoader.cs (LoadObject): we need to ref again in this

Modified: trunk/olive/class/agclr/Mono/ManagedXamlLoader.cs
===================================================================
--- trunk/olive/class/agclr/Mono/ManagedXamlLoader.cs   2007-11-20 16:29:44 UTC 
(rev 89990)
+++ trunk/olive/class/agclr/Mono/ManagedXamlLoader.cs   2007-11-20 16:30:03 UTC 
(rev 89991)
@@ -341,31 +341,43 @@
                // Proxy so that we return IntPtr.Zero in case of any failures, 
instead of
                // genreating an exception and unwinding the stack.
                //
-               private void set_custom_attribute (IntPtr target_ptr, string 
name, string value)
+               private bool set_custom_attribute (IntPtr target_ptr, string 
name, string value)
                {
                        try {
-                               SetCustomAttribute (target_ptr, name, value);
+                               return SetCustomAttribute (target_ptr, name, 
value);
                        } catch (Exception ex) {
                                Console.Error.WriteLine 
("ManagedXamlLoader::SetCustomAttribute ({0}, {1}, {2}) threw an exception: 
{3}.", target_ptr, name, value, ex.Message);
+                               return false;
                        }
                }
                
-               private void SetCustomAttribute (IntPtr target_ptr, string 
name, string value)
+               private bool SetCustomAttribute (IntPtr target_ptr, string 
name, string value)
                {
                        Kind k = 
NativeMethods.dependency_object_get_object_type (target_ptr); 
                        DependencyObject target = DependencyObject.Lookup (k, 
target_ptr);
 
                        if (target == null) {
                                //Console.Error.WriteLine 
("ManagedXamlLoader::SetCustomAttribute ({0}, {1}, {2}): unable to create 
target object.", target_ptr, name, value);
-                               return;
+                               return false;
                        }
 
                        string error;
-                       Helper.SetPropertyFromString (target, name, value, out 
error);
+                       IntPtr unmanaged_value;
+                       Helper.SetPropertyFromString (target, name, value, out 
error, out unmanaged_value);
+
+                       if (unmanaged_value != IntPtr.Zero) {
+                               object obj_value = 
DependencyObject.ValueToObject (unmanaged_value);
+
+                               error = null;
+                               Helper.SetPropertyFromValue (target, name, 
obj_value, out error);
+                       }
+
                        if (error != null){
                                //Console.Error.WriteLine 
("ManagedXamlLoader::SetCustomAttribute ({0}, {1}, {2}) unable to set property: 
{3}.", target_ptr, name, value, error);
-                               return;
+                               return false;
                        }
+
+                       return true;
                }
 
                private bool hookup_event (IntPtr target_ptr, string name, 
string value)

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to