ui/wpf/UIcore/Window.cs

changeset 82
0cdb8089a29f
parent 81
5eb765a7a793
child 83
a38aec91bd66
equal deleted inserted replaced
81:5eb765a7a793 82:0cdb8089a29f
8 using System.Windows.Controls; 8 using System.Windows.Controls;
9 9
10 namespace UI 10 namespace UI
11 { 11 {
12 public class MainWindow : Window 12 public class MainWindow : Window
13 { 13 {
14 public MainWindow(String title) 14 public IntPtr Object;
15
16 public MainWindow(String title, IntPtr uiobj)
15 { 17 {
16 Title = title; 18 Title = title;
19 Object = uiobj;
17 Width = 300; 20 Width = 300;
18 Height = 300; 21 Height = 300;
19 22
20 // menu 23 // menu
21 Application app = Application.GetInstance(); 24 Application app = Application.GetInstance();
22 if (!app.AppMenu.IsEmpty()) 25 if (!app.AppMenu.IsEmpty())
23 { 26 {
24 System.Windows.Controls.Menu menu = app.AppMenu.CreateMenu(); 27 System.Windows.Controls.Menu menu = app.AppMenu.CreateMenu(uiobj);
25 this.AddChild(menu); 28 this.AddChild(menu);
26 } 29 }
27 30
28 GC.KeepAlive(this); // TODO: remove KeepAlive and add the Window to the application 31 GC.KeepAlive(this); // TODO: remove KeepAlive and add the Window to the application
29 Closed += CloseEvent; 32 Closed += CloseEvent;
30 } 33 }
31 34
32 public static MainWindow CreateMainWindow(String title) 35 public static MainWindow CreateMainWindow(String title, IntPtr uiobj)
33 { 36 {
34 return Application.GetInstance().Exec<MainWindow>(() => new MainWindow(title)); 37 return Application.GetInstance().Exec<MainWindow>(() => new MainWindow(title, uiobj));
35 } 38 }
36 39
37 public void ShowWindow() 40 public void ShowWindow()
38 { 41 {
39 Application.GetInstance().Exec(() => this.Show()); 42 Application.GetInstance().Exec(() => this.Show());

mercurial