Author: rolf
Date: 2007-10-08 14:08:45 -0400 (Mon, 08 Oct 2007)
New Revision: 87117

Modified:
   trunk/moon/tools/mopen/ChangeLog
   trunk/moon/tools/mopen/mopen.cs
Log:
2007-10-08  Rolf Bjarne Kvinge  <[EMAIL PROTECTED]>

        * mopen.cs: Use the GtkSilver methods to load the xaml.



Modified: trunk/moon/tools/mopen/ChangeLog
===================================================================
--- trunk/moon/tools/mopen/ChangeLog    2007-10-08 18:08:36 UTC (rev 87116)
+++ trunk/moon/tools/mopen/ChangeLog    2007-10-08 18:08:45 UTC (rev 87117)
@@ -1,3 +1,7 @@
+2007-10-08  Rolf Bjarne Kvinge  <[EMAIL PROTECTED]>
+
+       * mopen.cs: Use the GtkSilver methods to load the xaml.
+
 2007-09-22  Zoltan Varga  <[EMAIL PROTECTED]>
 
        * mopen.cs: Update after Moonlight.RegisterLoader change.

Modified: trunk/moon/tools/mopen/mopen.cs
===================================================================
--- trunk/moon/tools/mopen/mopen.cs     2007-10-08 18:08:36 UTC (rev 87116)
+++ trunk/moon/tools/mopen/mopen.cs     2007-10-08 18:08:45 UTC (rev 87117)
@@ -173,32 +173,27 @@
                        return 1;
                }
 
-               DependencyObject d = XamlReader.Load (xaml);
-               if (d == null){
-                       Console.Error.WriteLine ("mopen: No dependency object 
returned from XamlReader");
+               GtkSilver silver = new GtkSilver (400, 400);
+               Canvas canvas;
+
+               if (!silver.LoadXaml (xaml, out canvas)) {
+                       Console.Error.WriteLine ("mopen: Could not load xaml");
                        return 1;
                }
-               
-               if (!(d is Canvas)){
-                       Console.Error.WriteLine ("mopen: No Canvas as root in 
the specified file");
-                       return 1;
-               }
 
                if (parse_only)
                        return 0;
 
-               GtkSilver silver;
-               Canvas canvas = d as Canvas;
+               if (width == -1)
+                       width = (int) canvas.Width;
+               if (height == -1)
+                       height = (int) canvas.Height;
 
-               if (width != -1 && height != -1){
-                       silver = new GtkSilver (width, height);
+               if (width > 0 && height > 0) {
+                       silver.Resize (width, height);
                        window.Resize (width, height);
-               } else if (canvas.Width > 0 && canvas.Height > 0) {
-                       window.Resize ((int) canvas.Width, (int) canvas.Height);
-                       silver = new GtkSilver ((int) canvas.Width, (int) 
canvas.Height);
-               } else {
-                       silver = new GtkSilver (400, 400);
-               }
+               } 
+
                if (transparent){
                        silver.AppPaintable = true;
                        silver.Transparent = true;
@@ -211,7 +206,6 @@
                }
 
                window.Add (silver);
-               silver.Attach (canvas);
 
                window.ShowAll ();
                Application.Run ();

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

Reply via email to