Sun, 25 Jan 2015 15:01:04 +0100
added menus (WPF)
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; namespace UI { public class MainWindow : Window { public MainWindow(String title) { Title = title; Width = 300; Height = 300; // 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) { return Application.GetInstance().Exec<MainWindow>(() => new MainWindow(title)); } public void ShowWindow() { Application.GetInstance().Exec(() => this.Show()); Application.GetInstance().AddWindow(this); } public void CloseEvent(object sender, System.EventArgs e) { Application.GetInstance().RemoveWindow(this); } } }