Skip to content

Instantly share code, notes, and snippets.

@jschementi
Created July 23, 2009 09:43
Show Gist options
  • Save jschementi/152611 to your computer and use it in GitHub Desktop.
Save jschementi/152611 to your computer and use it in GitHub Desktop.
using Moonlight.Gtk;
using Moonlight;
public static void Main(string[] args)
{
n = LoadNodes (args [0], "Size", "Foo");
Gtk.Application.Init ();
MoonlightRuntime.Init ();
// My container window.
Gtk.Window w = new Gtk.Window ("Foo");
w.DeleteEvent += delegate {
Gtk.Application.Quit ();
};
w.SetSizeRequest (width, height);
// The Moonlight widget that will host my UI.
MoonlightHost h = new MoonlightHost ();
// Add Moonlight widget, show window.
w.Add (h);
w.ShowAll ();
// Make it pretty, skip all levels that are just 1 element
while (n.Children.Count == 1)
n = n.Children [0];
// Initialize your application's Root Visual
YourUserControl r = new YourUserControl();
// Size your application
Size available = new Size (width, height);
r.Measure (available);
r.Arrange (new Rect (0, 0, width, height));
// This informs the widget which widget is the root
h.Application.RootVisual = r;
Gtk.Application.Run ();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment