private void Application_Startup(object sender, StartupEventArgs e) { main = new MainPage(); main.BackButton.Content = "Foo"; main.BackButton.Click += delegate { if (treemap != null) { treemap.Back(); } }; this.RootVisual = main; var webclient = new WebClient(); webclient.DownloadStringCompleted += delegate(object sender2, DownloadStringCompletedEventArgs ee){ try { RootVisual.Dispatcher.BeginInvoke(() => LoadNodesFromString(ee.Result)); } catch (Exception ex) { main.BackButton.Content = ex.ToString(); } }; webclient.DownloadStringAsync(new Uri("../mscorlib.xml", UriKind.Relative)); }
public static void Main(string[] args) { Node n = null; if (args.Length == 0) { Console.WriteLine("Must specify the XML file with the data to load"); return; } try { n = LoadNodes(args [0], "Size", "Foo"); } catch { Console.WriteLine("Unable to load {0}", args [0]); throw; } Gtk.Application.Init(); MoonlightRuntime.Init(); Gtk.Window w = new Gtk.Window("Foo"); var v = new Gtk.VBox(false, 0); w.DeleteEvent += delegate { Gtk.Application.Quit(); }; w.SetSizeRequest(width, height); MoonlightHost h = new MoonlightHost(); v.PackStart(h, true, true, 0); var back = new Gtk.Button("Back"); v.PackStart(back, false, false, 0); w.Add(v); w.ShowAll(); // Make it pretty, skip all levels that are just 1 element while (n.Children.Count == 1) { n = n.Children [0]; } // Render TreemapRenderer r = new TreemapRenderer(n, ""); r.KeyDown += delegate(object sender, KeyEventArgs e) { if (e.Key == Key.Back) { r.Back(); } }; back.Clicked += delegate { r.Back(); }; SetSize(r, width, height); h.Application.RootVisual = r; w.ResizeChecked += delegate(object sender, EventArgs e) { int new_width, new_heigth; w.GetSize(out new_width, out new_heigth); SetSize(r, new_width, new_heigth);; }; Gtk.Application.Run(); }
public static void Main(string[] args) { Node n = null; if (args.Length == 0){ Console.WriteLine ("Must specify the XML file with the data to load"); return; } try { n = LoadNodes (args [0], "Size", "Foo"); } catch { Console.WriteLine ("Unable to load {0}", args [0]); throw; } Gtk.Application.Init (); MoonlightRuntime.Init (); Gtk.Window w = new Gtk.Window ("Foo"); var v = new Gtk.VBox (false, 0); w.DeleteEvent += delegate { Gtk.Application.Quit (); }; w.SetSizeRequest (width, height); MoonlightHost h = new MoonlightHost (); v.PackStart (h, true, true, 0); var back = new Gtk.Button ("Back"); v.PackStart (back, false, false, 0); w.Add (v); w.ShowAll (); // Make it pretty, skip all levels that are just 1 element while (n.Children.Count == 1) n = n.Children [0]; // Render TreemapRenderer r = new TreemapRenderer (n, ""); r.KeyDown += delegate (object sender, KeyEventArgs e) { if (e.Key == Key.Back) r.Back (); }; back.Clicked += delegate { r.Back (); }; SetSize (r, width, height); h.Application.RootVisual = r; w.ResizeChecked += delegate(object sender, EventArgs e) { int new_width, new_heigth; w.GetSize (out new_width, out new_heigth); SetSize (r, new_width, new_heigth);; }; Gtk.Application.Run (); }