diff -r 40be5c189e2e -r 5eb765a7a793 ui/wpf/UIcore/Window.cs --- a/ui/wpf/UIcore/Window.cs Sat Jan 24 19:17:35 2015 +0100 +++ b/ui/wpf/UIcore/Window.cs Sun Jan 25 15:01:04 2015 +0100 @@ -10,15 +10,23 @@ namespace UI { public class MainWindow : Window - { - private Label label1; - + { public MainWindow(String title) { Title = title; Width = 300; Height = 300; - GC.KeepAlive(this); // remove KeepAlive and add the Window to the application + + // menu + Application app = Application.GetInstance(); + if (!app.AppMenu.IsEmpty()) + { + System.Windows.Controls.Menu menu = app.AppMenu.CreateMenu(); + this.AddChild(menu); + } + + GC.KeepAlive(this); // TODO: remove KeepAlive and add the Window to the application + Closed += CloseEvent; } public static MainWindow CreateMainWindow(String title) @@ -29,6 +37,12 @@ public void ShowWindow() { Application.GetInstance().Exec(() => this.Show()); + Application.GetInstance().AddWindow(this); + } + + public void CloseEvent(object sender, System.EventArgs e) + { + Application.GetInstance().RemoveWindow(this); } } }