4 using Tizen.NUI.BaseComponents;
7 namespace Tizen.NUI.Samples
10 public class SubWindowTest : IExample
12 string tag = "NUITEST";
19 mainWin = NUIApplication.GetDefaultWindow();
20 mainWin.KeyEvent += OnKeyEvent;
21 mainWin.BackgroundColor = Color.Cyan;
22 mainWin.WindowSize = new Size2D(500, 500);
24 TextLabel text = new TextLabel("Hello Tizen NUI World");
25 text.HorizontalAlignment = HorizontalAlignment.Center;
26 text.VerticalAlignment = VerticalAlignment.Center;
27 text.TextColor = Color.Blue;
28 text.PointSize = 12.0f;
29 text.HeightResizePolicy = ResizePolicyType.FillToParent;
30 text.WidthResizePolicy = ResizePolicyType.FillToParent;
33 Animation animation = new Animation(2000);
34 animation.AnimateTo(text, "Orientation", new Rotation(new Radian(new Degree(180.0f)), PositionAxis.X), 0, 500);
35 animation.AnimateTo(text, "Orientation", new Rotation(new Radian(new Degree(0.0f)), PositionAxis.X), 500, 1000);
36 animation.Looping = true;
39 log.Fatal(tag, "animation play!");
42 public void OnKeyEvent(object sender, Window.KeyEventArgs e)
44 if (e.Key.State == Key.StateType.Down)
46 log.Fatal(tag, $"key down! key={e.Key.KeyPressedName}");
48 switch (e.Key.KeyPressedName)
76 log.Fatal(tag, $"no test!");
85 log.Fatal(tag, "test 1 : 1) make sub window-1 2) add some dummy object");
87 subWin1 = new Window("subwin1", new Rectangle(500, 500, 300, 300), false);
88 subWin1.BackgroundColor = Color.Blue;
89 View dummy = new View()
91 Size = new Size(100, 100),
92 Position = new Position(50, 50),
93 BackgroundColor = Color.Yellow,
96 subWin1.KeyEvent += SubWin1_KeyEvent;
100 log.Fatal(tag, "test 2 : 1) do dispose of sub window-1 created in #1");
105 log.Fatal(tag, $"test 3 : 1) create sub window2 which doesn't have any setting 2) dispose it after 3 second delay");
107 subWin2 = new Window();
108 tm = new Timer(3000);
114 log.Fatal(tag, $"test 4 : 1) create sub window2 which has some setting 2) dispose it after 3 second delay");
116 subWin2 = new Window("subWin2", new Rectangle(100, 100, 100, 100), false);
117 subWin2.BackgroundColor = Color.Red;
118 tm = new Timer(3000);
124 log.Fatal(tag, $"test 5 : 1) create sub window2 which has some setting 2) add some dummy object 3) dispose it after 3 second delay");
126 subWin2 = new Window("subWin2", new Rectangle(500, 500, 300, 300), false);
127 subWin2.BackgroundColor = Color.Red;
130 Size = new Size(50, 50),
131 Position = new Position(50, 50),
132 BackgroundColor = Color.Yellow,
136 tm = new Timer(3000);
141 private bool Tm_Tick(object source, Timer.TickEventArgs e)
143 log.Fatal(tag, $"after 3000ms, subwin2 dispose!");
148 private void SubWin1_KeyEvent(object sender, Window.KeyEventArgs e)
150 if (e.Key.State == Key.StateType.Down)
152 log.Fatal(tag, $"subWin1 key down! key={e.Key.KeyPressedName}");
154 switch (e.Key.KeyPressedName)
164 log.Fatal(tag, $"default!");
171 public void Activate() { Initialize(); }
172 public void Deactivate() { }