Author: jackson
Date: 2007-11-19 13:36:08 -0500 (Mon, 19 Nov 2007)
New Revision: 89936

Modified:
   trunk/olive/class/agclr/System.Windows/ChangeLog
   trunk/olive/class/agclr/System.Windows/DependencyObject.cs
Log:

        * DependencyObject.cs: Move the value-to-object code into a
        separate function, so I can use it in the managed xaml parser.



Modified: trunk/olive/class/agclr/System.Windows/ChangeLog
===================================================================
--- trunk/olive/class/agclr/System.Windows/ChangeLog    2007-11-19 18:34:51 UTC 
(rev 89935)
+++ trunk/olive/class/agclr/System.Windows/ChangeLog    2007-11-19 18:36:08 UTC 
(rev 89936)
@@ -1,3 +1,8 @@
+2007-11-19  Jackson Harper  <[EMAIL PROTECTED]>
+
+       * DependencyObject.cs: Move the value-to-object code into a
+       separate function, so I can use it in the managed xaml parser.
+
 2007-10-10  Chris Toshok  <[EMAIL PROTECTED]>
 
        * DependencyObject.cs: remove the old ClearPendingDestroys code,

Modified: trunk/olive/class/agclr/System.Windows/DependencyObject.cs
===================================================================
--- trunk/olive/class/agclr/System.Windows/DependencyObject.cs  2007-11-19 
18:34:51 UTC (rev 89935)
+++ trunk/olive/class/agclr/System.Windows/DependencyObject.cs  2007-11-19 
18:36:08 UTC (rev 89936)
@@ -256,16 +256,24 @@
                                throw new ArgumentNullException ("property");
                        
                        CheckNativeAndThread ();
-                       
-                       unsafe {
-                               Value* val = 
(Value*)NativeMethods.dependency_object_get_value (native, property.native);
-                               if (val == null) {
-                                       if (property.IsValueType && 
!property.IsNullable)
-                                               Console.WriteLine ("Found null 
for object {0}, with property {1}", GetType ().FullName, property.Name);
+
+                       IntPtr val = NativeMethods.dependency_object_get_value 
(native, property.native);
+                       if (val == IntPtr.Zero) {
+                               if (property.IsValueType && 
!property.IsNullable)
+                                       Console.WriteLine ("Found null for 
object {0}, with property {1}", GetType ().FullName, property.Name);
                                
-                                       return null;
-                               }
+                               return null;
+                       }
 
+                       return ValueToObject (val);
+               }
+
+               internal static object ValueToObject (IntPtr value)
+               {
+                                               
+                       unsafe {
+                               Value* val = (Value *) value;
+
                                switch (val->k) {
                                case Kind.INVALID:
                                        return null;

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

Reply via email to