92c52a66ca1caf2886f8b32a2cb00040d3a61227
[platform/core/csapi/xsf.git] / src / XSF / Xamarin.Forms.Platform.Tizen / PreloadedWindow.cs
1 using ElmSharp;
2 using ELayout = ElmSharp.Layout;
3
4 namespace Xamarin.Forms.Platform.Tizen
5 {
6         public class PreloadedWindow
7         {
8                 static PreloadedWindow s_precreated;
9
10                 public PreloadedWindow()
11                 {
12                         s_precreated = this;
13                         Initialize();
14                 }
15
16                 public PreloadedWindow(Window win, ELayout layout)
17                 {
18                         s_precreated = this;
19                         Window = win;
20                         BaseLayout = layout;
21                 }
22
23                 public Window Window
24                 {
25                         get;
26                         protected set;
27                 }
28
29                 public ELayout BaseLayout
30                 {
31                         get;
32                         protected set;
33                 }
34
35                 protected void Initialize()
36                 {
37                         Window = new Window("FormsWindow");
38                         Window.Show();
39
40                         var conformant = new Conformant(Window);
41                         conformant.Show();
42
43                         var layout = new ELayout(conformant);
44                         layout.SetTheme("layout", "application", "default");
45                         layout.Show();
46
47                         BaseLayout = layout;
48                         conformant.SetContent(BaseLayout);
49                 }
50
51                 public static PreloadedWindow GetInstance()
52                 {
53                         var instance = s_precreated;
54                         s_precreated = null;
55                         return instance;
56                 }
57         }
58 }